|
@ -40,6 +40,31 @@ class TestPCBLoad(unittest.TestCase): |
|
|
def test_pcb_netcount(self): |
|
|
def test_pcb_netcount(self): |
|
|
self.assertEqual(self.pcb.GetNetCount(),51) |
|
|
self.assertEqual(self.pcb.GetNetCount(),51) |
|
|
|
|
|
|
|
|
|
|
|
def test_pcb_shapes(self): |
|
|
|
|
|
drawings = list(self.pcb.GetDrawings()) |
|
|
|
|
|
edge_cuts = [d for d in drawings if d.GetLayer() == pcbnew.Edge_Cuts] |
|
|
|
|
|
coordinates = [[list(edge.GetStart()), list(edge.GetEnd())] for edge in edge_cuts] |
|
|
|
|
|
expected_coordinates = [ |
|
|
|
|
|
[[88265000, 51816000], [188595000, 51816000]], |
|
|
|
|
|
[[88265000, 131826000], [88265000, 51816000]], |
|
|
|
|
|
[[188595000, 51816000], [188595000, 131826000]], |
|
|
|
|
|
[[188595000, 131826000], [88265000, 131826000]] |
|
|
|
|
|
] |
|
|
|
|
|
self.assertEqual(sorted(coordinates), sorted(expected_coordinates)) |
|
|
|
|
|
|
|
|
|
|
|
def test_pcb_text(self): |
|
|
|
|
|
drawings = list(self.pcb.GetDrawings()) |
|
|
|
|
|
text = [d for d in drawings if d.GetClass() == "PTEXT"] |
|
|
|
|
|
self.verify_text(text[0], 173355000, 68453000, pcbnew.F_Cu, |
|
|
|
|
|
u'Actionneur\nPiezo New Amp\nV02') |
|
|
|
|
|
self.verify_text(text[1], 176149000, 64643000, pcbnew.B_Cu, |
|
|
|
|
|
u'Actionneur\nPiezo New Amp\nV02') |
|
|
|
|
|
|
|
|
|
|
|
def verify_text(self, text, x, y, layer, s): |
|
|
|
|
|
self.assertEquals(list(text.GetPosition()), [x, y]) |
|
|
|
|
|
self.assertEquals(text.GetLayer(), layer) |
|
|
|
|
|
self.assertEquals(text.GetText(), s) |
|
|
|
|
|
|
|
|
#def test_interactive(self): |
|
|
#def test_interactive(self): |
|
|
# code.interact(local=locals()) |
|
|
# code.interact(local=locals()) |
|
|
|
|
|
|
|
|