diff --git a/sources/wiringlistexport.cpp b/sources/wiringlistexport.cpp index df81bf25c..3754a8dc8 100644 --- a/sources/wiringlistexport.cpp +++ b/sources/wiringlistexport.cpp @@ -145,6 +145,7 @@ QList WiringListExport::collectConductors(const QDomElement &root data.conductor_color = cond.attribute("conductor_color"); data.conductor_section = cond.attribute("conductor_section"); data.function = cond.attribute("function"); + data.cable = cond.attribute("cable"); QDomElement diag = climbToDiagram(cond); data.folio = findDiagramFolio(diag); @@ -331,6 +332,7 @@ QString WiringListExport::toCsvString() const merged.conductor_color = mergeField(otherHalf.conductor_color, normC.conductor_color); merged.conductor_section = mergeField(otherHalf.conductor_section, normC.conductor_section); merged.function = mergeField(otherHalf.function, normC.function); + merged.cable = mergeField(otherHalf.cable, normC.cable); uniqueConductors.append(merged); } @@ -370,7 +372,8 @@ QString WiringListExport::toCsvString() const << tr("Tension / Protocole", "Wiring list CSV header") << ";" << tr("Couleur du fil", "Wiring list CSV header") << ";" << tr("Section du fil", "Wiring list CSV header") << ";" - << tr("Fonction", "Wiring list CSV header") << "\n"; + << tr("Fonction", "Wiring list CSV header") << ";" + << tr("Câble", "Wiring list CSV header") << "\n"; for (const ConductorData &c : uniqueConductors) { out << c.folio << ";" @@ -381,7 +384,8 @@ QString WiringListExport::toCsvString() const << c.tension_protocol << ";" << c.conductor_color << ";" << c.conductor_section << ";" - << c.function << "\n"; + << c.function << ";" + << c.cable << "\n"; } return csv; diff --git a/sources/wiringlistexport.h b/sources/wiringlistexport.h index 741a81dd4..8f1696b29 100644 --- a/sources/wiringlistexport.h +++ b/sources/wiringlistexport.h @@ -32,6 +32,7 @@ struct ConductorData { QString conductor_color; QString conductor_section; QString function; + QString cable; QString folio; int folio_index = 0; // position of the folio in the project, from 1 }; diff --git a/tests/qttest/fixtures/wiring_list_arrows.qet b/tests/qttest/fixtures/wiring_list_arrows.qet index 0ab8a0eff..c7930cdf0 100644 --- a/tests/qttest/fixtures/wiring_list_arrows.qet +++ b/tests/qttest/fixtures/wiring_list_arrows.qet @@ -280,7 +280,7 @@ - + @@ -323,7 +323,7 @@ - + @@ -383,7 +383,7 @@ - + diff --git a/tests/qttest/tst_wiringlistexport.cpp b/tests/qttest/tst_wiringlistexport.cpp index 399ac58af..2c36563c5 100644 --- a/tests/qttest/tst_wiringlistexport.cpp +++ b/tests/qttest/tst_wiringlistexport.cpp @@ -16,7 +16,8 @@ // With several wires on a side the diagram does not say which terminal is // wired to which, so those wires are not joined. The Page column is the // folio number as the folio shows it, not its "%id/%total" template, and -// rows come in folio order. +// rows come in folio order. The last column is the wire's cable; the two +// halves of P both say W1, which is written once. class tst_wiringlistexport : public QObject { Q_OBJECT @@ -73,13 +74,13 @@ private slots: QVERIFY2(!fixture.isEmpty(), "fixture project not found"); const QStringList expected { - QStringLiteral("1/6, 2/6;PA;A1;PB;A1;;;;"), - QStringLiteral("3/6;EA;A1;;1;;;;"), - QStringLiteral("3/6;EA2;A1;;1;;;;"), - QStringLiteral("4/6;EB;A1;;1;;;;"), - QStringLiteral("5/6;LA;A1;;1;;;;"), - QStringLiteral("6/6;LB;A1;;1;;;;"), - QStringLiteral("6/6;LD;A1;;1;;;;"), + QStringLiteral("1/6, 2/6;PA;A1;PB;A1;;;;;W1"), + QStringLiteral("3/6;EA;A1;;1;;;;;W2"), + QStringLiteral("3/6;EA2;A1;;1;;;;;"), + QStringLiteral("4/6;EB;A1;;1;;;;;"), + QStringLiteral("5/6;LA;A1;;1;;;;;"), + QStringLiteral("6/6;LB;A1;;1;;;;;"), + QStringLiteral("6/6;LD;A1;;1;;;;;"), }; bool ok; QCOMPARE(exportCables(fixture, &ok), expected);