summaryrefslogtreecommitdiff
path: root/gerber/tests/test_primitives.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-07-24 22:08:31 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-07-24 22:08:31 +0800
commit965d3ce23b92f8aff1063debd6d3364de15791fe (patch)
tree304ac755578479554ed812da87c782e9f6772582 /gerber/tests/test_primitives.py
parent7cd6acf12670f3773113f67ed2acb35cb21c32a0 (diff)
downloadgerbonara-965d3ce23b92f8aff1063debd6d3364de15791fe.tar.gz
gerbonara-965d3ce23b92f8aff1063debd6d3364de15791fe.tar.bz2
gerbonara-965d3ce23b92f8aff1063debd6d3364de15791fe.zip
Add more tests for rendering to PNG. Start adding tests for rendering to Gerber format. Changed definition of no hole to use None instead of 0 so we can differentiate when writing to Gerber format. Makde polygon use hole diameter instead of hole radius to match other primitives
Diffstat (limited to 'gerber/tests/test_primitives.py')
-rw-r--r--gerber/tests/test_primitives.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/gerber/tests/test_primitives.py b/gerber/tests/test_primitives.py
index bc67891..61cf22d 100644
--- a/gerber/tests/test_primitives.py
+++ b/gerber/tests/test_primitives.py
@@ -256,18 +256,18 @@ def test_circle_conversion():
c.to_metric() #shouldn't do antyhing
assert_equal(c.position, (2.54, 25.4))
assert_equal(c.diameter, 254.)
- assert_equal(c.hole_diameter, 0.)
+ assert_equal(c.hole_diameter, None)
c.to_inch()
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
- assert_equal(c.hole_diameter, 0)
+ assert_equal(c.hole_diameter, None)
#no effect
c.to_inch()
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
- assert_equal(c.hole_diameter, 0)
+ assert_equal(c.hole_diameter, None)
# Circle initially metric, with hole
c = Circle((2.54, 25.4), 254.0, 127.0, units='metric')
@@ -294,18 +294,18 @@ def test_circle_conversion():
c.to_inch()
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
- assert_equal(c.hole_diameter, 0)
+ assert_equal(c.hole_diameter, None)
c.to_metric()
assert_equal(c.position, (2.54, 25.4))
assert_equal(c.diameter, 254.)
- assert_equal(c.hole_diameter, 0)
+ assert_equal(c.hole_diameter, None)
#no effect
c.to_metric()
assert_equal(c.position, (2.54, 25.4))
assert_equal(c.diameter, 254.)
- assert_equal(c.hole_diameter, 0)
+ assert_equal(c.hole_diameter, None)
c = Circle((0.1, 1.0), 10.0, 5.0, units='inch')
#No effect
@@ -820,12 +820,12 @@ def test_polygon_ctor():
test_cases = (((0,0), 3, 5, 0),
((0, 0), 5, 6, 0),
((1,1), 7, 7, 45))
- for pos, sides, radius, hole_radius in test_cases:
- p = Polygon(pos, sides, radius, hole_radius)
+ for pos, sides, radius, hole_diameter in test_cases:
+ p = Polygon(pos, sides, radius, hole_diameter)
assert_equal(p.position, pos)
assert_equal(p.sides, sides)
assert_equal(p.radius, radius)
- assert_equal(p.hole_radius, hole_radius)
+ assert_equal(p.hole_diameter, hole_diameter)
def test_polygon_bounds():
""" Test polygon bounding box calculation