From 5cf1fa74b42eb8feaab23078bef6f31f6d647c33 Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Sun, 15 Feb 2015 02:20:02 -0500 Subject: Tests and bugfixes --- gerber/tests/test_primitives.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'gerber/tests/test_primitives.py') diff --git a/gerber/tests/test_primitives.py b/gerber/tests/test_primitives.py index 877823d..f8b8620 100644 --- a/gerber/tests/test_primitives.py +++ b/gerber/tests/test_primitives.py @@ -73,20 +73,21 @@ def test_arc_sweep_angle(): ((1, 0), (-1, 0), (0, 0), 'counterclockwise', math.radians(180)),] for start, end, center, direction, sweep in cases: - a = Arc(start, end, center, direction, 0) + c = Circle((0,0), 1) + a = Arc(start, end, center, direction, c) assert_equal(a.sweep_angle, sweep) -# Need to update bounds calculation using aperture -#def test_arc_bounds(): -# """ Test Arc primitive bounding box calculation -# """ -# cases = [((1, 0), (0, 1), (0, 0), 'clockwise', ((-1, 1), (-1, 1))), -# ((1, 0), (0, 1), (0, 0), 'counterclockwise', ((0, 1), (0, 1))), -# #TODO: ADD MORE TEST CASES HERE -# ] -# for start, end, center, direction, bounds in cases: -# a = Arc(start, end, center, direction, 0) -# assert_equal(a.bounding_box, bounds) +def test_arc_bounds(): + """ Test Arc primitive bounding box calculation + """ + cases = [((1, 0), (0, 1), (0, 0), 'clockwise', ((-1.5, 1.5), (-1.5, 1.5))), + ((1, 0), (0, 1), (0, 0), 'counterclockwise', ((-0.5, 1.5), (-0.5, 1.5))), + #TODO: ADD MORE TEST CASES HERE + ] + for start, end, center, direction, bounds in cases: + c = Circle((0,0), 1) + a = Arc(start, end, center, direction, c) + assert_equal(a.bounding_box, bounds) def test_circle_radius(): -- cgit