1717
1818BOARD_BASE = path .join (TEST_BASE , 'board' )
1919BOARD_COMMUNITY = path .join (BOARD_BASE , 'community' )
20+ BOARD_DEMO = path .join (BOARD_BASE , 'demos' )
2021
2122class Tests_Board_Community (unittest .TestCase ):
2223 """New Test cases for Boards - based on community KiCad projects"""
@@ -28,20 +29,34 @@ def setUp(self):
2829
2930 def test_boardGlasgow (self ):
3031 """Tests the behavior when creating and exporting Glasgow board"""
31- self .testData .pathToTestFile = Path (BOARD_COMMUNITY ) / 'test_boardGlasgow '
32+ self .testData .pathToTestFile = Path (BOARD_COMMUNITY ) / 'Glasgow '
3233 board = Board ().from_file (self .testData .pathToTestFile )
3334 self .assertTrue (to_file_and_compare (board , self .testData ))
3435
3536 def test_boardSmartPrintCoreH7x (self ):
3637 """Tests the behavior when creating and exporting SmartPrintCoreH7x board"""
37- self .testData .pathToTestFile = Path (BOARD_COMMUNITY ) / 'test_boardSmartPrintCoreH7x '
38+ self .testData .pathToTestFile = Path (BOARD_COMMUNITY ) / 'SmartPrintCoreH7x '
3839 board = Board ().from_file (self .testData .pathToTestFile )
3940 self .assertTrue (to_file_and_compare (board , self .testData ))
4041
4142 # TODO - This test contains "dimensions" which are not supported yet
42- # def test_boardTokayLite(self):
43- # """Tests the behavior when creating and exporting TokayLite board"""
44- # self.testData.pathToTestFile = Path(BOARD_COMMUNITY) / 'test_boardTokayLite'
43+ def test_TokayLite (self ):
44+ """Tests the behavior when creating and exporting TokayLite board"""
45+ self .testData .pathToTestFile = Path (BOARD_COMMUNITY ) / 'TokayLite'
46+ board = Board ().from_file (self .testData .pathToTestFile )
47+ self .assertTrue (to_file_and_compare (board , self .testData ))
48+
49+ class Tests_Board_Demos (unittest .TestCase ):
50+ """Test cases for demo boards"""
51+
52+ def setUp (self ):
53+ prepare_test (self )
54+ self .testData .compareToTestFile = True
55+ return super ().setUp ()
56+
57+ # def test_RoyalBlue54LFeather(self):
58+ # """Tests the behavior when creating and exporting RoyalBlue54L-Feather demo board"""
59+ # self.testData.pathToTestFile = Path(BOARD_DEMO) / 'RoyalBlue54L-Feather'
4560 # board = Board().from_file(self.testData.pathToTestFile)
4661 # self.assertTrue(to_file_and_compare(board, self.testData))
4762
@@ -51,130 +66,3 @@ class Tests_Board(unittest.TestCase):
5166 def setUp (self ) -> None :
5267 prepare_test (self )
5368 return super ().setUp ()
54-
55- # def test_boardTraceArcs(self):
56- # """Tests the parser's handling of traces with arcs"""
57- # self.testData.compareToTestFile = True
58- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_boardTraceArcs')
59- # board = Board().from_file(self.testData.pathToTestFile)
60- # self.assertTrue(to_file_and_compare(board, self.testData))
61- #
62- # def test_boardStackup32LayerDielectricsVias(self):
63- # """Tests the parsing of a board with 32 layers, all different dielectric layers and all
64- # available via combinations"""
65- # self.testData.compareToTestFile = True
66- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_boardStackup32LayerDielectricsVias')
67- # board = Board().from_file(self.testData.pathToTestFile)
68- # self.assertTrue(to_file_and_compare(board, self.testData))
69- #
70- # def test_boardWithAllPrimitives(self):
71- # """Tests the parsing of a board containting all primitives (traces, texts, forms, dimensions,
72- # markers, polygons, etc)"""
73- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_boardWithAllPrimitives')
74- # board = Board().from_file(self.testData.pathToTestFile)
75- # self.assertTrue(to_file_and_compare(board, self.testData))
76- #
77- # def test_allFpManufacturingAttributes(self):
78- # """Tests the parsing of a board with footprints that feature all combinations of
79- # manufacturing attributes. Tests all possible combinations of the following:
80- # <ul>
81- # <li>Board Only: True / False</li>
82- # <li>Exclude from BOM: True / False</li>
83- # <li>excludeFromPosFiles: True / False</li>
84- # <li>Type: SMD, THT, Other</li>
85- # </ul>
86- #
87- # Furthermore tests if the Attributes() object of a footprint is correctly created even
88- # when the parsed footprint has no (attr ...) token in its S-Expression."""
89- # self.testData.compareToTestFile = True
90- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_allFpManufacturingAttributes')
91- # board = Board().from_file(self.testData.pathToTestFile)
92- #
93- # # Test parsing
94- # self.assertTrue(to_file_and_compare(board, self.testData))
95- #
96- # # Test that attributes object is created, even when an empty attribute list is present in
97- # # parsed footprint
98- # attr = Attributes(boardOnly=False, excludeFromBom=False, excludeFromPosFiles=False, type=None)
99- # self.assertEqual(attr, board.footprints[11].attributes,
100- # msg="Parsing of footprint without `attr` field does not yield expected Attributes() object")
101- #
102- def test_createEmptyBoard (self ):
103- """Tests the behavior when creating an empty board"""
104- self .testData .compareToTestFile = True
105- self .testData .pathToTestFile = Path (BOARD_BASE ) / 'test_createEmptyBoard'
106- board = Board ().create_new ()
107- self .assertTrue (to_file_and_compare (board , self .testData ))
108- #
109- # def test_footprintPadNewLines(self):
110- # """Renames the libId token (setting and unsetting) of footprints on a board"""
111- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_renameFootprintIdToken')
112- # board = Board().from_file(self.testData.pathToTestFile)
113- # board.footprints[0].libId = "I_was_renamed:BUS_PCIexpress_x1"
114- # board.footprints[1].libId = "I_was_added:BUS_PCIexpress_x1"
115- # self.assertTrue(to_file_and_compare(board, self.testData))
116- #
117- # def test_pcbPlotParams(self):
118- # """Tests the parsing of board plot params"""
119- # self.testData.compareToTestFile = True
120- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_pcbPlotParams')
121- # board = Board().from_file(self.testData.pathToTestFile)
122- # self.assertTrue(to_file_and_compare(board, self.testData))
123- #
124- # def test_zoneOnOuterLayersOnly(self):
125- # """Tests the parsing of a zone that is only on the outer board layers (F.Cu and B.Cu).
126- # Regression test for bug in PR #89."""
127- # self.testData.compareToTestFile = True
128- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_zoneOnOuterLayersOnly')
129- # board = Board().from_file(self.testData.pathToTestFile)
130- # self.assertTrue(to_file_and_compare(board, self.testData))
131- #
132- # def test_zoneOnAllLayersWildcard(self):
133- # """Tests the parsing of a zone that is present on all copper layers in this form: "*.Cu"
134- # Regression test for bug in PR #114."""
135- # self.testData.compareToTestFile = True
136- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'test_zoneOnAllLayersWildcard')
137- # board = Board().from_file(self.testData.pathToTestFile)
138- # self.assertTrue(to_file_and_compare(board, self.testData))
139- #
140- # class Tests_Board_Since_V7(unittest.TestCase):
141- # """Test cases for Boards since KiCad 7"""
142- #
143- # def setUp(self) -> None:
144- # prepare_test(self)
145- # return super().setUp()
146- #
147- # def test_textBoxAllVariants(self):
148- # """Tests all variants of the ``text_box`` token for text boxes in PCBs"""
149- # self.testData.compareToTestFile = True
150- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'since_v7', 'test_textBoxAllVariants')
151- # board = Board().from_file(self.testData.pathToTestFile)
152- # self.assertTrue(to_file_and_compare(board, self.testData))
153- #
154- # def test_imageWithLayerToken(self):
155- # """Tests the new ``layer`` token for images in PCBs"""
156- # self.testData.compareToTestFile = True
157- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'since_v7', 'test_imageWithLayerToken')
158- # board = Board().from_file(self.testData.pathToTestFile)
159- # self.assertTrue(to_file_and_compare(board, self.testData))
160- #
161- # def test_pcbPlotParams(self):
162- # """Tests the parsing of board plot params since KiCad v7"""
163- # self.testData.compareToTestFile = True
164- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'since_v7', 'test_pcbPlotParams')
165- # board = Board().from_file(self.testData.pathToTestFile)
166- # self.assertTrue(to_file_and_compare(board, self.testData))
167- #
168- # def test_textsWithRenderCaches(self):
169- # """Tests text elements with the ``render_cache`` token"""
170- # self.testData.compareToTestFile = True
171- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'since_v7', 'test_textsWithRenderCaches')
172- # board = Board().from_file(self.testData.pathToTestFile)
173- # self.assertTrue(to_file_and_compare(board, self.testData))
174- #
175- # def test_testKnockout(self):
176- # """Tests the ``knockout`` token of a graphical text"""
177- # self.testData.compareToTestFile = True
178- # self.testData.pathToTestFile = path.join(BOARD_BASE, 'since_v7', 'test_textKnockout')
179- # footprint = Board().from_file(self.testData.pathToTestFile)
180- # self.assertTrue(to_file_and_compare(footprint, self.testData))
0 commit comments