|
KiCad PCB EDA Suite
|
Test suite for import of DipTrace schematic (.dch) files. More...
#include "test_diptrace_sch_import_fixture.h"Go to the source code of this file.
Functions | |
| BOOST_AUTO_TEST_CASE (CanReadSchematic) | |
| Test that CanReadSchematicFile correctly identifies DipTrace .dch files by their magic header bytes. | |
| BOOST_AUTO_TEST_CASE (V37Utf16SchematicLoadsWithContent) | |
| power_supply.dch is a v37 schematic that stores UTF-16-BE strings, which the legacy version threshold would mis-read as ASCII. | |
| BOOST_AUTO_TEST_CASE (InvalidComponentCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (ComponentRecordsAreParsedSequentially) | |
| BOOST_AUTO_TEST_CASE (NoSymbolLibraryFileIsGenerated) | |
| The importer must rely solely on the symbol definitions embedded in the schematic. | |
| BOOST_AUTO_TEST_CASE (ImportedRootIsTheSchematicTopLevelSheet) | |
| The imported content root must become the schematic's real top-level sheet. | |
| BOOST_AUTO_TEST_CASE (ViewerExampleComponentRecordsAreParsedSequentiallyOptional) | |
| BOOST_AUTO_TEST_CASE (ComponentCountMismatchFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidComponentPinCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidComponentExtraTailLengthFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidComponentPinRecordFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidLaterComponentPinRecordFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidComponentShapePointCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (ZeroComponentShapePointCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidBusEntryTerminatorFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidBusSectionCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidWireNetPinCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidWireNetNameLengthFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (InvalidWirePointCountFailsDeterministically) | |
| BOOST_AUTO_TEST_CASE (ImportChainIsClean) | |
| Importing a well-formed DipTrace schematic must run the full import chain without emitting any warnings or errors. | |
| BOOST_AUTO_TEST_CASE (CanReadLegacyHeaderOptional) | |
| BOOST_AUTO_TEST_CASE (ViewerExamplesLoadOptional) | |
| BOOST_AUTO_TEST_CASE (ExternalCorpusLoadOptional) | |
| BOOST_AUTO_TEST_CASE (ViewerExamplesDchXmlParityOptional) | |
| BOOST_AUTO_TEST_CASE (ViewerExamplesPinCountsOptional) | |
| BOOST_AUTO_TEST_CASE (ViewerExamplesFootprintFieldOptional) | |
| BOOST_AUTO_TEST_CASE (ImportedNetConnectivityIsConsistent) | |
| Items electrically joined in DipTrace (by a shared net label or a direct wire) must land on the same KiCad net after import. | |
| BOOST_AUTO_TEST_CASE (AllSymbolsWithinPageBounds) | |
| The corrected coordinate scaling must place every imported symbol within a sane area around the origin. | |
| BOOST_AUTO_TEST_CASE (SymbolGraphicWidthMatchesPinWidth) | |
| A symbol's graphic line width must read at the same scale as its pins so the body and pins look like one drawing. | |
| BOOST_AUTO_TEST_CASE (ShapeKindDiscriminatorProducesRectanglesAndLines) | |
| The shape type comes from the stored kind pair in each shape record, not from geometry. | |
| BOOST_AUTO_TEST_CASE (PinsCarryNonDefaultOrientations) | |
| Pins must carry the orientation recovered from their geometry rather than all defaulting to one side. | |
| BOOST_AUTO_TEST_CASE (PageSizeIsAppliedWhenStored) | |
| A DipTrace file that stores its page geometry must drive the KiCad page size. | |
Test suite for import of DipTrace schematic (.dch) files.
Definition in file test_diptrace_sch_import.cpp.
| BOOST_AUTO_TEST_CASE | ( | AllSymbolsWithinPageBounds | ) |
The corrected coordinate scaling must place every imported symbol within a sane area around the origin.
DipTrace .dch files store no explicit page size, so the KiCad default sheet size is used as the reference. The previous 100x-too-large scaling pushed symbols far past these bounds, so this test fails on the scaling regression and passes once positions divide by 3.
Definition at line 951 of file test_diptrace_sch_import.cpp.
References std::abs(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), BOX2< Vec >::GetBottom(), SCH_SYMBOL::GetBoundingBox(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), SCH_SCREEN::Items(), EE_RTREE::OfType(), path, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | CanReadLegacyHeaderOptional | ) |
Definition at line 616 of file test_diptrace_sch_import.cpp.
References BOOST_TEST_MESSAGE().
| BOOST_AUTO_TEST_CASE | ( | CanReadSchematic | ) |
Test that CanReadSchematicFile correctly identifies DipTrace .dch files by their magic header bytes.
Definition at line 39 of file test_diptrace_sch_import.cpp.
References BOOST_AUTO_TEST_CASE().
| BOOST_AUTO_TEST_CASE | ( | ComponentCountMismatchFailsDeterministically | ) |
Definition at line 265 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | ComponentRecordsAreParsedSequentially | ) |
Definition at line 92 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), DIPTRACE::SCH_PARSER::ComponentBoundaryScanCount(), FILEEXT::KiCadSchematicFileExtension, EDA_ITEM::m_Uuid, niluuid, DIPTRACE::SCH_PARSER::Parse(), path, SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), and SCH_SHEET::SetScreen().
| BOOST_AUTO_TEST_CASE | ( | ExternalCorpusLoadOptional | ) |
Definition at line 696 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), SCH_SHEET::GetScreen(), path, RPT_SEVERITY_ERROR, and RPT_SEVERITY_WARNING.
| BOOST_AUTO_TEST_CASE | ( | ImportChainIsClean | ) |
Importing a well-formed DipTrace schematic must run the full import chain without emitting any warnings or errors.
Component records are split by their header signature and parsed within fixed bounds, so a recognised file should never fall back, mis-parse a record, or fail to save its generated library. This guards against regressions in the component boundary detector.
z80_board.dch (v38) and power_supply.dch (v37) exercise the schematic UTF-16 string path; pppp.dch (v31) exercises the legacy ASCII string path.
Definition at line 593 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), path, RPT_SEVERITY_ERROR, and RPT_SEVERITY_WARNING.
| BOOST_AUTO_TEST_CASE | ( | ImportedNetConnectivityIsConsistent | ) |
Items electrically joined in DipTrace (by a shared net label or a direct wire) must land on the same KiCad net after import.
Recalculate the connection graph headlessly and assert that every subgraph is internally consistent and that at least one net actually ties two or more symbol pins together, proving the importer rebuilt real connectivity rather than isolated pins.
Definition at line 900 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), SCH_CONNECTION::NetCode(), path, pin, and SCH_PIN_T.
| BOOST_AUTO_TEST_CASE | ( | ImportedRootIsTheSchematicTopLevelSheet | ) |
The imported content root must become the schematic's real top-level sheet.
A nil-UUID root is treated as the virtual root and dropped by SetTopLevelSheets(), orphaning the import so the schematic editor shows nothing even though parsing succeeded.
Definition at line 186 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), SCH_SHEET::GetScreen(), EDA_ITEM::m_Uuid, niluuid, and path.
| BOOST_AUTO_TEST_CASE | ( | InvalidBusEntryTerminatorFailsDeterministically | ) |
Definition at line 451 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidBusSectionCountFailsDeterministically | ) |
Definition at line 478 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentCountFailsDeterministically | ) |
Definition at line 66 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentExtraTailLengthFailsDeterministically | ) |
Definition at line 317 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentPinCountFailsDeterministically | ) |
Definition at line 291 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentPinRecordFailsDeterministically | ) |
Definition at line 344 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidComponentShapePointCountFailsDeterministically | ) |
Definition at line 398 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidLaterComponentPinRecordFailsDeterministically | ) |
Definition at line 371 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidWireNetNameLengthFailsDeterministically | ) |
Definition at line 530 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidWireNetPinCountFailsDeterministically | ) |
Definition at line 504 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | InvalidWirePointCountFailsDeterministically | ) |
Definition at line 557 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().
| BOOST_AUTO_TEST_CASE | ( | NoSymbolLibraryFileIsGenerated | ) |
The importer must rely solely on the symbol definitions embedded in the schematic.
It must not write a standalone .kicad_sym library beside the imported file.
Definition at line 121 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), SCH_SHEET::GetScreen(), SCH_SCREEN::Items(), path, SCH_SHEET_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | PageSizeIsAppliedWhenStored | ) |
A DipTrace file that stores its page geometry must drive the KiCad page size.
power_supply.dch carries an A4 (297 x 210 mm) page record, so the imported root screen must read back that size rather than the default. Files without a page record keep the KiCad default, which is covered by the other import tests that load z80_board.dch unchanged.
Definition at line 1177 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE(), PAGE_INFO::GetHeightMM(), SCH_SCREEN::GetPageSettings(), SCH_SHEET::GetScreen(), PAGE_INFO::GetWidthMM(), and path.
| BOOST_AUTO_TEST_CASE | ( | PinsCarryNonDefaultOrientations | ) |
Pins must carry the orientation recovered from their geometry rather than all defaulting to one side.
A symbol whose pins ring its body has pins facing several directions, so the imported pin set must use more than a single orientation.
Definition at line 1127 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SCREEN::Items(), EE_RTREE::OfType(), path, SCH_PIN_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | ShapeKindDiscriminatorProducesRectanglesAndLines | ) |
The shape type comes from the stored kind pair in each shape record, not from geometry.
A shape tagged (700, 6) is a rectangle whose two points are opposite corners; everything else stays a polyline, so a two point diagonal line keeps its true line type. Both kinds occur in z80_board, which exercises the discriminator.
Definition at line 1062 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), SHAPE_LINE_CHAIN::CPoints(), SCH_SYMBOL::GetLibSymbolRef(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetShape(), SCH_SCREEN::Items(), EE_RTREE::OfType(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), path, POLY, RECTANGLE, SCH_SHAPE_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | SymbolGraphicWidthMatchesPinWidth | ) |
A symbol's graphic line width must read at the same scale as its pins so the body and pins look like one drawing.
KiCad renders a pin (and a shape with stored width 0) at the default symbol line width, and DipTrace stores real per-shape widths that can be a few times thicker. The previous 100x scaling instead produced page-scale strokes two orders of magnitude past the pins; this test rejects that while still accepting genuine heavy DipTrace strokes.
Definition at line 1005 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_REQUIRE(), DEFAULT_LINE_WIDTH_MILS, SCH_SYMBOL::GetLibSymbolRef(), EDA_SHAPE::GetWidth(), SCH_SCREEN::Items(), EE_RTREE::OfType(), path, SCH_SHAPE_T, SCH_SYMBOL_T, and schIUScale.
| BOOST_AUTO_TEST_CASE | ( | V37Utf16SchematicLoadsWithContent | ) |
power_supply.dch is a v37 schematic that stores UTF-16-BE strings, which the legacy version threshold would mis-read as ASCII.
The encoding auto-detection must let it load with real content rather than throwing "Unreasonable v37 string length" at the header.
Definition at line 52 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE(), path, SCH_LINE_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | ViewerExampleComponentRecordsAreParsedSequentiallyOptional | ) |
Definition at line 217 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_MESSAGE(), BOOST_TEST_MESSAGE(), DIPTRACE::SCH_PARSER::ComponentBoundaryScanCount(), FILEEXT::KiCadSchematicFileExtension, EDA_ITEM::m_Uuid, niluuid, DIPTRACE::SCH_PARSER::Parse(), path, SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), and SCH_SHEET::SetScreen().
| BOOST_AUTO_TEST_CASE | ( | ViewerExamplesDchXmlParityOptional | ) |
Definition at line 759 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), expected, SCH_SHEET::GetScreen(), SCH_GLOBAL_LABEL_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | ViewerExamplesFootprintFieldOptional | ) |
Definition at line 868 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and SCH_SHEET::GetScreen().
| BOOST_AUTO_TEST_CASE | ( | ViewerExamplesLoadOptional | ) |
Definition at line 633 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), expected, SCH_SHEET::GetScreen(), path, SCH_GLOBAL_LABEL_T, and SCH_SYMBOL_T.
| BOOST_AUTO_TEST_CASE | ( | ViewerExamplesPinCountsOptional | ) |
Definition at line 838 of file test_diptrace_sch_import.cpp.
References BOOST_CHECK_EQUAL(), BOOST_REQUIRE(), BOOST_TEST_MESSAGE(), and SCH_SHEET::GetScreen().
| BOOST_AUTO_TEST_CASE | ( | ZeroComponentShapePointCountFailsDeterministically | ) |
Definition at line 425 of file test_diptrace_sch_import.cpp.
References BOOST_REQUIRE().