Merge pull request #1299 from ispyisail/fix/1280-junction-dot-potential

Fix #1280: missing junction dot where wires share a line
This commit is contained in:
Laurent Trinques
2026-10-04 07:34:46 +02:00
committed by GitHub
5 changed files with 501 additions and 30 deletions
+53 -30
View File
@@ -2107,16 +2107,58 @@ QPainterPath Conductor::paintedPath() const
}
/**
@return la liste des positions des jonctions avec d'autres conducteurs
@return true if \a scene_point, where this conductor bends with
\a bend_type, lies on one of the segments of \a c and \a c does not
bend the same way at the same point.
*/
bool Conductor::bendMakesJunction(const Conductor *c, const QPointF &scene_point,
Qt::Corner bend_type) const
{
// exprime le point dans les coordonnees de l'autre conducteur
const QPointF conductor_point = c -> mapFromScene(scene_point);
bool on_conductor = false;
for (ConductorSegment *segment : c -> segmentsList())
{
if (isContained(conductor_point, segment -> firstPoint(), segment -> secondPoint()))
{
on_conductor = true;
break;
}
}
if (!on_conductor)
return false;
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
for (const ConductorBend &cb : c -> bends())
{
if (cb.first == conductor_point && cb.second == bend_type)
return false;
}
return true;
}
/**
@return the positions, in this conductor's coordinates, of the junction
dots this conductor draws: each of its bends that lies on another
conductor of the same potential, unless that conductor bends the same
way at the same point.
*/
QList<QPointF> Conductor::junctions() const
{
QList<QPointF> junctions_list;
// pour qu'il y ait des jonctions, il doit y avoir d'autres conducteurs et des bifurcations
QList<Conductor *> other_conductors = relatedConductors(this);
QList<ConductorBend> bends_list = bends();
if (other_conductors.isEmpty() || bends_list.isEmpty()) {
if (bends_list.isEmpty()) {
return(junctions_list);
}
// Every conductor of the potential on this folio, not only those on
// this conductor's own terminals: a bend can lie on a conductor it
// shares no terminal with, e.g. when the horizontal parts of a chain
// of conductors are dragged over each other (issue #1280).
const QList<Conductor *> other_conductors =
const_cast<Conductor *>(this)->relatedPotentialConductors(false).values();
if (other_conductors.isEmpty()) {
return(junctions_list);
}
@@ -2139,37 +2181,18 @@ QList<QPointF> Conductor::junctions() const
// si le point n'est pas une bifurcation, il ne peut etre une jonction (enfin pas au niveau de ce conducteur)
if (!is_bend) continue;
bool is_junction = false;
QPointF scene_point = mapToScene(point);
foreach(Conductor *c, other_conductors)
bool is_junction = false;
for (Conductor *c : other_conductors)
{
// exprime le point dans les coordonnees de l'autre conducteur
QPointF conductor_point = c -> mapFromScene(scene_point);
// recupere les segments de l'autre conducteur
QList<ConductorSegment *> c_segments = c -> segmentsList();
if (c_segments.isEmpty())
continue;
// parcoure les segments a la recherche d'un point commun
for (int j = 0 ; j < c_segments.count() ; ++ j)
if (bendMakesJunction(c, scene_point, current_bend_type))
{
ConductorSegment *segment = c_segments[j];
// un point commun a ete trouve sur ce segment
if (isContained(conductor_point, segment -> firstPoint(), segment -> secondPoint()))
{
is_junction = true;
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
QList<ConductorBend> other_conductor_bends = c -> bends();
foreach(ConductorBend cb, other_conductor_bends)
{
if (cb.first == conductor_point && cb.second == current_bend_type)
{
is_junction = false;
}
}
}
if (is_junction) junctions_list << point;
is_junction = true;
break;
}
}
if (is_junction) junctions_list << point;
}
return(junctions_list);
}
+1
View File
@@ -237,6 +237,7 @@ class Conductor : public QGraphicsObject
uint segmentsCount(QET::ConductorSegmentType = QET::Both) const;
QList<QPointF> segmentsToPoints() const;
QList<ConductorBend> bends() const;
bool bendMakesJunction(const Conductor *, const QPointF &, Qt::Corner) const;
void pointsToSegments(const QList<QPointF>&);
Qt::Corner currentPathType() const;
+12
View File
@@ -441,6 +441,18 @@ target_link_libraries(tst_potentialtextcarrier PRIVATE Qt::Test)
target_compile_definitions(tst_potentialtextcarrier PRIVATE
"QET_TEST_BINARY_PATH=\"$<TARGET_FILE:qelectrotech>\"")
# Junction dots: a wire's corner that lies on another wire of the same
# potential gets a dot, even when the two share no terminal (issue #1280).
# Exports fixtures/junction_dot_shared_potential.qet through the real binary.
add_executable(
tst_junctiondots
tst_junctiondots.cpp)
add_test(NAME tst_junctiondots COMMAND tst_junctiondots)
add_dependencies(tst_junctiondots qelectrotech)
target_link_libraries(tst_junctiondots PRIVATE Qt::Test)
target_compile_definitions(tst_junctiondots PRIVATE
"QET_TEST_BINARY_PATH=\"$<TARGET_FILE:qelectrotech>\"")
# With SOURCE_DATE_EPOCH set, --export-pdf writes the same bytes for the
# same project in every run. Exports examples/741.qet several times, in
# separate processes.
@@ -0,0 +1,354 @@
<project title="i1280" uuid="{abc27554-b301-5651-8055-41e0ce4599cb}" version="0.200.1">
<properties>
<property name="saveddate" show="1">10/4/26</property>
<property name="saveddate-eu" show="1">04-10-2026</property>
<property name="saveddate-us" show="1">2026-10-04</property>
<property name="savedfilename" show="1">skeleton</property>
<property name="savedfilepath" show="1">/tmp/qet-mcp-new-jk9lz64u/skeleton.qet</property>
<property name="savedtime" show="1">10:28</property>
</properties>
<usage enabled="true" time_spent="0"/>
<newdiagrams>
<border cols="17" colsize="60" displaycols="true" displayrows="true" rows="8" rowsize="80"/>
<inset author="" auto_page_num="" date="null" displayAt="bottom" filename="" folio="" indexrev="" locmach="" plant="" title="" version=""/>
<conductors bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" formula="" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="0" tension_protocol="" text_color="#000000" type="multi" vertical-alignment="AlignRight" vertirotatetext="270"/>
<report label="%f-%l%c"/>
<xrefs>
<xref delayprefix="" displayhas="cross" master_label="%f-%l%c" offset="0" powerprefix="" showallconfiguredslaves="false" showpowerctc="true" showterminalname="true" slave_label="(%f-%l%c)" slave_offset="0" snapto="label" switchprefix="" type="coil" xrefpos="AlignBottom"/>
<xref delayprefix="" displayhas="cross" master_label="%f-%l%c" offset="0" powerprefix="" showallconfiguredslaves="false" showpowerctc="true" showterminalname="true" slave_label="(%f-%l%c)" slave_offset="0" snapto="label" switchprefix="" type="commutator" xrefpos="AlignBottom"/>
<xref delayprefix="" displayhas="cross" master_label="%f-%l%c" offset="0" powerprefix="" showallconfiguredslaves="false" showpowerctc="true" showterminalname="true" slave_label="(%f-%l%c)" slave_offset="0" snapto="label" switchprefix="" type="plc" xrefpos="AlignBottom"/>
<xref delayprefix="" displayhas="cross" master_label="%f-%l%c" offset="0" powerprefix="" showallconfiguredslaves="false" showpowerctc="true" showterminalname="true" slave_label="(%f-%l%c)" slave_offset="0" snapto="label" switchprefix="" type="protection" xrefpos="AlignBottom"/>
</xrefs>
<conductors_autonums auto_break_conductors="false" current_autonum="" freeze_new_conductors="false"/>
<folio_autonums/>
<element_autonums current_autonum="" freeze_new_elements="false"/>
<guides/>
</newdiagrams>
<diagram author="" auto_page_num="" cols="17" colsize="60" date="null" displayAt="bottom" displaycols="true" displayrows="true" filename="" folio="" freezeNewConductor="false" freezeNewElement="false" height="660" indexrev="" locmach="" order="1" plant="" rows="8" rowsize="80" title="" uuid="{a94486ed-a490-4ae0-9698-b075035de54d}" version="0.200.1-dev">
<defaultconductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" formula="" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="0" tension_protocol="" text_color="#000000" type="multi" vertical-alignment="AlignRight" vertirotatetext="270"/>
<elements>
<element freezeLabel="false" is_movable="1" orientation="0" prefix="S" type="embed://import/10_electric/10_allpole/310_relays_contactors_contacts/03_contacts/act_comptage_no.elmt" uuid="{6c58a5a1-aa4e-40c4-9e9d-a76524f76e52}" x="100" y="300" z="10">
<terminals>
<terminal id="0" orientation="0" x="0" y="-26"/>
<terminal id="1" orientation="2" x="0" y="6"/>
</terminals>
<inputs/>
<dynamic_texts>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{1b01d6c6-86f7-44e4-8e76-eba4b3a53dea}" x="-13" y="-2">
<text>14</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{65cedcc2-1a82-4168-858c-8751bc1561d9}" x="-13" y="-34">
<text>11</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="ElementInfo" text_width="-1" uuid="{91920aeb-94ef-423e-a282-206489f04e5e}" x="1" y="-22">
<text></text>
<info_name>label</info_name>
</dynamic_elmt_text>
</dynamic_texts>
<texts_groups/>
</element>
<element freezeLabel="false" is_movable="1" orientation="0" prefix="S" type="embed://import/10_electric/10_allpole/310_relays_contactors_contacts/03_contacts/act_comptage_no.elmt" uuid="{29b32d7b-5ec3-42c8-afda-788e9614c0fd}" x="200" y="300" z="10">
<terminals>
<terminal id="2" orientation="0" x="0" y="-26"/>
<terminal id="3" orientation="2" x="0" y="6"/>
</terminals>
<inputs/>
<dynamic_texts>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{827f6a67-cf32-448a-b33a-e52fbbb9cee7}" x="-13" y="-2">
<text>14</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{8fe1bb6c-bd54-429f-b8b9-2b1ca789ed2c}" x="-13" y="-34">
<text>11</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="ElementInfo" text_width="-1" uuid="{15fa6b73-1702-4e17-b821-3bd12f81e7ba}" x="1" y="-22">
<text></text>
<info_name>label</info_name>
</dynamic_elmt_text>
</dynamic_texts>
<texts_groups/>
</element>
<element freezeLabel="false" is_movable="1" orientation="0" prefix="S" type="embed://import/10_electric/10_allpole/310_relays_contactors_contacts/03_contacts/act_comptage_no.elmt" uuid="{b6bceef1-5f5c-4119-bc0c-4ea629eb0baa}" x="300" y="300" z="10">
<terminals>
<terminal id="4" orientation="0" x="0" y="-26"/>
<terminal id="5" orientation="2" x="0" y="6"/>
</terminals>
<inputs/>
<dynamic_texts>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{93d83639-c2c1-4af5-9048-c0a5e0f241b8}" x="-13" y="-2">
<text>14</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{c14602f0-24e8-463c-a183-3dac7f78e009}" x="-13" y="-34">
<text>11</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="ElementInfo" text_width="-1" uuid="{662e7f9d-9f6d-40b4-b517-7b584f6b3604}" x="1" y="-22">
<text></text>
<info_name>label</info_name>
</dynamic_elmt_text>
</dynamic_texts>
<texts_groups/>
</element>
<element freezeLabel="false" is_movable="1" orientation="0" prefix="S" type="embed://import/10_electric/10_allpole/310_relays_contactors_contacts/03_contacts/act_comptage_no.elmt" uuid="{5d8752c5-1f02-4ef1-a24f-c7844ede38c2}" x="400" y="300" z="10">
<terminals>
<terminal id="6" orientation="0" x="0" y="-26"/>
<terminal id="7" orientation="2" x="0" y="6"/>
</terminals>
<inputs/>
<dynamic_texts>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{3c604f1b-1498-4b2b-9f2d-0063e2bcb78c}" x="-13" y="-2">
<text>14</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="UserText" text_width="-1" uuid="{dbb98cf7-9d66-4d99-91d9-2149077d6ba2}" x="-13" y="-34">
<text>11</text>
</dynamic_elmt_text>
<dynamic_elmt_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" rotation_point_center="false" text_from="ElementInfo" text_width="-1" uuid="{a8efc4c9-bfb3-4bde-a501-6b1bd5f93ae5}" x="1" y="-22">
<text></text>
<info_name>label</info_name>
</dynamic_elmt_text>
</dynamic_texts>
<texts_groups/>
</element>
</elements>
<conductors>
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{6c58a5a1-aa4e-40c4-9e9d-a76524f76e52}" element1_label="" element1_name="Normally open counter" element2="{29b32d7b-5ec3-42c8-afda-788e9614c0fd}" element2_label="" element2_name="Normally open counter" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="0" tension_protocol="" terminal1="{77224246-2278-498a-88e5-1ecd84e938e8}" terminal2="{77224246-2278-498a-88e5-1ecd84e938e8}" terminalname1="" terminalname2="" text_color="#000000" type="multi" uuid="{f5162c59-0c59-4e94-b6a6-4cf259a52d91}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
<sequentialNumbers/>
</conductor>
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{6c58a5a1-aa4e-40c4-9e9d-a76524f76e52}" element1_label="" element1_name="Normally open counter" element2="{5d8752c5-1f02-4ef1-a24f-c7844ede38c2}" element2_label="" element2_name="Normally open counter" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="0" tension_protocol="" terminal1="{77224246-2278-498a-88e5-1ecd84e938e8}" terminal2="{77224246-2278-498a-88e5-1ecd84e938e8}" terminalname1="" terminalname2="" text_color="#000000" type="multi" uuid="{89cacce1-b12a-4ec3-aadf-d3f8feb7494d}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
<sequentialNumbers/>
</conductor>
<conductor bicolor="false" bus="" cable="" color2="#000000" condsize="1" conductor_color="" conductor_section="" dash-size="1" displaytext="1" element1="{29b32d7b-5ec3-42c8-afda-788e9614c0fd}" element1_label="" element1_name="Normally open counter" element2="{b6bceef1-5f5c-4119-bc0c-4ea629eb0baa}" element2_label="" element2_name="Normally open counter" formula="" freezeLabel="false" function="" horizontal-alignment="AlignBottom" horizrotatetext="0" num="_" numsize="7" onetextperfolio="0" tension_protocol="" terminal1="{77224246-2278-498a-88e5-1ecd84e938e8}" terminal2="{77224246-2278-498a-88e5-1ecd84e938e8}" terminalname1="" terminalname2="" text_color="#000000" type="multi" uuid="{944a0069-bad6-4d92-91ad-7aedf3961c8a}" vertical-alignment="AlignRight" vertirotatetext="270" x="0" y="0">
<sequentialNumbers/>
</conductor>
</conductors>
</diagram>
<collection>
<category name="import">
<names>
<name lang="ca">Elements importats</name>
<name lang="cs">Zavedené prvky</name>
<name lang="da">Importerede elementer</name>
<name lang="de">Importierte Elemente</name>
<name lang="el">Εισηγμένα στοιχεία</name>
<name lang="en">Imported elements</name>
<name lang="es">Elementos importados</name>
<name lang="fr">Éléments importés</name>
<name lang="hr">Uvezeni elementi</name>
<name lang="it">Elementi importati</name>
<name lang="ja">インバートされた要素</name>
<name lang="ko">전기 심볼 요소</name>
<name lang="ko_KR">전기 심볼 요소</name>
<name lang="nl">Elementen geïmporteerd</name>
<name lang="nl_BE">Elementen geïmporteerd</name>
<name lang="pl">Elementy importowane</name>
<name lang="pt">Elementos importados</name>
<name lang="pt_BR">Elementos importados</name>
<name lang="ro">Elemente importate</name>
<name lang="ru">Импортированные элементы</name>
<name lang="sl">Uvoženi elementi</name>
<name lang="sv">Importerade element</name>
<name lang="tr">İthal öğeler</name>
<name lang="uk">Імпортовані елементи</name>
<name lang="zh">导入元件</name>
</names>
<category name="10_electric">
<names>
<name lang="ar">كهربائي</name>
<name lang="ca">Elèctric</name>
<name lang="cs">Elektrotechnika</name>
<name lang="da">Elektrisk</name>
<name lang="de">Elektrik</name>
<name lang="el">Ηλεκτρικά</name>
<name lang="en">Electric</name>
<name lang="es">Eléctrica</name>
<name lang="fi">Sähkö</name>
<name lang="fr">Electrique</name>
<name lang="hr">Električno</name>
<name lang="hu">Elektromos</name>
<name lang="it">Elettrica</name>
<name lang="ja">電気</name>
<name lang="ko">전기</name>
<name lang="mn">Цахилгаан</name>
<name lang="nb">Elektrisk</name>
<name lang="nl">Elektrotechniek</name>
<name lang="nl_BE">Elektrisch</name>
<name lang="pl">Elektrotechnika</name>
<name lang="pt">Elétrico</name>
<name lang="pt_BR">Elétrica</name>
<name lang="ro">Electric</name>
<name lang="ru">Электротехника</name>
<name lang="sk">Elektrické</name>
<name lang="sl">Elektrika</name>
<name lang="sr">Електрика</name>
<name lang="sv">El</name>
<name lang="tr">Elektrik</name>
<name lang="uk">Електрика</name>
<name lang="zh">10_电气</name>
<name lang="zn">电气工程</name>
</names>
<category name="10_allpole">
<names>
<name lang="ar">متعدد الأقطاب</name>
<name lang="ca">Multifilar</name>
<name lang="cs">Vícežilový</name>
<name lang="da">Flere ledere</name>
<name lang="de">Allpolig</name>
<name lang="el">Πολυγραμμικό</name>
<name lang="en">All-pole</name>
<name lang="es">Multifilar</name>
<name lang="fi">Yleisnapa</name>
<name lang="fr">Multifilaire</name>
<name lang="hr">Univerzalni</name>
<name lang="hu">Többvonalas szimbólumok</name>
<name lang="it">Multifilare</name>
<name lang="ja">複線</name>
<name lang="ko">다-극</name>
<name lang="mn">Бүх туйл</name>
<name lang="nb">Alle poler</name>
<name lang="nl">Veel polig</name>
<name lang="nl_BE">All-pole</name>
<name lang="pl">Schematy wieloliniowe</name>
<name lang="pt">Multipolar</name>
<name lang="pt_BR">Multifilar</name>
<name lang="ro">Bipolar</name>
<name lang="ru">Многополюсные</name>
<name lang="sk">Všepólové</name>
<name lang="sl">Vsi poli</name>
<name lang="sr">Свe-полни</name>
<name lang="sv">Allpolig</name>
<name lang="tr">Çok kutuplu</name>
<name lang="uk">Багатополюсні</name>
<name lang="zh">10_全极</name>
</names>
<category name="310_relays_contactors_contacts">
<names>
<name lang="ar">المرحّلات والموصّلات وجهات الاتصال</name>
<name lang="ca">Relés, contactors i contactes</name>
<name lang="cs">Relé, stykače a kontakty</name>
<name lang="da">Relæer, kontaktorer og kontakter</name>
<name lang="de">Relais, Schütze und Kontakte</name>
<name lang="el">Ηλεκτρονόμοι και επαφές</name>
<name lang="en">Relays, contactors and contacts</name>
<name lang="es">Relevadores, contactores y contactos</name>
<name lang="fi">Releet, kontaktorit ja koskettimet</name>
<name lang="fr">Relais, contacteurs et contacts</name>
<name lang="hr">Releji, kontaktori i kontakti</name>
<name lang="hu">Relék, kontaktorok és érintkezők</name>
<name lang="it">Relè, contattori e contatti</name>
<name lang="ja">継電器、接触器、接点</name>
<name lang="ko">릴레이, 커넥터및 접점</name>
<name lang="mn">Реле, контактор болон контакт</name>
<name lang="nb">Reléer, kontaktorere og kontakter</name>
<name lang="nl">Relais, contactoren en contacten</name>
<name lang="nl_BE">Relais, contacteurs en contacten</name>
<name lang="pl">Przekaźniki i styczniki</name>
<name lang="pt">Relés, contatores e contactos</name>
<name lang="pt_BR">Relés, Contatores e contatos</name>
<name lang="ro">Relee, contactoare și contacte</name>
<name lang="ru">Реле, пускатели и контакты</name>
<name lang="sk">Relé, stykače a kontakty</name>
<name lang="sl">Releji, kontaktorji in kontakti</name>
<name lang="sr">Релеји, контактори и контакти</name>
<name lang="sv">Reläer, kontaktorer och kontakter</name>
<name lang="tr">Röleler, kontaktörler ve kontaklar</name>
<name lang="uk">Реле, контактори та контакти</name>
<name lang="zh">继电器、接触器与触点</name>
</names>
<category name="03_contacts">
<names>
<name lang="ar">جهات الاتصال</name>
<name lang="ca">Contactes</name>
<name lang="cs">Kontakty</name>
<name lang="da">Kontaktpersoner</name>
<name lang="de">Kontakte</name>
<name lang="el">Επαφές</name>
<name lang="en">Contacts</name>
<name lang="es">Contactos</name>
<name lang="fi">Kosketimet</name>
<name lang="fr">Contacts</name>
<name lang="hr">Kontakti</name>
<name lang="hu">Kapcsolatok</name>
<name lang="it">Contatti</name>
<name lang="ja">連絡先</name>
<name lang="ko">접점</name>
<name lang="mn">Харилцагчид</name>
<name lang="nb">Kontakter</name>
<name lang="nl">Contacten</name>
<name lang="nl_BE">Contacten</name>
<name lang="pl">Łączność</name>
<name lang="pt">Contatos</name>
<name lang="pt_BR">Contatos</name>
<name lang="ro">Contacte</name>
<name lang="ru">Контакты</name>
<name lang="sk">Kontakty</name>
<name lang="sl">Stiki</name>
<name lang="sr">Контакти</name>
<name lang="sv">Kontakter</name>
<name lang="tr">Kişiler</name>
<name lang="uk">Контакти</name>
<name lang="zh">触点</name>
</names>
<element name="act_comptage_no.elmt">
<definition height="60" hotspot_x="22" hotspot_y="41" link_type="simple" type="element" version="0.100.0" width="30">
<uuid uuid="{19fdfdc7-c1fe-4604-cb14-da967d1a5252}"/>
<names>
<name lang="ar">عدّاد مفتوح عادة</name>
<name lang="ca">Taulell normalment obert</name>
<name lang="cs">Kontakt čítače (NO)</name>
<name lang="da">Normalt åben tæller</name>
<name lang="de">Öffner Zähler betätigt</name>
<name lang="el">Ανοικτή επαφή μετρητή</name>
<name lang="en">Normally open counter</name>
<name lang="es">Contador NA</name>
<name lang="fi">Normaalisti avoin laskuri</name>
<name lang="fr">Actionné par comptage NO</name>
<name lang="hr">Brojač normalno otvoren</name>
<name lang="hu">Alaphelyzetben nyitott számláló</name>
<name lang="it">Contatto azionato da un contatore (NO)</name>
<name lang="ja">常開カウンター</name>
<name lang="ko">평상시 열림 카운터</name>
<name lang="mn">Ихэвчлэн нээлттэй тоолуур</name>
<name lang="nb">Normalt åpen teller</name>
<name lang="nl">Teller contact (NO)</name>
<name lang="nl_BE">Normaal open teller</name>
<name lang="pl">Zestyk zwierny licznika</name>
<name lang="pt">Contador normalmente aberto</name>
<name lang="pt_BR">Contato NA acionado por contador</name>
<name lang="ro">Contor normal deschis</name>
<name lang="ru">Счётчик с нормально открытым контактом</name>
<name lang="sk">Počítadlo s kontaktom NO</name>
<name lang="sl">Števec normalno odprt</name>
<name lang="sr">Бројач нормално отворен</name>
<name lang="sv">Räknare med slutande kontakt</name>
<name lang="tr">Normalde açık sayaç</name>
<name lang="uk">Лічильник нормально розімкнений</name>
<name lang="zh">计数驱动常开触点</name>
</names>
<informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
<description>
<rect antialias="false" height="10" rx="0" ry="0" style="line-style:normal;line-weight:thin;filling:none;color:black" width="10" x="-20" y="-15"/>
<line antialias="false" end1="none" end2="none" length1="1.5" length2="1.5" style="line-style:dashed;line-weight:thin;filling:none;color:black" x1="-10" x2="-3" y1="-10" y2="-10"/>
<dynamic_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" text_from="UserText" text_width="-1" uuid="{a3321491-1dac-42e2-a9d1-1a43604116a9}" x="-13" y="-2" z="3">
<text>14</text>
</dynamic_text>
<dynamic_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" text_from="UserText" text_width="-1" uuid="{a82a123f-f3cf-4dd7-93c0-44bbdd940429}" x="-13" y="-34" z="4">
<text>11</text>
</dynamic_text>
<dynamic_text Halignment="AlignLeft" Valignment="AlignTop" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" frame="false" keep_visual_rotation="false" rotation="0" text_from="ElementInfo" text_width="-1" uuid="{960d8065-c520-4d45-aa36-4bb600c0e6db}" x="1" y="-22" z="5">
<text/>
<info_name>label</info_name>
</dynamic_text>
<polygon antialias="true" closed="false" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="-5" x2="0" x3="0" y1="-20" y2="0" y3="10"/>
<line antialias="false" end1="none" end2="none" length1="1.5" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="0" x2="0" y1="-30" y2="-20"/>
<ellipse antialias="true" height="4" style="line-style:normal;line-weight:thin;filling:none;color:black" width="4" x="-17" y="-12"/>
<terminal name="" orientation="s" type="Generic" uuid="{572018e1-9843-49dd-964f-836ff27b8240}" x="0" y="10"/>
<terminal name="" orientation="n" type="Generic" uuid="{77224246-2278-498a-88e5-1ecd84e938e8}" x="0" y="-30"/>
</description>
</definition>
</element>
</category>
</category>
</category>
</category>
</category>
</collection>
</project>
+81
View File
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <QtTest>
#include <QDir>
#include <QFile>
#include <QProcess>
#include <QProcessEnvironment>
#include <QRegularExpression>
#include <QSet>
#include <QTemporaryDir>
// fixtures/junction_dot_shared_potential.qet: four contacts K1..K4 in a row,
// wired K1-K2, K1-K4 and K2-K3. All three wires run along one line above the
// contacts, so there is a T above K2 and another above K3. The corner above
// K3 belongs to K2-K3 and lies on K1-K4, which shares no terminal with it:
// that dot used to be missing (issue #1280).
class tst_junctiondots : public QObject
{
Q_OBJECT
QTemporaryDir m_dir;
// Export the fixture to SVG and return the distinct positions of the
// junction dots drawn on it.
QSet<QString> dots()
{
const QString home = m_dir.filePath(QStringLiteral("home"));
const QString out = m_dir.filePath(QStringLiteral("svg"));
QDir().mkpath(home);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("offscreen"));
env.insert(QStringLiteral("HOME"), home);
env.insert(QStringLiteral("XDG_CONFIG_HOME"), home + QStringLiteral("/config"));
env.insert(QStringLiteral("XDG_DATA_HOME"), home + QStringLiteral("/data"));
env.insert(QStringLiteral("TMPDIR"), home);
QProcess proc;
proc.setProcessEnvironment(env);
proc.start(QStringLiteral(QET_TEST_BINARY_PATH),
{QStringLiteral("--export-svg"),
QFINDTESTDATA("fixtures/junction_dot_shared_potential.qet"), out});
if (!proc.waitForFinished(60000) || proc.exitCode() != 0)
return {};
const QStringList svgs = QDir(out).entryList({QStringLiteral("*.svg")});
if (svgs.size() != 1)
return {};
QFile f(QDir(out).filePath(svgs.first()));
if (!f.open(QIODevice::ReadOnly))
return {};
const QString svg = QString::fromUtf8(f.readAll());
// A junction dot on a wire of the default width is a circle
// 3.0 across; the symbols in the fixture draw none that size.
static const QRegularExpression re(
QStringLiteral("<circle cx=\"([^\"]*)\" cy=\"([^\"]*)\" r=\"1.5\"/>"));
QSet<QString> found;
auto it = re.globalMatch(svg);
while (it.hasNext()) {
const auto m = it.next();
found << m.captured(1) + QLatin1Char(',') + m.captured(2);
}
return found;
}
private slots:
void initTestCase()
{
QVERIFY(m_dir.isValid());
QVERIFY(QFile::exists(QStringLiteral(QET_TEST_BINARY_PATH)));
}
void dotAtEveryT()
{
const QSet<QString> expected{QStringLiteral("200,260"),
QStringLiteral("300,260")};
QCOMPARE(dots(), expected);
}
};
QTEST_GUILESS_MAIN(tst_junctiondots)
#include "tst_junctiondots.moc"