diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-07-17 13:14:54 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-07-17 13:14:54 +0800 |
commit | f0585baefa54c5cd891ba04c81053956b1a59977 (patch) | |
tree | 790b776eff169d73700fdd89d2e51bd586e01261 /gerber/render/cairo_backend.py | |
parent | 0dded38353e1d650458f6401aea37a4aadaf28ff (diff) | |
download | gerbonara-f0585baefa54c5cd891ba04c81053956b1a59977.tar.gz gerbonara-f0585baefa54c5cd891ba04c81053956b1a59977.tar.bz2 gerbonara-f0585baefa54c5cd891ba04c81053956b1a59977.zip |
Create first test that renders and validates the the rendered PNG is correct.
Diffstat (limited to 'gerber/render/cairo_backend.py')
-rw-r--r-- | gerber/render/cairo_backend.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py index 5a3c7a1..3c4a395 100644 --- a/gerber/render/cairo_backend.py +++ b/gerber/render/cairo_backend.py @@ -292,8 +292,7 @@ class GerberCairoContext(GerberContext): self.ctx.paint()
def dump(self, filename):
- is_svg = filename.lower().endswith(".svg")
- if is_svg:
+ if filename and filename.lower().endswith(".svg"):
self.surface.finish()
self.surface_buffer.flush()
with open(filename, "w") as f:
@@ -301,7 +300,7 @@ class GerberCairoContext(GerberContext): f.write(self.surface_buffer.read())
f.flush()
else:
- self.surface.write_to_png(filename)
+ return self.surface.write_to_png(filename)
def dump_svg_str(self):
self.surface.finish()
|