Skip to content

Commit

Permalink
Merge pull request #115 from mvnmgrx/tests_pr114
Browse files Browse the repository at this point in the history
Tests currently failing as lib ID of top/subsymbols is not working correctly
  • Loading branch information
mvnmgrx authored May 2, 2024
2 parents 5f400f8 + 1ee9c08 commit 09113b6
Show file tree
Hide file tree
Showing 4 changed files with 503 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ def test_zoneOnOuterLayersOnly(self):
board = Board().from_file(self.testData.pathToTestFile)
self.assertTrue(to_file_and_compare(board, self.testData))

def test_zoneOnAllLayersWildcard(self):
"""Tests the parsing of a zone that is present on all copper layers in this form: "*.Cu"
Regression test for bug in PR #114."""
self.testData.compareToTestFile = True
self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_zoneOnAllLayersWildcard')
board = Board().from_file(self.testData.pathToTestFile)
self.assertTrue(to_file_and_compare(board, self.testData))

class Tests_Board_Since_V7(unittest.TestCase):
"""Test cases for Boards since KiCad 7"""

Expand Down
31 changes: 31 additions & 0 deletions tests/test_schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,34 @@ def test_sheetProperties(self):
self.testData.pathToTestFile = path.join(SCHEMATIC_BASE, 'since_v7', 'test_sheetProperties')
schematic = Schematic().from_file(self.testData.pathToTestFile)
self.assertTrue(to_file_and_compare(schematic, self.testData))

def test_specialLibIdWithMultipleUnderscoresAndNumbers(self):
"""Tests special library IDs with multiple underscores and numbers. Came up in PR #112"""
self.testData.compareToTestFile = True
self.testData.pathToTestFile = path.join(SCHEMATIC_BASE, 'since_v7', 'test_specialLibIdWithMultipleUnderscoresAndNumbers')
schematic = Schematic().from_file(self.testData.pathToTestFile)
self.assertTrue(schematic.libSymbols[0].entryName == "Filter_EMI_LLL_162534")
self.assertTrue(schematic.libSymbols[0].libraryNickname == "Device")
self.assertTrue(schematic.libSymbols[0].libId == "Device:Filter_EMI_LLL_162534")
self.assertTrue(schematic.libSymbols[0].units[0].entryName == "Filter_EMI_LLL_162534")
self.assertTrue(schematic.libSymbols[0].units[0].unitId == 0)
self.assertTrue(schematic.libSymbols[0].units[0].styleId == 1)
self.assertTrue(schematic.libSymbols[0].units[0].libId == "Filter_EMI_LLL_162534_0_1")
self.assertTrue(schematic.libSymbols[0].units[1].entryName == "Filter_EMI_LLL_162534")
self.assertTrue(schematic.libSymbols[0].units[1].unitId == 1)
self.assertTrue(schematic.libSymbols[0].units[1].styleId == 1)
self.assertTrue(schematic.libSymbols[0].units[1].libId == "Filter_EMI_LLL_162534_1_1")

self.assertTrue(schematic.libSymbols[1].entryName == "Filter_EMI_LLL_162534_1")
self.assertTrue(schematic.libSymbols[1].libraryNickname is None)
self.assertTrue(schematic.libSymbols[1].libId == "Filter_EMI_LLL_162534_1")
self.assertTrue(schematic.libSymbols[1].units[0].entryName == "Filter_EMI_LLL_162534_1")
self.assertTrue(schematic.libSymbols[1].units[0].unitId == 0)
self.assertTrue(schematic.libSymbols[1].units[0].styleId == 1)
self.assertTrue(schematic.libSymbols[1].units[0].libId == "Filter_EMI_LLL_162534_1_0_1")
self.assertTrue(schematic.libSymbols[1].units[1].entryName == "Filter_EMI_LLL_162534_1")
self.assertTrue(schematic.libSymbols[1].units[1].unitId == 1)
self.assertTrue(schematic.libSymbols[1].units[1].styleId == 1)
self.assertTrue(schematic.libSymbols[1].units[1].libId == "Filter_EMI_LLL_162534_1_1_1")

self.assertTrue(to_file_and_compare(schematic, self.testData))
24 changes: 24 additions & 0 deletions tests/testdata/board/test_zoneOnAllLayersWildcard
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(kicad_pcb (version 20221018) (generator pcbnew)

(general
(thickness 1.6)
)

(paper "A4")
(layers
(0 "F.Cu" signal)
(31 "B.Cu" signal)
)

(setup
(pad_to_mask_clearance 0)
)

(net 0 "")

(zone (net 0) (net_name "") (layers "*.Cu") (tstamp 3562b45e-4bdd-495d-8608-16ebe61c5885) (hatch edge 0.5)
(connect_pads (clearance 0.5))
(min_thickness 0.25) (filled_areas_thickness no)
(fill yes (thermal_gap 0.5) (thermal_bridge_width 0.5) (island_removal_mode 1) (island_area_min 10))
)
)
Loading

0 comments on commit 09113b6

Please sign in to comment.