Commit b39408b1 authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

Adding a first BOARD class tester, very basic

parent ec9c949c
import code
import unittest
import pcbnew
import pdb
class TestPCBLoad(unittest.TestCase):
......
import code
import unittest
import pcbnew
import pdb
from pcbnew import ToMM
class TestBoardClass(unittest.TestCase):
def setUp(self):
self.pcb = pcbnew.LoadBoard("data/complex_hierarchy.kicad_pcb")
def test_pcb_find_module(self):
module = self.pcb.FindModule('P1')
self.assertEqual(module.GetReference(),'P1')
def test_pcb_bounding_box(self):
bounding_box = self.pcb.ComputeBoundingBox()
height = ToMM( bounding_box.GetHeight() )
width = ToMM( bounding_box.GetWidth() )
# probably it's a cleaner test to generate a board with
# a couple of things, that we can know the exact size,
# and then compute the bounding box,
self.assertAlmostEqual(height, 89.52, 2)
self.assertAlmostEqual(width, 108.44, 2)
#def test_interactive(self):
# code.interact(local=locals())
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment