summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gerbonara/gerber/render/cairo_backend.py10
-rw-r--r--gerbonara/gerber/tests/golden/example_single_quadrant.gbr16
-rw-r--r--gerbonara/gerber/tests/golden/example_single_quadrant.pngbin9658 -> 0 bytes
-rw-r--r--gerbonara/gerber/tests/resources/example_single_quadrant.gbr18
-rw-r--r--gerbonara/gerber/tests/test_cairo_backend.py5
5 files changed, 7 insertions, 42 deletions
diff --git a/gerbonara/gerber/render/cairo_backend.py b/gerbonara/gerber/render/cairo_backend.py
index ff92d99..ff5e6cb 100644
--- a/gerbonara/gerber/render/cairo_backend.py
+++ b/gerbonara/gerber/render/cairo_backend.py
@@ -23,6 +23,7 @@ except ImportError:
from operator import mul
import tempfile
+import warnings
import os
from .render import GerberContext, RenderSettings
@@ -235,7 +236,11 @@ class GerberCairoContext(GerberContext):
two_pi = 2 * math.pi
angle1 = (arc.start_angle + two_pi) % two_pi
angle2 = (arc.end_angle + two_pi) % two_pi
- if angle1 == angle2 and arc.quadrant_mode != 'single-quadrant':
+
+ if arc.quadrant_mode == 'single-quadrant':
+ warnings.warn('Cairo backend does not support single-quadrant arcs.')
+
+ if angle1 == angle2:
# Make the angles slightly different otherwise Cario will draw nothing
angle2 -= 0.000000001
if isinstance(arc.aperture, Circle):
@@ -255,8 +260,7 @@ class GerberCairoContext(GerberContext):
if arc.direction == 'counterclockwise':
mask.ctx.arc(center[0], center[1], radius, angle1, angle2)
else:
- mask.ctx.arc_negative(center[0], center[1], radius,
- angle1, angle2)
+ mask.ctx.arc_negative(center[0], center[1], radius, angle1, angle2)
mask.ctx.move_to(*end) # ...lame
mask.ctx.stroke()
diff --git a/gerbonara/gerber/tests/golden/example_single_quadrant.gbr b/gerbonara/gerber/tests/golden/example_single_quadrant.gbr
deleted file mode 100644
index b0a3166..0000000
--- a/gerbonara/gerber/tests/golden/example_single_quadrant.gbr
+++ /dev/null
@@ -1,16 +0,0 @@
-%FSLAX23Y23*%
-%MOIN*%
-%ADD10C,0.01*%
-G74*
-D10*
-%LPD*%
-G01X1100Y600D02*
-G03X700Y1000I-400J0D01*
-G03X300Y600I0J-400D01*
-G03X700Y200I400J0D01*
-G03X1100Y600I0J400D01*
-G01X300D02*
-X1100D01*
-X700Y200D02*
-Y1000D01*
-M02*
diff --git a/gerbonara/gerber/tests/golden/example_single_quadrant.png b/gerbonara/gerber/tests/golden/example_single_quadrant.png
deleted file mode 100644
index 89b763f..0000000
--- a/gerbonara/gerber/tests/golden/example_single_quadrant.png
+++ /dev/null
Binary files differ
diff --git a/gerbonara/gerber/tests/resources/example_single_quadrant.gbr b/gerbonara/gerber/tests/resources/example_single_quadrant.gbr
deleted file mode 100644
index c398601..0000000
--- a/gerbonara/gerber/tests/resources/example_single_quadrant.gbr
+++ /dev/null
@@ -1,18 +0,0 @@
-G04 Ucamco ex. 4.5.8: Single quadrant*
-%FSLAX23Y23*%
-%MOIN*%
-%ADD10C,0.010*%
-G74*
-D10*
-X1100Y600D02*
-G03*
-X700Y1000I400J0D01*
-X300Y600I0J400D01*
-X700Y200I400J0D01*
-X1100Y600I0J400D01*
-X300D02*
-G01*
-X1100D01*
-X700Y200D02*
-Y1000D01*
-M02* \ No newline at end of file
diff --git a/gerbonara/gerber/tests/test_cairo_backend.py b/gerbonara/gerber/tests/test_cairo_backend.py
index d0386d8..c60e7a9 100644
--- a/gerbonara/gerber/tests/test_cairo_backend.py
+++ b/gerbonara/gerber/tests/test_cairo_backend.py
@@ -43,11 +43,6 @@ def test_render_two_boxes():
_test_render("resources/example_two_square_boxes.gbr", "golden/example_two_square_boxes.png")
-def _DISABLED_test_render_single_quadrant():
- """Umaco exapmle of a single quadrant arc"""
- _test_render("resources/example_single_quadrant.gbr", "golden/example_single_quadrant.png")
-
-
def test_render_simple_contour():
"""Umaco exapmle of a simple arrow-shaped contour"""
gerber = _test_render("resources/example_simple_contour.gbr", "golden/example_simple_contour.png")