testLoadSave.py 832 Bytes
Newer Older
1 2 3 4 5 6
from pcbnew import *
import unittest

class TestLoadSave(unittest.TestCase):

    def setUp(self):
7 8 9 10
        self.TITLE="Test Board"
        self.COMMENT1="For load/save test"
        self.FILENAME="/tmp/test.brd"
        
11
    def test_00_save(self):
12 13 14 15 16
        pcb = BOARD()
        pcb.GetTitleBlock().SetTitle(self.TITLE)
        pcb.GetTitleBlock().SetComment1(self.COMMENT1)
        result = SaveBoard(self.FILENAME,pcb)
        self.assertTrue(result)
17 18 19 20 21 22
        
    def test_01_load(self):
        pcb2 = LoadBoard(self.FILENAME)
        self.assertIsNotNone(pcb2)

    def test_02_titleblock_ok(self):
23 24 25 26
        pcb2 = LoadBoard(self.FILENAME)
        tb = pcb2.GetTitleBlock()
        self.assertEqual(tb.GetTitle(),self.TITLE)
        self.assertEqual(tb.GetComment1(),self.COMMENT1)
27 28 29

if __name__ == '__main__':
    unittest.main()