Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
bbcd2c61
Commit
bbcd2c61
authored
Feb 08, 2014
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BOARD saving test
parent
9263a4e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
29 deletions
+22
-29
testLoadSave.py
pcbnew/scripting/tests/testLoadSave.py
+0
-29
test_002_board_class.py
qa/testcases/test_002_board_class.py
+22
-0
No files found.
pcbnew/scripting/tests/testLoadSave.py
deleted
100644 → 0
View file @
9263a4e7
from
pcbnew
import
*
import
unittest
class
TestLoadSave
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
TITLE
=
"Test Board"
self
.
COMMENT1
=
"For load/save test"
self
.
FILENAME
=
"/tmp/test.brd"
def
test_00_save
(
self
):
pcb
=
BOARD
()
pcb
.
GetTitleBlock
()
.
SetTitle
(
self
.
TITLE
)
pcb
.
GetTitleBlock
()
.
SetComment1
(
self
.
COMMENT1
)
result
=
SaveBoard
(
self
.
FILENAME
,
pcb
)
self
.
assertTrue
(
result
)
def
test_01_load
(
self
):
pcb2
=
LoadBoard
(
self
.
FILENAME
)
self
.
assertIsNotNone
(
pcb2
)
def
test_02_titleblock_ok
(
self
):
pcb2
=
LoadBoard
(
self
.
FILENAME
)
tb
=
pcb2
.
GetTitleBlock
()
self
.
assertEqual
(
tb
.
GetTitle
(),
self
.
TITLE
)
self
.
assertEqual
(
tb
.
GetComment1
(),
self
.
COMMENT1
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
qa/testcases/test_002_board_class.py
View file @
bbcd2c61
import
code
import
code
import
unittest
import
unittest
import
os
import
pcbnew
import
pcbnew
import
pdb
import
pdb
import
tempfile
from
pcbnew
import
*
from
pcbnew
import
*
...
@@ -9,6 +12,9 @@ class TestBoardClass(unittest.TestCase):
...
@@ -9,6 +12,9 @@ class TestBoardClass(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
pcb
=
LoadBoard
(
"data/complex_hierarchy.kicad_pcb"
)
self
.
pcb
=
LoadBoard
(
"data/complex_hierarchy.kicad_pcb"
)
self
.
TITLE
=
"Test Board"
self
.
COMMENT1
=
"For load/save test"
self
.
FILENAME
=
tempfile
.
mktemp
()
+
".kicad_pcb"
def
test_pcb_find_module
(
self
):
def
test_pcb_find_module
(
self
):
module
=
self
.
pcb
.
FindModule
(
'P1'
)
module
=
self
.
pcb
.
FindModule
(
'P1'
)
...
@@ -74,6 +80,22 @@ class TestBoardClass(unittest.TestCase):
...
@@ -74,6 +80,22 @@ class TestBoardClass(unittest.TestCase):
self
.
assertEqual
(
pad
.
this
,
p2
.
this
)
self
.
assertEqual
(
pad
.
this
,
p2
.
this
)
self
.
assertEqual
(
pad
.
this
,
p3
.
this
)
self
.
assertEqual
(
pad
.
this
,
p3
.
this
)
def
test_pcb_save_and_load
(
self
):
pcb
=
BOARD
()
pcb
.
GetTitleBlock
()
.
SetTitle
(
self
.
TITLE
)
pcb
.
GetTitleBlock
()
.
SetComment1
(
self
.
COMMENT1
)
result
=
SaveBoard
(
self
.
FILENAME
,
pcb
)
self
.
assertTrue
(
result
)
pcb2
=
LoadBoard
(
self
.
FILENAME
)
self
.
assertIsNotNone
(
pcb2
)
tb
=
pcb2
.
GetTitleBlock
()
self
.
assertEqual
(
tb
.
GetTitle
(),
self
.
TITLE
)
self
.
assertEqual
(
tb
.
GetComment1
(),
self
.
COMMENT1
)
os
.
remove
(
self
.
FILENAME
)
#def test_interactive(self):
#def test_interactive(self):
# code.interact(local=locals())
# code.interact(local=locals())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment