parent
c40483d18a
commit
e784743284
|
@ -134,10 +134,10 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* );
|
||||||
return Cast_to_CENTER_DIMENSION(self)
|
return Cast_to_CENTER_DIMENSION(self)
|
||||||
elif ct=="ORTHOGONAL_DIMENSION":
|
elif ct=="ORTHOGONAL_DIMENSION":
|
||||||
return Cast_to_ORTHOGONAL_DIMENSION(self)
|
return Cast_to_ORTHOGONAL_DIMENSION(self)
|
||||||
elif ct=="DRAWSEGMENT":
|
elif ct=="PCB_SHAPE":
|
||||||
return Cast_to_PCB_SHAPE(self)
|
return Cast_to_PCB_SHAPE(self)
|
||||||
elif ct=="MGRAPHIC":
|
elif ct=="MGRAPHIC":
|
||||||
return Cast_to_FP_GRAPHIC(self)
|
return Cast_to_FP_SHAPE(self)
|
||||||
elif ct=="MODULE":
|
elif ct=="MODULE":
|
||||||
return Cast_to_MODULE(self)
|
return Cast_to_MODULE(self)
|
||||||
elif ct=="PCB_GROUP":
|
elif ct=="PCB_GROUP":
|
||||||
|
|
|
@ -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())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue