From 82f3df408675877989e908b499634f27ed4b3a17 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 13 Jun 2021 11:19:19 -0400 Subject: [PATCH] Attempt to fix Python qa code after renames --- pcbnew/python/swig/board_item.i | 6 +++--- qa/testcases/test_002_board_class.py | 6 +++--- qa/testcases/test_004_tracks.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pcbnew/python/swig/board_item.i b/pcbnew/python/swig/board_item.i index d9c5b8bed0..1dcd94bfb8 100644 --- a/pcbnew/python/swig/board_item.i +++ b/pcbnew/python/swig/board_item.i @@ -166,11 +166,11 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); return Cast_to_PAD(self) elif ct=="MTEXT": return Cast_to_FP_TEXT(self) - elif ct=="VIA": + elif ct=="PCB_VIA": return Cast_to_PCB_VIA(self) - elif ct=="TRACK": + elif ct=="PCB_TRACK": return Cast_to_PCB_TRACK(self) - elif ct=="ARC": + elif ct=="PCB_ARC": return Cast_to_PCB_ARC(self) elif ct=="PCB_TARGET": return Cast_to_PCB_TARGET(self) diff --git a/qa/testcases/test_002_board_class.py b/qa/testcases/test_002_board_class.py index ebf8f31ea7..f5ff600538 100644 --- a/qa/testcases/test_002_board_class.py +++ b/qa/testcases/test_002_board_class.py @@ -31,17 +31,17 @@ class TestBoardClass(unittest.TestCase): self.assertEqual(pcb.Tracks().size(),0) - track0 = TRACK(pcb) + track0 = PCB_TRACK(pcb) pcb.Add(track0) self.assertEqual(pcb.Tracks().size(),1) - track1 = TRACK(pcb) + track1 = PCB_TRACK(pcb) pcb.Add(track1) self.assertEqual(pcb.Tracks().size(),2) def test_pcb_bounding_box(self): pcb = BOARD() - track = TRACK(pcb) + track = PCB_TRACK(pcb) pcb.Add(track) track.SetStart(wxPointMM(10.0, 10.0)) diff --git a/qa/testcases/test_004_tracks.py b/qa/testcases/test_004_tracks.py index 6e7a2b0f56..d4ae3c5ffb 100644 --- a/qa/testcases/test_004_tracks.py +++ b/qa/testcases/test_004_tracks.py @@ -7,7 +7,7 @@ class TestTracks(unittest.TestCase): self.pcb = pcbnew.LoadBoard("data/tracks_arcs_vias.kicad_pcb") def test_tracks(self): - tracks = [t for t in self.pcb.Tracks() if t.GetClass() == 'TRACK'] + tracks = [t for t in self.pcb.Tracks() if t.GetClass() == 'PCB_TRACK'] self.assertEqual(16, len(tracks)) track = sorted(tracks, key=lambda t: [t.GetStart()[0], t.GetStart()[1]])[0] self.assertEqual([27000000, 27585787], [track.GetStart()[0], track.GetStart()[1]]) @@ -16,7 +16,7 @@ class TestTracks(unittest.TestCase): self.assertEqual('McNetty', track.GetNetname()) def test_arcs(self): - arcs = [t for t in self.pcb.Tracks() if t.GetClass() == 'ARC'] + arcs = [t.Cast() for t in self.pcb.Tracks() if t.GetClass() == 'PCB_ARC'] self.assertEqual(13, len(arcs)) arc = sorted(arcs, key=lambda t: [t.GetStart()[0], t.GetStart()[1]])[0] self.assertEqual([29414211, 26499999], [arc.GetCenter()[0], arc.GetCenter()[1]]) @@ -24,7 +24,7 @@ class TestTracks(unittest.TestCase): self.assertEqual(2414211, round(arc.GetRadius())) def test_vias(self): - vias = [t for t in self.pcb.Tracks() if t.GetClass() == 'VIA'] + vias = [t.Cast() for t in self.pcb.Tracks() if t.GetClass() == 'PCB_VIA'] self.assertEqual(2, len(vias)) via = sorted(vias, key=lambda t: [t.GetStart()[0], t.GetStart()[1]])[0] self.assertEqual([29000000, 41000000], [via.GetStart()[0], via.GetStart()[1]])