Browse Source
ADDED: ERC Test for labels on multiple wires
ADDED: ERC Test for labels on multiple wires
When a label overlaps two or more wires, it is not clear which one it should connect to. This is an ERC warning Fixes https://gitlab.com/kicad/code/kicad/-/issues/18346jobs
9 changed files with 531 additions and 1 deletions
-
63eeschema/erc/erc.cpp
-
5eeschema/erc/erc.h
-
5eeschema/erc/erc_item.cpp
-
1eeschema/erc/erc_item.h
-
1eeschema/erc/erc_settings.cpp
-
3eeschema/erc/erc_settings.h
-
378qa/data/eeschema/issue18346.kicad_sch
-
1qa/tests/eeschema/CMakeLists.txt
-
75qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp
@ -0,0 +1,378 @@ |
|||
(kicad_sch |
|||
(version 20240602) |
|||
(generator "eeschema") |
|||
(generator_version "8.99") |
|||
(uuid "69309afb-88b0-4112-b019-2bea5a178880") |
|||
(paper "A4") |
|||
(lib_symbols |
|||
(symbol "Connector:Conn_01x02_Pin" |
|||
(pin_names |
|||
(offset 1.016) hide) |
|||
(exclude_from_sim no) |
|||
(in_bom yes) |
|||
(on_board yes) |
|||
(property "Reference" "J" |
|||
(at 0 2.54 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Value" "Conn_01x02_Pin" |
|||
(at 0 -5.08 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Footprint" "" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Datasheet" "~" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Description" "Generic connector, single row, 01x02, script generated" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "ki_locked" "" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "ki_keywords" "connector" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "ki_fp_filters" "Connector*:*_1x??_*" |
|||
(at 0 0 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(symbol "Conn_01x02_Pin_1_1" |
|||
(rectangle |
|||
(start 0.8636 0.127) |
|||
(end 0 -0.127) |
|||
(stroke |
|||
(width 0.1524) |
|||
(type default) |
|||
) |
|||
(fill |
|||
(type outline) |
|||
) |
|||
) |
|||
(rectangle |
|||
(start 0.8636 -2.413) |
|||
(end 0 -2.667) |
|||
(stroke |
|||
(width 0.1524) |
|||
(type default) |
|||
) |
|||
(fill |
|||
(type outline) |
|||
) |
|||
) |
|||
(polyline |
|||
(pts |
|||
(xy 1.27 0) (xy 0.8636 0) |
|||
) |
|||
(stroke |
|||
(width 0.1524) |
|||
(type default) |
|||
) |
|||
(fill |
|||
(type none) |
|||
) |
|||
) |
|||
(polyline |
|||
(pts |
|||
(xy 1.27 -2.54) (xy 0.8636 -2.54) |
|||
) |
|||
(stroke |
|||
(width 0.1524) |
|||
(type default) |
|||
) |
|||
(fill |
|||
(type none) |
|||
) |
|||
) |
|||
(pin passive line |
|||
(at 5.08 0 180) |
|||
(length 3.81) |
|||
(name "Pin_1" |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(number "1" |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
(pin passive line |
|||
(at 5.08 -2.54 180) |
|||
(length 3.81) |
|||
(name "Pin_2" |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(number "2" |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
(junction |
|||
(at 106.68 74.93) |
|||
(diameter 0) |
|||
(color 0 0 0 0) |
|||
(uuid "4a56ee91-5004-412e-8909-01a9249bf883") |
|||
) |
|||
(wire |
|||
(pts |
|||
(xy 106.68 74.93) (xy 106.68 80.01) |
|||
) |
|||
(stroke |
|||
(width 0) |
|||
(type default) |
|||
) |
|||
(uuid "27bb77c8-bed9-4ec5-96d4-d73c5433079e") |
|||
) |
|||
(wire |
|||
(pts |
|||
(xy 102.87 77.47) (xy 123.19 77.47) |
|||
) |
|||
(stroke |
|||
(width 0) |
|||
(type default) |
|||
) |
|||
(uuid "75df03fc-db9c-4892-b2ff-4fdd989da01f") |
|||
) |
|||
(wire |
|||
(pts |
|||
(xy 106.68 74.93) (xy 123.19 74.93) |
|||
) |
|||
(stroke |
|||
(width 0) |
|||
(type default) |
|||
) |
|||
(uuid "e9df6ac6-8fc0-41b0-8640-c74e8cea4699") |
|||
) |
|||
(wire |
|||
(pts |
|||
(xy 102.87 74.93) (xy 106.68 74.93) |
|||
) |
|||
(stroke |
|||
(width 0) |
|||
(type default) |
|||
) |
|||
(uuid "f2962ffc-7611-4acf-99f0-0fa9b77a86b5") |
|||
) |
|||
(label "BAR" |
|||
(at 106.68 74.93 0) |
|||
(fields_autoplaced yes) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(justify left bottom) |
|||
) |
|||
(uuid "1aa0e7d2-e570-49d9-9c60-6310e755abcd") |
|||
) |
|||
(label "FOO" |
|||
(at 106.68 77.47 0) |
|||
(fields_autoplaced yes) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(justify left bottom) |
|||
) |
|||
(uuid "aca19205-a0bf-4ee3-bb76-dee6f12714b1") |
|||
) |
|||
(symbol |
|||
(lib_id "Connector:Conn_01x02_Pin") |
|||
(at 97.79 74.93 0) |
|||
(unit 1) |
|||
(exclude_from_sim no) |
|||
(in_bom yes) |
|||
(on_board yes) |
|||
(dnp no) |
|||
(fields_autoplaced yes) |
|||
(uuid "cc0918f1-8eae-4343-b7bb-78b5b2dc2bb2") |
|||
(property "Reference" "J1" |
|||
(at 98.425 69.85 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Value" "Conn_01x02_Pin" |
|||
(at 98.425 72.39 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Footprint" "" |
|||
(at 97.79 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Datasheet" "~" |
|||
(at 97.79 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Description" "Generic connector, single row, 01x02, script generated" |
|||
(at 97.79 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(pin "2" |
|||
(uuid "e55f0ad4-f58f-40b5-b01c-f61e46a18cb6") |
|||
) |
|||
(pin "1" |
|||
(uuid "0e477fe2-6c2b-4e1c-99a5-2ebc30352064") |
|||
) |
|||
(instances |
|||
(project "" |
|||
(path "/69309afb-88b0-4112-b019-2bea5a178880" |
|||
(reference "J1") |
|||
(unit 1) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
(symbol |
|||
(lib_id "Connector:Conn_01x02_Pin") |
|||
(at 128.27 74.93 0) |
|||
(mirror y) |
|||
(unit 1) |
|||
(exclude_from_sim no) |
|||
(in_bom yes) |
|||
(on_board yes) |
|||
(dnp no) |
|||
(uuid "d1063ea8-90b1-4317-b030-2ae7c71614c3") |
|||
(property "Reference" "J2" |
|||
(at 127.635 69.85 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Value" "Conn_01x02_Pin" |
|||
(at 127.635 72.39 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
) |
|||
) |
|||
(property "Footprint" "" |
|||
(at 128.27 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Datasheet" "~" |
|||
(at 128.27 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(property "Description" "Generic connector, single row, 01x02, script generated" |
|||
(at 128.27 74.93 0) |
|||
(effects |
|||
(font |
|||
(size 1.27 1.27) |
|||
) |
|||
(hide yes) |
|||
) |
|||
) |
|||
(pin "2" |
|||
(uuid "bebb5ef7-c8af-4a7b-bf8b-b797c6dad1eb") |
|||
) |
|||
(pin "1" |
|||
(uuid "8ae5c455-c7eb-4fd1-955a-f784c9e0e9b9") |
|||
) |
|||
(instances |
|||
(project "issue18346" |
|||
(path "/69309afb-88b0-4112-b019-2bea5a178880" |
|||
(reference "J2") |
|||
(unit 1) |
|||
) |
|||
) |
|||
) |
|||
) |
|||
(sheet_instances |
|||
(path "/" |
|||
(page "1") |
|||
) |
|||
) |
|||
) |
|||
@ -0,0 +1,75 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 3 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one at |
|||
* http://www.gnu.org/licenses/
|
|||
*/ |
|||
|
|||
#include <qa_utils/wx_utils/unit_test_utils.h>
|
|||
#include <schematic_utils/schematic_file_util.h>
|
|||
|
|||
#include <connection_graph.h>
|
|||
#include <schematic.h>
|
|||
#include <erc/erc_settings.h>
|
|||
#include <erc/erc.h>
|
|||
#include <erc/erc_report.h>
|
|||
#include <settings/settings_manager.h>
|
|||
#include <locale_io.h>
|
|||
|
|||
struct ERC_REGRESSION_TEST_FIXTURE |
|||
{ |
|||
ERC_REGRESSION_TEST_FIXTURE() : |
|||
m_settingsManager( true /* headless */ ) |
|||
{ } |
|||
|
|||
SETTINGS_MANAGER m_settingsManager; |
|||
std::unique_ptr<SCHEMATIC> m_schematic; |
|||
}; |
|||
|
|||
|
|||
BOOST_FIXTURE_TEST_CASE( ERCLabelMultipleWires, ERC_REGRESSION_TEST_FIXTURE ) |
|||
{ |
|||
LOCALE_IO dummy; |
|||
|
|||
// Check for Errors when labels overlap multiple wires/buses
|
|||
std::vector<std::pair<wxString, int>> tests = |
|||
{ |
|||
{ "issue18346", 1 } |
|||
}; |
|||
|
|||
for( const std::pair<wxString, int>& test : tests ) |
|||
{ |
|||
KI_TEST::LoadSchematic( m_settingsManager, test.first, m_schematic ); |
|||
|
|||
ERC_SETTINGS& settings = m_schematic->ErcSettings(); |
|||
SHEETLIST_ERC_ITEMS_PROVIDER errors( m_schematic.get() ); |
|||
|
|||
settings.m_ERCSeverities[ERCE_LABEL_MULTIPLE_WIRES] = RPT_SEVERITY_ERROR; |
|||
|
|||
ERC_TESTER tester( m_schematic.get() ); |
|||
tester.TestLabelMultipleWires(); |
|||
|
|||
errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); |
|||
|
|||
ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); |
|||
|
|||
BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, |
|||
"Expected " << test.second << " errors in " << test.first.ToStdString() |
|||
<< " but got " << errors.GetCount() << "\n" |
|||
<< reportWriter.GetTextReport() ); |
|||
|
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue