From 175062e6b79aa862bbea81d7f1f2622a2ca583c9 Mon Sep 17 00:00:00 2001 From: Peo Webster Date: Sat, 12 Jul 2014 11:09:58 -0500 Subject: [PATCH 01/68] Simple drawing tests for Image backend. --- kiva/tests/test_drawing.py | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 kiva/tests/test_drawing.py diff --git a/kiva/tests/test_drawing.py b/kiva/tests/test_drawing.py new file mode 100644 index 000000000..9568396f4 --- /dev/null +++ b/kiva/tests/test_drawing.py @@ -0,0 +1,123 @@ + +from unittest import TestCase, main + +from numpy import pi +from kiva.fonttools import Font +from kiva.constants import MODERN +from kiva.image import GraphicsContext + +class DrawingTest(TestCase): + + def setUp(self): + self.gc = GraphicsContext((300, 300)) + self.gc.set_stroke_color((0.0, 0.0, 0.0)) + self.gc.set_fill_color((0.0, 0.0, 1.0)) + + def test_line(self): + self.gc.begin_path + self.gc.move_to(107, 204) + self.gc.line_to(107, 104) + self.gc.stroke_path() + self.gc.save("line.bmp") + + def test_rectangle(self): + self.gc.begin_path() + self.gc.move_to(107, 104) + self.gc.line_to(107, 184) + self.gc.line_to(187, 184) + self.gc.line_to(187, 104) + self.gc.line_to(107, 104) + self.gc.stroke_path() + self.gc.save("rectangle.bmp") + + def test_rect(self): + self.gc.begin_path() + self.gc.rect(0,0,200,200) + self.gc.stroke_path() + self.gc.save("rect.bmp") + + def test_circle(self): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * pi) + self.gc.stroke_path() + self.gc.save("circle.bmp") + + def test_quarter_circle(self): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, pi / 2) + self.gc.stroke_path() + self.gc.save("quarter_circle.bmp") + + def test_text(self): + font = Font(family=MODERN) + font.size = 24 + self.gc.set_font(font) + self.gc.set_text_position(23, 67) + self.gc.show_text("hello kiva") + self.gc.save("text.bmp") + + def test_circle_fill(self): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * pi) + self.gc.fill_path() + self.gc.save("circle_fill.bmp") + + def test_star_fill(self): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.fill_path() + self.gc.save("star.bmp") + + def test_star_eof_fill(self): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.eof_fill_path() + self.gc.save("star_eof.bmp") + + def test_circle_clip(self): + self.gc.clip_to_rect(150, 150, 100, 100) + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * pi) + self.gc.fill_path() + self.gc.save("circle_clip.bmp") + + def test_text_clip(self): + self.gc.clip_to_rect(23, 77, 100, 23) + font = Font(family=MODERN) + font.size = 24 + self.gc.set_font(font) + self.gc.set_text_position(23, 67) + self.gc.show_text("hello kiva") + self.gc.save("text_clip.bmp") + + def test_star_clip(self): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.close_path() + self.gc.clip() + + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * pi) + self.gc.fill_path() + self.gc.save("star_clip.bmp") + + + +if __name__ == "__main__": + main() + From 5d7769076aa0ae04b45ff91fe84e54f9aa7771f2 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:44:37 +0100 Subject: [PATCH 02/68] make the tests folder a subpackage --- kiva/tests/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 kiva/tests/__init__.py diff --git a/kiva/tests/__init__.py b/kiva/tests/__init__.py new file mode 100644 index 000000000..e69de29bb From d841b1a2b7f69fc47b5796eef13dbed727029d68 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:45:06 +0100 Subject: [PATCH 03/68] add a test template for drawing with graphic contexts --- kiva/tests/drawing_tester.py | 157 +++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 kiva/tests/drawing_tester.py diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py new file mode 100644 index 000000000..f6305a252 --- /dev/null +++ b/kiva/tests/drawing_tester.py @@ -0,0 +1,157 @@ +import contextlib +import os +import shutil +import tempfile + +import numpy +from PIL import Image + +from kiva.fonttools import Font +from kiva.constants import MODERN + +class DrawingTester(object): + + def setUp(self): + self.directory = tempfile.mkdtemp() + self.filename = os.path.join(self.directory, 'rendered_image.png') + self.gc = self.create_graphics_context(300, 300) + + def tearDown(self): + shutil.rmtree(self.directory) + + def test_line(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.move_to(107, 204) + self.gc.line_to(107, 104) + self.gc.stroke_path() + + def test_rectangle(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.move_to(107, 104) + self.gc.line_to(107, 184) + self.gc.line_to(187, 184) + self.gc.line_to(187, 104) + self.gc.line_to(107, 104) + self.gc.stroke_path() + + def test_rect(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.rect(0,0,200,200) + self.gc.stroke_path() + + def test_circle(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * numpy.pi) + self.gc.stroke_path() + + def test_quarter_circle(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, numpy.pi / 2) + self.gc.stroke_path() + + def test_text(self): + with self.draw_and_check(): + font = Font(family=MODERN) + font.size = 24 + self.gc.set_font(font) + self.gc.set_text_position(23, 67) + self.gc.show_text("hello kiva") + + def test_circle_fill(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * numpy.pi) + self.gc.fill_path() + + def test_star_fill(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.fill_path() + + def test_star_eof_fill(self): + with self.draw_and_check(): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.eof_fill_path() + + def test_circle_clip(self): + with self.draw_and_check(): + self.gc.clip_to_rect(150, 150, 100, 100) + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * numpy.pi) + self.gc.fill_path() + + def test_text_clip(self): + with self.draw_and_check(): + self.gc.clip_to_rect(23, 77, 100, 23) + font = Font(family=MODERN) + font.size = 24 + self.gc.set_font(font) + self.gc.set_text_position(23, 67) + self.gc.show_text("hello kiva") + + def test_star_clip(self): + + with self.draw_and_check(): + self.gc.begin_path() + self.gc.move_to(100, 100) + self.gc.line_to(150, 200) + self.gc.line_to(200, 100) + self.gc.line_to(100, 150) + self.gc.line_to(200, 150) + self.gc.line_to(100, 100) + self.gc.close_path() + self.gc.clip() + + self.gc.begin_path() + self.gc.arc(150, 150, 100, 0.0, 2 * numpy.pi) + self.gc.fill_path() + + def assertImageSavedWithContent(self, filename): + """ Load the image and check that there is some content in it. + + """ + image = numpy.array(Image.open(filename)) + # default is expected to be a totally white image + mask = image != 255 + if not mask.any(): + self.fail('An empty image was saved') + + @contextlib.contextmanager + def draw_and_check(self): + yield + self.save_to_file() + self.assertImageSavedWithContent(self.filename) + + #### Required methods #################################################### + + def create_graphics_context(self, width, length): + """ Create the desired graphics context + + """ + raise NotImplementedError() + + def save_to_file(self): + """ Save the rendered image into a file. + + The filename is given by self.filename. + + """ + raise NotImplementedError() + From 0a08e706379ec66a09e920b7046e33205fbead95 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:45:18 +0100 Subject: [PATCH 04/68] add tests for the agg GC --- kiva/tests/test_agg_drawing.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 kiva/tests/test_agg_drawing.py diff --git a/kiva/tests/test_agg_drawing.py b/kiva/tests/test_agg_drawing.py new file mode 100644 index 000000000..11752ba16 --- /dev/null +++ b/kiva/tests/test_agg_drawing.py @@ -0,0 +1,22 @@ +import unittest + +from kiva.tests.drawing_tester import DrawingTester +from kiva.image import GraphicsContext + + +class TestAggDrawing(DrawingTester, unittest.TestCase): + + def setUp(self): + DrawingTester.setUp(self) + self.gc.set_stroke_color((0.0, 0.0, 0.0)) + self.gc.set_fill_color((0.0, 0.0, 1.0)) + + def create_graphics_context(self, width, height): + return GraphicsContext((width, height)) + + def save_to_file(self): + self.gc.save(self.filename) + + +if __name__ == "__main__": + unittest.main() From d6bb033f53fdd5a739a9671d57243e541dd7de7a Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:45:29 +0100 Subject: [PATCH 05/68] add tests for the pdf GC --- kiva/tests/test_pdf_drawing.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 kiva/tests/test_pdf_drawing.py diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py new file mode 100644 index 000000000..2c124062b --- /dev/null +++ b/kiva/tests/test_pdf_drawing.py @@ -0,0 +1,24 @@ +import unittest + +from kiva.tests.drawing_tester import DrawingTester +from kiva.pdf import GraphicsContext +from reportlab.pdfgen.canvas import Canvas + + +class TestPDFDrawing(DrawingTester, unittest.TestCase): + + def setUp(self): + DrawingTester.setUp(self) + self.gc.set_stroke_color((0.0, 0.0, 0.0)) + self.gc.set_fill_color((0.0, 0.0, 1.0)) + + def create_graphics_context(self, width, height): + canvas = Canvas(self.filename, (width, height)) + return GraphicsContext(canvas) + + def save_to_file(self): + self.gc.save() + + +if __name__ == "__main__": + unittest.main() From 909547219bd517539e367e814270d7e7cf5acc93 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:45:41 +0100 Subject: [PATCH 06/68] add tests for the QPainter GC --- kiva/tests/test_qpainter_drawing.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 kiva/tests/test_qpainter_drawing.py diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py new file mode 100644 index 000000000..cd0b1a5f1 --- /dev/null +++ b/kiva/tests/test_qpainter_drawing.py @@ -0,0 +1,31 @@ +import unittest + +from pyface.qt import QtGui + +from kiva.tests.drawing_tester import DrawingTester +from kiva.qpainter import GraphicsContext + + +class TestQPainterDrawing(DrawingTester, unittest.TestCase): + + def setUp(self): + application = QtGui.QApplication.instance() + if application is None: + self.application = QtGui.QApplication([]) + else: + self.application = application + + DrawingTester.setUp(self) + self.gc.set_stroke_color((0.0, 0.0, 0.0)) + self.gc.set_fill_color((0.0, 0.0, 1.0)) + + + def create_graphics_context(self, width, height): + return GraphicsContext((width, height)) + + def save_to_file(self): + self.gc.save(self.filename) + + +if __name__ == "__main__": + unittest.main() From 569770a0f9c2f968375b49ad29b7e39fd01682c4 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Sun, 31 Aug 2014 16:45:58 +0100 Subject: [PATCH 07/68] remove old testcase --- kiva/tests/test_drawing.py | 123 ------------------------------------- 1 file changed, 123 deletions(-) delete mode 100644 kiva/tests/test_drawing.py diff --git a/kiva/tests/test_drawing.py b/kiva/tests/test_drawing.py deleted file mode 100644 index 9568396f4..000000000 --- a/kiva/tests/test_drawing.py +++ /dev/null @@ -1,123 +0,0 @@ - -from unittest import TestCase, main - -from numpy import pi -from kiva.fonttools import Font -from kiva.constants import MODERN -from kiva.image import GraphicsContext - -class DrawingTest(TestCase): - - def setUp(self): - self.gc = GraphicsContext((300, 300)) - self.gc.set_stroke_color((0.0, 0.0, 0.0)) - self.gc.set_fill_color((0.0, 0.0, 1.0)) - - def test_line(self): - self.gc.begin_path - self.gc.move_to(107, 204) - self.gc.line_to(107, 104) - self.gc.stroke_path() - self.gc.save("line.bmp") - - def test_rectangle(self): - self.gc.begin_path() - self.gc.move_to(107, 104) - self.gc.line_to(107, 184) - self.gc.line_to(187, 184) - self.gc.line_to(187, 104) - self.gc.line_to(107, 104) - self.gc.stroke_path() - self.gc.save("rectangle.bmp") - - def test_rect(self): - self.gc.begin_path() - self.gc.rect(0,0,200,200) - self.gc.stroke_path() - self.gc.save("rect.bmp") - - def test_circle(self): - self.gc.begin_path() - self.gc.arc(150, 150, 100, 0.0, 2 * pi) - self.gc.stroke_path() - self.gc.save("circle.bmp") - - def test_quarter_circle(self): - self.gc.begin_path() - self.gc.arc(150, 150, 100, 0.0, pi / 2) - self.gc.stroke_path() - self.gc.save("quarter_circle.bmp") - - def test_text(self): - font = Font(family=MODERN) - font.size = 24 - self.gc.set_font(font) - self.gc.set_text_position(23, 67) - self.gc.show_text("hello kiva") - self.gc.save("text.bmp") - - def test_circle_fill(self): - self.gc.begin_path() - self.gc.arc(150, 150, 100, 0.0, 2 * pi) - self.gc.fill_path() - self.gc.save("circle_fill.bmp") - - def test_star_fill(self): - self.gc.begin_path() - self.gc.move_to(100, 100) - self.gc.line_to(150, 200) - self.gc.line_to(200, 100) - self.gc.line_to(100, 150) - self.gc.line_to(200, 150) - self.gc.line_to(100, 100) - self.gc.fill_path() - self.gc.save("star.bmp") - - def test_star_eof_fill(self): - self.gc.begin_path() - self.gc.move_to(100, 100) - self.gc.line_to(150, 200) - self.gc.line_to(200, 100) - self.gc.line_to(100, 150) - self.gc.line_to(200, 150) - self.gc.line_to(100, 100) - self.gc.eof_fill_path() - self.gc.save("star_eof.bmp") - - def test_circle_clip(self): - self.gc.clip_to_rect(150, 150, 100, 100) - self.gc.begin_path() - self.gc.arc(150, 150, 100, 0.0, 2 * pi) - self.gc.fill_path() - self.gc.save("circle_clip.bmp") - - def test_text_clip(self): - self.gc.clip_to_rect(23, 77, 100, 23) - font = Font(family=MODERN) - font.size = 24 - self.gc.set_font(font) - self.gc.set_text_position(23, 67) - self.gc.show_text("hello kiva") - self.gc.save("text_clip.bmp") - - def test_star_clip(self): - self.gc.begin_path() - self.gc.move_to(100, 100) - self.gc.line_to(150, 200) - self.gc.line_to(200, 100) - self.gc.line_to(100, 150) - self.gc.line_to(200, 150) - self.gc.line_to(100, 100) - self.gc.close_path() - self.gc.clip() - - self.gc.begin_path() - self.gc.arc(150, 150, 100, 0.0, 2 * pi) - self.gc.fill_path() - self.gc.save("star_clip.bmp") - - - -if __name__ == "__main__": - main() - From 64a65a446aaa5adb5d24aa93da7181f541dfbd26 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 21:12:50 +0100 Subject: [PATCH 08/68] split a special tester subclass for gui toolkit related contexts --- kiva/tests/drawing_tester.py | 45 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index f6305a252..f5b65051b 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -10,6 +10,9 @@ from kiva.constants import MODERN class DrawingTester(object): + """ Basic drawing tests for graphics contexts. + + """ def setUp(self): self.directory = tempfile.mkdtemp() @@ -17,6 +20,7 @@ def setUp(self): self.gc = self.create_graphics_context(300, 300) def tearDown(self): + del self.gc shutil.rmtree(self.directory) def test_line(self): @@ -107,7 +111,6 @@ def test_text_clip(self): self.gc.show_text("hello kiva") def test_star_clip(self): - with self.draw_and_check(): self.gc.begin_path() self.gc.move_to(100, 100) @@ -123,23 +126,14 @@ def test_star_clip(self): self.gc.arc(150, 150, 100, 0.0, 2 * numpy.pi) self.gc.fill_path() - def assertImageSavedWithContent(self, filename): - """ Load the image and check that there is some content in it. - - """ - image = numpy.array(Image.open(filename)) - # default is expected to be a totally white image - mask = image != 255 - if not mask.any(): - self.fail('An empty image was saved') + #### Required methods #################################################### @contextlib.contextmanager def draw_and_check(self): - yield - self.save_to_file() - self.assertImageSavedWithContent(self.filename) + """ A context manager to check the result. - #### Required methods #################################################### + """ + raise NotImplementedError() def create_graphics_context(self, width, length): """ Create the desired graphics context @@ -147,11 +141,24 @@ def create_graphics_context(self, width, length): """ raise NotImplementedError() - def save_to_file(self): - """ Save the rendered image into a file. - The filename is given by self.filename. +class DrawingImageTester(DrawingTester): + """ Basic drawing tests for graphics contexts of gui toolkits. - """ - raise NotImplementedError() + """ + + @contextlib.contextmanager + def draw_and_check(self): + yield + self.gc.save(self.filename) + self.assertImageSavedWithContent(self.filename) + + def assertImageSavedWithContent(self, filename): + """ Load the image and check that there is some content in it. + """ + image = numpy.array(Image.open(filename)) + # default is expected to be a totally white image + mask = image != 255 + if not mask.any(): + self.fail('An empty image was saved') From c81a92d7cbc3f10cdff092252b72e35ef5d71389 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 21:13:13 +0100 Subject: [PATCH 09/68] use the DrawingImageTester --- kiva/tests/test_qpainter_drawing.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py index cd0b1a5f1..76514e1c7 100644 --- a/kiva/tests/test_qpainter_drawing.py +++ b/kiva/tests/test_qpainter_drawing.py @@ -2,11 +2,11 @@ from pyface.qt import QtGui -from kiva.tests.drawing_tester import DrawingTester +from kiva.tests.drawing_tester import DrawingImageTester from kiva.qpainter import GraphicsContext -class TestQPainterDrawing(DrawingTester, unittest.TestCase): +class TestQPainterDrawing(DrawingImageTester, unittest.TestCase): def setUp(self): application = QtGui.QApplication.instance() @@ -15,17 +15,13 @@ def setUp(self): else: self.application = application - DrawingTester.setUp(self) + DrawingImageTester.setUp(self) self.gc.set_stroke_color((0.0, 0.0, 0.0)) self.gc.set_fill_color((0.0, 0.0, 1.0)) - def create_graphics_context(self, width, height): return GraphicsContext((width, height)) - def save_to_file(self): - self.gc.save(self.filename) - if __name__ == "__main__": unittest.main() From 7b8d2ae2598734a740183e22ecdaaef86a877653 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 21:13:37 +0100 Subject: [PATCH 10/68] support some very basic testing for the PDF backend --- kiva/tests/test_pdf_drawing.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index 2c124062b..74b9dc534 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -1,8 +1,12 @@ +import contextlib +import StringIO import unittest +import PyPDF2 # Tests require the PyPDF2 library for parsing the pdf stream +from reportlab.pdfgen.canvas import Canvas + from kiva.tests.drawing_tester import DrawingTester from kiva.pdf import GraphicsContext -from reportlab.pdfgen.canvas import Canvas class TestPDFDrawing(DrawingTester, unittest.TestCase): @@ -16,8 +20,28 @@ def create_graphics_context(self, width, height): canvas = Canvas(self.filename, (width, height)) return GraphicsContext(canvas) - def save_to_file(self): - self.gc.save() + @contextlib.contextmanager + def draw_and_check(self): + yield + # Read the pdfstream. + pdfdata = self.gc.gc.getpdfdata() + stream = StringIO.StringIO(pdfdata) + reader = PyPDF2.PdfFileReader(stream) + self.assertEqual(reader.getNumPages(), 1) + + # Find the graphics in the page + page = reader.getPage(0) + content = page.getContents() + + # Just a simple check that the path has been closed or the text has + # been drawn. + line = content.getData().splitlines()[-2].strip() + if not any(( + line.endswith('f'), + line.endswith('S'), + line.endswith('f*'), + line.endswith('ET') and 'hello kiva' in line)): + self.fail('Path was not closed') if __name__ == "__main__": From 006dac00dbef6851d3e000885856dc959ceb61a7 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 21:51:39 +0100 Subject: [PATCH 11/68] update tests about agg drawing --- kiva/tests/test_agg_drawing.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kiva/tests/test_agg_drawing.py b/kiva/tests/test_agg_drawing.py index 11752ba16..006515903 100644 --- a/kiva/tests/test_agg_drawing.py +++ b/kiva/tests/test_agg_drawing.py @@ -1,22 +1,19 @@ import unittest -from kiva.tests.drawing_tester import DrawingTester +from kiva.tests.drawing_tester import DrawingImageTester from kiva.image import GraphicsContext -class TestAggDrawing(DrawingTester, unittest.TestCase): +class TestAggDrawing(DrawingImageTester, unittest.TestCase): def setUp(self): - DrawingTester.setUp(self) + DrawingImageTester.setUp(self) self.gc.set_stroke_color((0.0, 0.0, 0.0)) self.gc.set_fill_color((0.0, 0.0, 1.0)) def create_graphics_context(self, width, height): return GraphicsContext((width, height)) - def save_to_file(self): - self.gc.save(self.filename) - if __name__ == "__main__": unittest.main() From 7f1ba01a0709d20496e96a1eb7bd161c9d9ce874 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 22:49:30 +0100 Subject: [PATCH 12/68] provide just the name without the extension in self.filename --- kiva/tests/drawing_tester.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index f5b65051b..4fbf4a12d 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -16,8 +16,10 @@ class DrawingTester(object): def setUp(self): self.directory = tempfile.mkdtemp() - self.filename = os.path.join(self.directory, 'rendered_image.png') + self.filename = os.path.join(self.directory, 'rendered') self.gc = self.create_graphics_context(300, 300) + self.gc.set_stroke_color((0.0, 0.0, 0.0)) + self.gc.set_fill_color((0.0, 0.0, 1.0)) def tearDown(self): del self.gc @@ -150,8 +152,9 @@ class DrawingImageTester(DrawingTester): @contextlib.contextmanager def draw_and_check(self): yield - self.gc.save(self.filename) - self.assertImageSavedWithContent(self.filename) + filename = "{0}.png".format(self.filename) + self.gc.save(filename) + self.assertImageSavedWithContent(filename) def assertImageSavedWithContent(self, filename): """ Load the image and check that there is some content in it. From b90f722a2e876cc2e81714f738864110f311f7d3 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 23:18:58 +0100 Subject: [PATCH 13/68] add tests for the ps backend --- kiva/tests/test_ps_drawing.py | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 kiva/tests/test_ps_drawing.py diff --git a/kiva/tests/test_ps_drawing.py b/kiva/tests/test_ps_drawing.py new file mode 100644 index 000000000..861c9340d --- /dev/null +++ b/kiva/tests/test_ps_drawing.py @@ -0,0 +1,38 @@ +import contextlib +import StringIO +import unittest + +from kiva.tests.drawing_tester import DrawingTester +from kiva.ps import PSGC + + +class TestPSDrawing(DrawingTester, unittest.TestCase): + + def setUp(self): + DrawingTester.setUp(self) + + def create_graphics_context(self, width, height): + return PSGC((width, height)) + + @contextlib.contextmanager + def draw_and_check(self): + yield + filename = "{0}.eps".format(self.filename) + self.gc.save(filename) + with open(filename, 'r') as handle: + lines = handle.readlines() + + # Just a simple check that the path has been closed or the text has + # been drawn. + line = lines[-1].strip() + if not any(( + line.endswith('fill'), + line.endswith('stroke'), + line.endswith('cliprestore'), + '(hello kiva) show\n' in lines)): + self.fail('Path was not closed') + + + +if __name__ == "__main__": + unittest.main() From 12d3f4479cd1de4d10290152a6958c71de12ac82 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Mon, 1 Sep 2014 23:19:15 +0100 Subject: [PATCH 14/68] update the pdf tests --- kiva/tests/test_pdf_drawing.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index 74b9dc534..c36a96b4b 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -1,4 +1,5 @@ import contextlib +import os import StringIO import unittest @@ -13,20 +14,19 @@ class TestPDFDrawing(DrawingTester, unittest.TestCase): def setUp(self): DrawingTester.setUp(self) - self.gc.set_stroke_color((0.0, 0.0, 0.0)) - self.gc.set_fill_color((0.0, 0.0, 1.0)) def create_graphics_context(self, width, height): - canvas = Canvas(self.filename, (width, height)) + filename = "{0}.pdf".format(self.filename) + canvas = Canvas(filename, (width, height)) return GraphicsContext(canvas) @contextlib.contextmanager def draw_and_check(self): yield - # Read the pdfstream. - pdfdata = self.gc.gc.getpdfdata() - stream = StringIO.StringIO(pdfdata) - reader = PyPDF2.PdfFileReader(stream) + # Save the pdf file. + filename = "{0}.pdf".format(self.filename) + self.gc.save() + reader = PyPDF2.PdfFileReader(filename) self.assertEqual(reader.getNumPages(), 1) # Find the graphics in the page @@ -35,12 +35,12 @@ def draw_and_check(self): # Just a simple check that the path has been closed or the text has # been drawn. - line = content.getData().splitlines()[-2].strip() + line = content.getData().splitlines()[-2] if not any(( - line.endswith('f'), - line.endswith('S'), - line.endswith('f*'), - line.endswith('ET') and 'hello kiva' in line)): + line.endswith('f'), + line.endswith('S'), + line.endswith('f*'), + line.endswith('ET') and 'hello kiva' in line)): self.fail('Path was not closed') From ba0d2ed9373df05eae280f8664214decddbd755c Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:06:14 +0100 Subject: [PATCH 15/68] add basic drawing tests for svg --- kiva/tests/test_svg_drawing.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 kiva/tests/test_svg_drawing.py diff --git a/kiva/tests/test_svg_drawing.py b/kiva/tests/test_svg_drawing.py new file mode 100644 index 000000000..92db3a975 --- /dev/null +++ b/kiva/tests/test_svg_drawing.py @@ -0,0 +1,27 @@ +import contextlib +import StringIO +import unittest +from xml.etree import ElementTree + +from kiva.tests.drawing_tester import DrawingTester +from kiva.svg import GraphicsContext + + +class TestSVGDrawing(DrawingTester, unittest.TestCase): + + def create_graphics_context(self, width, height): + return GraphicsContext((width, height)) + + @contextlib.contextmanager + def draw_and_check(self): + yield + filename = "{0}.svg".format(self.filename) + self.gc.save(filename) + tree = ElementTree.parse(filename) + elements = [element for element in tree.iter()] + if not len(elements) in [4, 7]: + self.fail('The expected number of elements was not found') + + +if __name__ == "__main__": + unittest.main() From 204e9f57484795ea18377ea5b3a07808f1e153be Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:06:42 +0100 Subject: [PATCH 16/68] add workaround for and ps, svg tests to function --- kiva/graphics_state.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kiva/graphics_state.py b/kiva/graphics_state.py index a5d3ec0f3..0e7eded14 100644 --- a/kiva/graphics_state.py +++ b/kiva/graphics_state.py @@ -98,8 +98,12 @@ def __init__(self): line_cap = CAP_ROUND line_join = JOIN_MITER line_dash = (0, array([0])) # This will draw a solid line - self.line_state = LineState(line_color, line_width, line_cap, - line_join, line_dash) + + # FIXME: This is a very wierd class. The following code is here to + # make the basecore2d and the PS, SVG context managers happy + super(GraphicsState, self).__init__( + line_color, line_width, line_cap, line_join, line_dash) + self.line_state = self # All other default values. self.ctm = affine.affine_identity() From 6e3fd9c9f8ce631be33e006c5f0d05bc8e0c562d Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:11:20 +0100 Subject: [PATCH 17/68] add testcase for the gl backend --- kiva/tests/test_gl_drawing.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kiva/tests/test_gl_drawing.py diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py new file mode 100644 index 000000000..7bf173bbc --- /dev/null +++ b/kiva/tests/test_gl_drawing.py @@ -0,0 +1,14 @@ +import unittest + +from kiva.tests.drawing_tester import DrawingImageTester +from kiva.gl import GraphicsContext + + +class TestGLDrawing(DrawingImageTester, unittest.TestCase): + + def create_graphics_context(self, width, height): + return GraphicsContext((width, height)) + + +if __name__ == "__main__": + unittest.main() From 6d62b0cc58fc4cd99d3305f35065321e74ba9892 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:11:35 +0100 Subject: [PATCH 18/68] minor cleanup --- kiva/tests/test_agg_drawing.py | 2 -- kiva/tests/test_pdf_drawing.py | 3 --- kiva/tests/test_ps_drawing.py | 3 --- 3 files changed, 8 deletions(-) diff --git a/kiva/tests/test_agg_drawing.py b/kiva/tests/test_agg_drawing.py index 006515903..3c9e44dd7 100644 --- a/kiva/tests/test_agg_drawing.py +++ b/kiva/tests/test_agg_drawing.py @@ -8,8 +8,6 @@ class TestAggDrawing(DrawingImageTester, unittest.TestCase): def setUp(self): DrawingImageTester.setUp(self) - self.gc.set_stroke_color((0.0, 0.0, 0.0)) - self.gc.set_fill_color((0.0, 0.0, 1.0)) def create_graphics_context(self, width, height): return GraphicsContext((width, height)) diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index c36a96b4b..19f10c5a4 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -12,9 +12,6 @@ class TestPDFDrawing(DrawingTester, unittest.TestCase): - def setUp(self): - DrawingTester.setUp(self) - def create_graphics_context(self, width, height): filename = "{0}.pdf".format(self.filename) canvas = Canvas(filename, (width, height)) diff --git a/kiva/tests/test_ps_drawing.py b/kiva/tests/test_ps_drawing.py index 861c9340d..843fa1928 100644 --- a/kiva/tests/test_ps_drawing.py +++ b/kiva/tests/test_ps_drawing.py @@ -8,9 +8,6 @@ class TestPSDrawing(DrawingTester, unittest.TestCase): - def setUp(self): - DrawingTester.setUp(self) - def create_graphics_context(self, width, height): return PSGC((width, height)) From bd250ff2e699e9bf40fb4c9c717c9d230bb71a0f Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:11:50 +0100 Subject: [PATCH 19/68] add tests for the cairo backend --- kiva/tests/test_cairo_drawing.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kiva/tests/test_cairo_drawing.py diff --git a/kiva/tests/test_cairo_drawing.py b/kiva/tests/test_cairo_drawing.py new file mode 100644 index 000000000..3f0cc516c --- /dev/null +++ b/kiva/tests/test_cairo_drawing.py @@ -0,0 +1,14 @@ +import unittest + +from kiva.tests.drawing_tester import DrawingImageTester +from kiva.cairo import GraphicsContext + + +class TestCairoDrawing(DrawingImageTester, unittest.TestCase): + + def create_graphics_context(self, width, height): + return GraphicsContext((width, height)) + + +if __name__ == "__main__": + unittest.main() From dd487f99e640322b49c737d62da466d7749701df Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 00:53:09 +0100 Subject: [PATCH 20/68] update depedencies so that all the tests are run --- .travis.yml | 1 + dev_requirements.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3ee40c351..e0d614f0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install python-numpy - sudo apt-get install swig + - sudo apt-get install libjpeg-dev zlib1g-dev install: # nose is already installed - pip install cython diff --git a/dev_requirements.txt b/dev_requirements.txt index 8cdd9ebbe..7ba1fb679 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -3,6 +3,8 @@ coverage PIL pyparsing +PyPDF2 +py2cairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From c41bf173628e29cb9e46e57eed01a44e5268089c Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:00:25 +0100 Subject: [PATCH 21/68] udpate requirements --- dev_requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 7ba1fb679..a74671bdd 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -4,7 +4,8 @@ coverage PIL pyparsing PyPDF2 -py2cairo +pyglet +-e git+http://git.cairographics.org/git/py2cairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From 316f9b71d7e350fbd4252ea4fc08dd52832b14ce Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:02:39 +0100 Subject: [PATCH 22/68] install libpng-dev --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e0d614f0b..978497205 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install python-numpy - sudo apt-get install swig - - sudo apt-get install libjpeg-dev zlib1g-dev + - sudo apt-get install libpng-dev libjpeg-dev zlib1g-dev install: # nose is already installed - pip install cython From f6973a3ab76db2fc992c217c2f2e87c90b114903 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:06:42 +0100 Subject: [PATCH 23/68] remvoe py2cairo for now --- dev_requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index a74671bdd..51b872677 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -5,7 +5,6 @@ PIL pyparsing PyPDF2 pyglet --e git+http://git.cairographics.org/git/py2cairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From c0561176345876e6c7d12730bb9c097f474761d2 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:18:24 +0100 Subject: [PATCH 24/68] try to get PIL to install properly --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 978497205..33e7f3110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install python-numpy - sudo apt-get install swig - - sudo apt-get install libpng-dev libjpeg-dev zlib1g-dev + - sudo apt-get install libpng-dev libjpeg-dev zlib1g-dev libfreetype6-dev python-dev install: # nose is already installed - pip install cython From 3169b320c67631d63d81573f9e91613335937925 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:29:27 +0100 Subject: [PATCH 25/68] symlinks for PIL --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 33e7f3110..67e3af3e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,10 @@ before_install: - sudo apt-get install python-numpy - sudo apt-get install swig - sudo apt-get install libpng-dev libjpeg-dev zlib1g-dev libfreetype6-dev python-dev + # Simlinks for PIL compilation + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ install: # nose is already installed - pip install cython From 4995e45789c5c4ad65a56d6ba961db7e4b88adbb Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 01:37:01 +0100 Subject: [PATCH 26/68] add a few more dependencies --- dev_requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev_requirements.txt b/dev_requirements.txt index 51b872677..e3475f6ea 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -5,6 +5,8 @@ PIL pyparsing PyPDF2 pyglet +pygarrayimage +reportlab -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From 27451444c6784004f0fe708c7ceff30c46a6bbef Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:15:32 +0100 Subject: [PATCH 27/68] avoid segfault in gl tests --- kiva/tests/test_gl_drawing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 7bf173bbc..04a846058 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -9,6 +9,9 @@ class TestGLDrawing(DrawingImageTester, unittest.TestCase): def create_graphics_context(self, width, height): return GraphicsContext((width, height)) + def test_star_clip(self): + # FIXME: overriding test since it segfaults + self.fail('This normally segfaults') if __name__ == "__main__": unittest.main() From 826d50c2173459a8cf6e5e5da58cf29fc7f4d4f4 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:18:58 +0100 Subject: [PATCH 28/68] another attempt at pycairo --- .travis.yml | 2 +- dev_requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67e3af3e8..b346186fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install python-numpy - sudo apt-get install swig - - sudo apt-get install libpng-dev libjpeg-dev zlib1g-dev libfreetype6-dev python-dev + - sudo apt-get install libcairo2-dev # Simlinks for PIL compilation - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ diff --git a/dev_requirements.txt b/dev_requirements.txt index e3475f6ea..7ef9bab34 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -7,6 +7,7 @@ PyPDF2 pyglet pygarrayimage reportlab +pycairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From 17ccd1d552e4896cbd1764be41800ac5c78c4ba8 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:29:09 +0100 Subject: [PATCH 29/68] add pycairo to the allowed items in pip --- dev_requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 7ef9bab34..8f0a37893 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,5 @@ ---allow-external PIL ---allow-unverified PIL +--allow-external PIL pycairo +--allow-unverified PIL pycairo coverage PIL pyparsing From 8a6c2ecdc39216fbbcf63efc3321bc7951c31fd0 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:33:07 +0100 Subject: [PATCH 30/68] more fixes on the dependencies --- .travis.yml | 1 - dev_requirements.txt | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b346186fe..bc155be32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install python-numpy - sudo apt-get install swig - - sudo apt-get install libcairo2-dev # Simlinks for PIL compilation - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ diff --git a/dev_requirements.txt b/dev_requirements.txt index 8f0a37893..64efb16e9 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,7 @@ ---allow-external PIL pycairo ---allow-unverified PIL pycairo +--allow-external PIL +--allow-unverified PIL +--allow-external pycairo +--allow-unverified pycairo coverage PIL pyparsing From ebc1a762741bd0e7354f6d705f9fd2ea8f18ef19 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:51:58 +0100 Subject: [PATCH 31/68] try to compile pycairo --- .travis.yml | 6 ++++++ dev_requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc155be32..d01f8ffa8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,12 @@ install: # nose is already installed - pip install cython - pip install -r dev_requirements.txt + - tar -xf pycairo-1.10.0.tar.bz2 + - pushd pycairo-1.10.0 + - ./waf configure + - ./waf build + - sudo ./waf install + - popd - pip install coveralls - python setup.py develop script: diff --git a/dev_requirements.txt b/dev_requirements.txt index 64efb16e9..a33de8b7d 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -9,7 +9,7 @@ PyPDF2 pyglet pygarrayimage reportlab -pycairo +--download=. pycairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From 53f723a8e66e66845ba851ffc25edc3b8d531648 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 02:57:15 +0100 Subject: [PATCH 32/68] fix requirements.txt --- .travis.yml | 1 + dev_requirements.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d01f8ffa8..a993defb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ install: # nose is already installed - pip install cython - pip install -r dev_requirements.txt + - pip install --download=. pycairo - tar -xf pycairo-1.10.0.tar.bz2 - pushd pycairo-1.10.0 - ./waf configure diff --git a/dev_requirements.txt b/dev_requirements.txt index a33de8b7d..2be4420bf 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -9,7 +9,6 @@ PyPDF2 pyglet pygarrayimage reportlab ---download=. pycairo -e git+http://github.com/enthought/traits.git#egg=traits -e git+http://github.com/enthought/traitsui.git#egg=traitsui -e git+http://github.com/nucleic/kiwi.git#egg=kiwisolver From decba378f18430821b7bc1cb6ca9b0345950cebd Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 03:02:30 +0100 Subject: [PATCH 33/68] use the allow commands for pip --- dev_requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 2be4420bf..e3475f6ea 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,7 +1,5 @@ --allow-external PIL --allow-unverified PIL ---allow-external pycairo ---allow-unverified pycairo coverage PIL pyparsing From a5f7aa460fb74c8df28081981a01744486b26596 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 03:16:38 +0100 Subject: [PATCH 34/68] use wget --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a993defb0..c5a9bca25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: # nose is already installed - pip install cython - pip install -r dev_requirements.txt - - pip install --download=. pycairo + - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - tar -xf pycairo-1.10.0.tar.bz2 - pushd pycairo-1.10.0 - ./waf configure From 0030d59ed7a35653e45282d462ab44f91bee1dcf Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 03:17:38 +0100 Subject: [PATCH 35/68] fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5a9bca25..0c30b7efd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: - pip install cython - pip install -r dev_requirements.txt - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - - tar -xf pycairo-1.10.0.tar.bz2 + - tar -xf py2cairo-1.10.0.tar.bz2 - pushd pycairo-1.10.0 - ./waf configure - ./waf build From 208cf28160f28bd4b1aa16b25a13fa6e32608a50 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 03:24:59 +0100 Subject: [PATCH 36/68] more typos --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c30b7efd..00d2bf3ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: - pip install -r dev_requirements.txt - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - tar -xf py2cairo-1.10.0.tar.bz2 - - pushd pycairo-1.10.0 + - pushd py2cairo-1.10.0 - ./waf configure - ./waf build - sudo ./waf install From 6069e050a478fc0af96807a5528b66a5ff4593a5 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 2 Sep 2014 13:00:48 +0100 Subject: [PATCH 37/68] Fix unit test for qpainter. --- kiva/qpainter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiva/qpainter.py b/kiva/qpainter.py index f9ff964de..8ec812d97 100644 --- a/kiva/qpainter.py +++ b/kiva/qpainter.py @@ -736,7 +736,7 @@ def fill_path(self): def eof_fill_path(self): """ """ - self.path.setFillRule(QtCore.Qt.OddEvenFill) + self.path.path.setFillRule(QtCore.Qt.OddEvenFill) self.gc.fillPath(self.path.path, self.gc.brush()) self.begin_path() From caae1b3e9ae4f12fa0c6f880ef4a6fa694612012 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 23:07:49 +0100 Subject: [PATCH 38/68] use getiterator instead of iter --- kiva/tests/test_svg_drawing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiva/tests/test_svg_drawing.py b/kiva/tests/test_svg_drawing.py index 92db3a975..b3bf66f3b 100644 --- a/kiva/tests/test_svg_drawing.py +++ b/kiva/tests/test_svg_drawing.py @@ -18,7 +18,7 @@ def draw_and_check(self): filename = "{0}.svg".format(self.filename) self.gc.save(filename) tree = ElementTree.parse(filename) - elements = [element for element in tree.iter()] + elements = [element for element in tree.getiterator()] if not len(elements) in [4, 7]: self.fail('The expected number of elements was not found') From acf7abc856f060477cffc6d30cc0b96f01a1d2af Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Tue, 2 Sep 2014 23:35:47 +0100 Subject: [PATCH 39/68] minor cleanup --- kiva/tests/test_agg_drawing.py | 3 +-- kiva/tests/test_cairo_drawing.py | 3 +-- kiva/tests/test_gl_drawing.py | 3 +-- kiva/tests/test_pdf_drawing.py | 4 +--- kiva/tests/test_ps_drawing.py | 4 +--- kiva/tests/test_qpainter_drawing.py | 3 +-- kiva/tests/test_svg_drawing.py | 3 +-- 7 files changed, 7 insertions(+), 16 deletions(-) diff --git a/kiva/tests/test_agg_drawing.py b/kiva/tests/test_agg_drawing.py index 3c9e44dd7..c348a771d 100644 --- a/kiva/tests/test_agg_drawing.py +++ b/kiva/tests/test_agg_drawing.py @@ -1,7 +1,6 @@ -import unittest - from kiva.tests.drawing_tester import DrawingImageTester from kiva.image import GraphicsContext +from traits.testing.unittest_tools import unittest class TestAggDrawing(DrawingImageTester, unittest.TestCase): diff --git a/kiva/tests/test_cairo_drawing.py b/kiva/tests/test_cairo_drawing.py index 3f0cc516c..9d0fdc194 100644 --- a/kiva/tests/test_cairo_drawing.py +++ b/kiva/tests/test_cairo_drawing.py @@ -1,7 +1,6 @@ -import unittest - from kiva.tests.drawing_tester import DrawingImageTester from kiva.cairo import GraphicsContext +from traits.testing.unittest_tools import unittest class TestCairoDrawing(DrawingImageTester, unittest.TestCase): diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 04a846058..79cc36c16 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -1,7 +1,6 @@ -import unittest - from kiva.tests.drawing_tester import DrawingImageTester from kiva.gl import GraphicsContext +from traits.testing.unittest_tools import unittest class TestGLDrawing(DrawingImageTester, unittest.TestCase): diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index 19f10c5a4..e6f106300 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -1,13 +1,11 @@ import contextlib -import os -import StringIO -import unittest import PyPDF2 # Tests require the PyPDF2 library for parsing the pdf stream from reportlab.pdfgen.canvas import Canvas from kiva.tests.drawing_tester import DrawingTester from kiva.pdf import GraphicsContext +from traits.testing.unittest_tools import unittest class TestPDFDrawing(DrawingTester, unittest.TestCase): diff --git a/kiva/tests/test_ps_drawing.py b/kiva/tests/test_ps_drawing.py index 843fa1928..8445c067c 100644 --- a/kiva/tests/test_ps_drawing.py +++ b/kiva/tests/test_ps_drawing.py @@ -1,9 +1,8 @@ import contextlib -import StringIO -import unittest from kiva.tests.drawing_tester import DrawingTester from kiva.ps import PSGC +from traits.testing.unittest_tools import unittest class TestPSDrawing(DrawingTester, unittest.TestCase): @@ -30,6 +29,5 @@ def draw_and_check(self): self.fail('Path was not closed') - if __name__ == "__main__": unittest.main() diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py index 76514e1c7..8de273324 100644 --- a/kiva/tests/test_qpainter_drawing.py +++ b/kiva/tests/test_qpainter_drawing.py @@ -1,9 +1,8 @@ -import unittest - from pyface.qt import QtGui from kiva.tests.drawing_tester import DrawingImageTester from kiva.qpainter import GraphicsContext +from traits.testing.unittest_tools import unittest class TestQPainterDrawing(DrawingImageTester, unittest.TestCase): diff --git a/kiva/tests/test_svg_drawing.py b/kiva/tests/test_svg_drawing.py index b3bf66f3b..5eba7bc04 100644 --- a/kiva/tests/test_svg_drawing.py +++ b/kiva/tests/test_svg_drawing.py @@ -1,10 +1,9 @@ import contextlib -import StringIO -import unittest from xml.etree import ElementTree from kiva.tests.drawing_tester import DrawingTester from kiva.svg import GraphicsContext +from traits.testing.unittest_tools import unittest class TestSVGDrawing(DrawingTester, unittest.TestCase): From db19c403c7157577bf1dbe272e892fbb82079e89 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 02:31:32 +0000 Subject: [PATCH 40/68] always clear the graphics context --- kiva/tests/drawing_tester.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index f6305a252..424bba0aa 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -15,6 +15,7 @@ def setUp(self): self.directory = tempfile.mkdtemp() self.filename = os.path.join(self.directory, 'rendered_image.png') self.gc = self.create_graphics_context(300, 300) + self.gc.clear() def tearDown(self): shutil.rmtree(self.directory) From 7c76783e05739199b19c81e2c20ccd82d05b83d3 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 02:38:11 +0000 Subject: [PATCH 41/68] minor cleanup --- kiva/tests/drawing_tester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index 4b03b3415..f470573bb 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -9,6 +9,7 @@ from kiva.fonttools import Font from kiva.constants import MODERN + class DrawingTester(object): """ Basic drawing tests for graphics contexts. @@ -46,7 +47,7 @@ def test_rectangle(self): def test_rect(self): with self.draw_and_check(): self.gc.begin_path() - self.gc.rect(0,0,200,200) + self.gc.rect(0, 0, 200, 200) self.gc.stroke_path() def test_circle(self): From 4c6ec1475de362da99bf7d44f9d7935b9bebe3c7 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 13:34:02 +0000 Subject: [PATCH 42/68] rework drawing tests to make sure that we are getting red pixels --- kiva/tests/drawing_tester.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index f470573bb..c167a3180 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -20,8 +20,9 @@ def setUp(self): self.filename = os.path.join(self.directory, 'rendered') self.gc = self.create_graphics_context(300, 300) self.gc.clear() - self.gc.set_stroke_color((0.0, 0.0, 0.0)) - self.gc.set_fill_color((0.0, 0.0, 1.0)) + self.gc.set_stroke_color((1.0, 0.0, 0.0)) + self.gc.set_fill_color((1.0, 0.0, 0.0)) + self.gc.set_line_width(5) def tearDown(self): del self.gc @@ -164,6 +165,8 @@ def assertImageSavedWithContent(self, filename): """ image = numpy.array(Image.open(filename)) # default is expected to be a totally white image - mask = image != 255 - if not mask.any(): - self.fail('An empty image was saved') + self.assertEqual(image.shape, (300, 300, 4)) + check = numpy.sum(image == [255, 0, 0, 255], axis=2) == 4 + if check.any(): + return + self.fail('An empty image was saved') From e93db87757313692bf6f8b97730a28ca27b5f22c Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 13:34:52 +0000 Subject: [PATCH 43/68] only use the temp dirs when saving files --- kiva/tests/drawing_tester.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index c167a3180..fed6f8cc5 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -16,8 +16,6 @@ class DrawingTester(object): """ def setUp(self): - self.directory = tempfile.mkdtemp() - self.filename = os.path.join(self.directory, 'rendered') self.gc = self.create_graphics_context(300, 300) self.gc.clear() self.gc.set_stroke_color((1.0, 0.0, 0.0)) @@ -26,7 +24,6 @@ def setUp(self): def tearDown(self): del self.gc - shutil.rmtree(self.directory) def test_line(self): with self.draw_and_check(): @@ -152,6 +149,15 @@ class DrawingImageTester(DrawingTester): """ + def setUp(self): + self.directory = tempfile.mkdtemp() + self.filename = os.path.join(self.directory, 'rendered') + DrawingTester.setUp(self) + + def tearDown(self): + DrawingTester.tearDown(self) + shutil.rmtree(self.directory) + @contextlib.contextmanager def draw_and_check(self): yield From 4560bf7b8e2b0b0dfa049f0b96281526e52601da Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 13:35:33 +0000 Subject: [PATCH 44/68] update gl tests to create a gl context and save an image --- kiva/tests/test_gl_drawing.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 79cc36c16..4ebc14ba3 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -1,3 +1,7 @@ +import contextlib + +import pyglet + from kiva.tests.drawing_tester import DrawingImageTester from kiva.gl import GraphicsContext from traits.testing.unittest_tools import unittest @@ -5,12 +9,35 @@ class TestGLDrawing(DrawingImageTester, unittest.TestCase): + def tearDown(self): + if hasattr(self, 'window') and self.window is not None: + self.window.close() + del self.window + DrawingImageTester.tearDown(self) + def create_graphics_context(self, width, height): - return GraphicsContext((width, height)) + self.window = pyglet.window.Window(width=width, height=height) + gc = GraphicsContext((width, height)) + gc.gl_init() + return gc + @unittest.skip("gl graphics context does not support start_clip") def test_star_clip(self): # FIXME: overriding test since it segfaults - self.fail('This normally segfaults') + pass + + @contextlib.contextmanager + def draw_and_check(self): + self.window.clear() + self.window.switch_to() + self.window.dispatch_events() + yield + self.window.dispatch_events() + filename = "{0}.png".format(self.filename) + print filename + pyglet.image.get_buffer_manager().get_color_buffer().save('filename.png') + self.assertImageSavedWithContent('filename.png') + if __name__ == "__main__": unittest.main() From 56b32297b95f4e255637524706d68ec5c380b842 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 13:52:39 +0000 Subject: [PATCH 45/68] fix tests to support RGB or RGBA --- kiva/tests/drawing_tester.py | 13 ++++++++++--- kiva/tests/test_qpainter_drawing.py | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index fed6f8cc5..1012da40a 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -171,8 +171,15 @@ def assertImageSavedWithContent(self, filename): """ image = numpy.array(Image.open(filename)) # default is expected to be a totally white image - self.assertEqual(image.shape, (300, 300, 4)) - check = numpy.sum(image == [255, 0, 0, 255], axis=2) == 4 + + self.assertEqual(image.shape[:2], (300, 300)) + if image.shape[2] == 3: + check = numpy.sum(image == [255, 0, 0], axis=2) == 3 + elif image.shape[2] == 4: + check = numpy.sum(image == [255, 0, 0, 255], axis=2) == 4 + else: + self.fail( + 'Pixel size is not 3 or 4, but {0}'.format(image.shape[2])) if check.any(): return - self.fail('An empty image was saved') + self.fail('The image looks empty, no red pixels where drawn') diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py index 8de273324..82cdfb52c 100644 --- a/kiva/tests/test_qpainter_drawing.py +++ b/kiva/tests/test_qpainter_drawing.py @@ -15,8 +15,6 @@ def setUp(self): self.application = application DrawingImageTester.setUp(self) - self.gc.set_stroke_color((0.0, 0.0, 0.0)) - self.gc.set_fill_color((0.0, 0.0, 1.0)) def create_graphics_context(self, width, height): return GraphicsContext((width, height)) From 2fab14ee6860699fcb49c0c1424df66cb1bbc77e Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 13:55:48 +0000 Subject: [PATCH 46/68] fix tests for svg --- kiva/tests/test_svg_drawing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kiva/tests/test_svg_drawing.py b/kiva/tests/test_svg_drawing.py index 5eba7bc04..956e8a728 100644 --- a/kiva/tests/test_svg_drawing.py +++ b/kiva/tests/test_svg_drawing.py @@ -1,12 +1,12 @@ import contextlib from xml.etree import ElementTree -from kiva.tests.drawing_tester import DrawingTester +from kiva.tests.drawing_tester import DrawingImageTester from kiva.svg import GraphicsContext from traits.testing.unittest_tools import unittest -class TestSVGDrawing(DrawingTester, unittest.TestCase): +class TestSVGDrawing(DrawingImageTester, unittest.TestCase): def create_graphics_context(self, width, height): return GraphicsContext((width, height)) From e8d6b3f1017333ef4bdd6022d35a682402acae7d Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 14:03:43 +0000 Subject: [PATCH 47/68] use the right filename for the gl tests --- kiva/tests/test_gl_drawing.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 4ebc14ba3..57bacbd8d 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -34,9 +34,8 @@ def draw_and_check(self): yield self.window.dispatch_events() filename = "{0}.png".format(self.filename) - print filename - pyglet.image.get_buffer_manager().get_color_buffer().save('filename.png') - self.assertImageSavedWithContent('filename.png') + pyglet.image.get_buffer_manager().get_color_buffer().save(filename) + self.assertImageSavedWithContent(filename) if __name__ == "__main__": From 5d2f3e3e906adf14e20dee766449bbccf41bf3af Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 14:09:18 +0000 Subject: [PATCH 48/68] revert changes to the test assistants --- kiva/tests/drawing_tester.py | 12 +++--------- kiva/tests/test_svg_drawing.py | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/kiva/tests/drawing_tester.py b/kiva/tests/drawing_tester.py index 1012da40a..b31a90e0f 100644 --- a/kiva/tests/drawing_tester.py +++ b/kiva/tests/drawing_tester.py @@ -16,6 +16,8 @@ class DrawingTester(object): """ def setUp(self): + self.directory = tempfile.mkdtemp() + self.filename = os.path.join(self.directory, 'rendered') self.gc = self.create_graphics_context(300, 300) self.gc.clear() self.gc.set_stroke_color((1.0, 0.0, 0.0)) @@ -24,6 +26,7 @@ def setUp(self): def tearDown(self): del self.gc + shutil.rmtree(self.directory) def test_line(self): with self.draw_and_check(): @@ -149,15 +152,6 @@ class DrawingImageTester(DrawingTester): """ - def setUp(self): - self.directory = tempfile.mkdtemp() - self.filename = os.path.join(self.directory, 'rendered') - DrawingTester.setUp(self) - - def tearDown(self): - DrawingTester.tearDown(self) - shutil.rmtree(self.directory) - @contextlib.contextmanager def draw_and_check(self): yield diff --git a/kiva/tests/test_svg_drawing.py b/kiva/tests/test_svg_drawing.py index 956e8a728..5eba7bc04 100644 --- a/kiva/tests/test_svg_drawing.py +++ b/kiva/tests/test_svg_drawing.py @@ -1,12 +1,12 @@ import contextlib from xml.etree import ElementTree -from kiva.tests.drawing_tester import DrawingImageTester +from kiva.tests.drawing_tester import DrawingTester from kiva.svg import GraphicsContext from traits.testing.unittest_tools import unittest -class TestSVGDrawing(DrawingImageTester, unittest.TestCase): +class TestSVGDrawing(DrawingTester, unittest.TestCase): def create_graphics_context(self, width, height): return GraphicsContext((width, height)) From 814ec6ea1a683a2e81c3e4e67d11479c84574479 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 14:42:44 +0000 Subject: [PATCH 49/68] add clean() method to the pdf graphics context --- kiva/pdf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kiva/pdf.py b/kiva/pdf.py index 1645898bd..967a73d71 100644 --- a/kiva/pdf.py +++ b/kiva/pdf.py @@ -723,6 +723,11 @@ def get_text_extent(self, textstring): # Painting paths (drawing and filling contours) # ---------------------------------------------------------------- + def clear(self): + """ + """ + warnings.warn("clear() is ignored for the pdf backend") + def stroke_path(self): """ """ From b587ebaf4d286909b5f7c9b501a182f2cbd59403 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 15:03:37 +0000 Subject: [PATCH 50/68] make the text_clip test an expected failure --- kiva/tests/test_gl_drawing.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 57bacbd8d..735f3a5b4 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -24,7 +24,12 @@ def create_graphics_context(self, width, height): @unittest.skip("gl graphics context does not support start_clip") def test_star_clip(self): # FIXME: overriding test since it segfaults - pass + DrawingImageTester.test_star_clip(self) + + @unittest.expectedFailure + def test_text_clip(self): + # gl graphics context does not clip text properly + DrawingImageTester.test_text_clip(self) @contextlib.contextmanager def draw_and_check(self): From 624ae2ff39acb31d124a32af4117bb55c0119b80 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 15:16:30 +0000 Subject: [PATCH 51/68] attempt to fix travis-ci --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 00d2bf3ed..ccaae06f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ python: - '2.7_with_system_site_packages' - 2.6 before_install: + - sudo apt-get update # For Python 2.7, install PyQt4 - if [[ $TRAVIS_PYTHON_VERSION == '2.7_with_system_site_packages' ]]; then source .travis_before_install; fi # PyQt can't be installed on 2.6; run the tests without Qt @@ -12,6 +13,7 @@ before_install: # Simlinks for PIL compilation - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ + - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libpng.so /usr/lib/ - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ install: # nose is already installed From 29b7c2451840e0fa6e50bf4313ba4965ce55580e Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 15:29:34 +0000 Subject: [PATCH 52/68] try compiling numpy --- .travis.yml | 1 - dev_requirements.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ccaae06f3..586866a28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ before_install: - if [[ $TRAVIS_PYTHON_VERSION == '2.7_with_system_site_packages' ]]; then source .travis_before_install; fi # PyQt can't be installed on 2.6; run the tests without Qt - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - - sudo apt-get install python-numpy - sudo apt-get install swig # Simlinks for PIL compilation - sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ diff --git a/dev_requirements.txt b/dev_requirements.txt index e3475f6ea..6f14eb9c3 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,6 @@ --allow-external PIL --allow-unverified PIL +numpy coverage PIL pyparsing From 6f86cd9026febb29115fe9b57193e89881b7ba97 Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 21:18:26 +0000 Subject: [PATCH 53/68] looks like pil and pillow have a bad interaction --- .travis.yml | 1 + dev_requirements.txt | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 586866a28..72cba4c47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ before_install: install: # nose is already installed - pip install cython + - pip install --upgrade numpy - pip install -r dev_requirements.txt - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - tar -xf py2cairo-1.10.0.tar.bz2 diff --git a/dev_requirements.txt b/dev_requirements.txt index 6f14eb9c3..292cdb36f 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,8 +1,5 @@ ---allow-external PIL ---allow-unverified PIL -numpy coverage -PIL +pillow pyparsing PyPDF2 pyglet From da4b4bfcf18063a5a17c83258d36ac55c8b03e2e Mon Sep 17 00:00:00 2001 From: itziakos Date: Sat, 15 Nov 2014 21:34:55 +0000 Subject: [PATCH 54/68] revert to installing PIL --- dev_requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 292cdb36f..e3475f6ea 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,7 @@ +--allow-external PIL +--allow-unverified PIL coverage -pillow +PIL pyparsing PyPDF2 pyglet From de7d04a09e798db96bdbba2984a90ed23b7e1526 Mon Sep 17 00:00:00 2001 From: itziakos Date: Thu, 27 Nov 2014 23:28:21 +0000 Subject: [PATCH 55/68] force to use the default but slow PNGImageEncoder --- kiva/tests/test_gl_drawing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 735f3a5b4..2f2eb1e53 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -1,6 +1,7 @@ import contextlib import pyglet +from pyglet.image.codecs.png import PNGImageEncoder from kiva.tests.drawing_tester import DrawingImageTester from kiva.gl import GraphicsContext @@ -39,7 +40,8 @@ def draw_and_check(self): yield self.window.dispatch_events() filename = "{0}.png".format(self.filename) - pyglet.image.get_buffer_manager().get_color_buffer().save(filename) + buffer = pyglet.image.get_buffer_manager() + buffer.get_color_buffer().save(filename, encoder=PNGImageEncoder()) self.assertImageSavedWithContent(filename) From 7ba254454a14830a4d50593d59ec900f40f9f50e Mon Sep 17 00:00:00 2001 From: itziakos Date: Thu, 27 Nov 2014 23:59:30 +0000 Subject: [PATCH 56/68] add dev requirements for python 2.6 --- requirements-2.6.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements-2.6.txt diff --git a/requirements-2.6.txt b/requirements-2.6.txt new file mode 100644 index 000000000..9a23970d3 --- /dev/null +++ b/requirements-2.6.txt @@ -0,0 +1 @@ +unittest2 From 27dba40af70bbb81ac996378ece3926b16fa7217 Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 00:00:04 +0000 Subject: [PATCH 57/68] install extra requirements for python 2.6 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 72cba4c47..64ea60eb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ install: - pip install cython - pip install --upgrade numpy - pip install -r dev_requirements.txt + - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -r requirements-2.6.txt; fi - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - tar -xf py2cairo-1.10.0.tar.bz2 - pushd py2cairo-1.10.0 From f5d31d48607a8f1ae05a180fd98ae4b656c69f4b Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 00:21:44 +0000 Subject: [PATCH 58/68] build cairo when using venv with site-packages --- .travis.yml | 11 ++--------- .travis_before_install | 8 ++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64ea60eb0..1704efd98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ python: - 2.6 before_install: - sudo apt-get update - # For Python 2.7, install PyQt4 + # For Python 2.7, install PyQt4 and cairo - if [[ $TRAVIS_PYTHON_VERSION == '2.7_with_system_site_packages' ]]; then source .travis_before_install; fi - # PyQt can't be installed on 2.6; run the tests without Qt + # PyQt and cairo can't be installed on 2.6; run the tests without Qt - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then source .travis_before_install_noqt; fi - sudo apt-get install swig # Simlinks for PIL compilation @@ -20,13 +20,6 @@ install: - pip install --upgrade numpy - pip install -r dev_requirements.txt - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -r requirements-2.6.txt; fi - - wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 - - tar -xf py2cairo-1.10.0.tar.bz2 - - pushd py2cairo-1.10.0 - - ./waf configure - - ./waf build - - sudo ./waf install - - popd - pip install coveralls - python setup.py develop script: diff --git a/.travis_before_install b/.travis_before_install index 74980b61c..9d7c01df4 100644 --- a/.travis_before_install +++ b/.travis_before_install @@ -9,4 +9,12 @@ python -c 'import PyQt4' python -c 'import PyQt4.QtCore' python -c 'import PyQt4.QtGui' +wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 +tar -xf py2cairo-1.10.0.tar.bz2 +pushd py2cairo-1.10.0 +,/waf configure +./waf build +sudo ./waf install +popd + export ETS_TOOLKIT=qt4 \ No newline at end of file From a1f35c598203f8ce16e025eef9e11a5f9d509a5f Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 00:22:08 +0000 Subject: [PATCH 59/68] skip cairo tests when cairo is not importable --- kiva/tests/test_cairo_drawing.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kiva/tests/test_cairo_drawing.py b/kiva/tests/test_cairo_drawing.py index 9d0fdc194..fd82845b5 100644 --- a/kiva/tests/test_cairo_drawing.py +++ b/kiva/tests/test_cairo_drawing.py @@ -1,11 +1,19 @@ from kiva.tests.drawing_tester import DrawingImageTester -from kiva.cairo import GraphicsContext from traits.testing.unittest_tools import unittest +try: + import cairo # noqa +except ImportError: + CAIRO_NOT_AVAILABLE = True +else: + CAIRO_NOT_AVAILABLE = False + +@unittest.skipIf(CAIRO_NOT_AVAILABLE, "Cannot import cairo") class TestCairoDrawing(DrawingImageTester, unittest.TestCase): def create_graphics_context(self, width, height): + from kiva.cairo import GraphicsContext return GraphicsContext((width, height)) From 707a45b09c9413e8dd8b39ca68edaf0025e8d250 Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 00:34:02 +0000 Subject: [PATCH 60/68] skip tests when requirements are not available --- kiva/tests/test_pdf_drawing.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index e6f106300..58cce5228 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -1,16 +1,30 @@ import contextlib -import PyPDF2 # Tests require the PyPDF2 library for parsing the pdf stream -from reportlab.pdfgen.canvas import Canvas - from kiva.tests.drawing_tester import DrawingTester -from kiva.pdf import GraphicsContext from traits.testing.unittest_tools import unittest +try: + import PyPDF2 # Tests require the PyPDF2 library. +except ImportError: + PYPDF2_NOT_AVAILABLE = True +else: + PYPDF2_NOT_AVAILABLE = False + +try: + import reportlab # noqa +except ImportError: + REPORTLAB_NOT_AVAILABLE = True +else: + REPORTLAB_NOT_AVAILABLE = False + +@unittest.skipIf(PYPDF2_NOT_AVAILABLE, "PDF tests require PyPDF2") class TestPDFDrawing(DrawingTester, unittest.TestCase): + @unittest.skipIf(REPORTLAB_NOT_AVAILABLE, "Cannot import reportlab") def create_graphics_context(self, width, height): + from reportlab.pdfgen.canvas import Canvas + from kiva.pdf import GraphicsContext filename = "{0}.pdf".format(self.filename) canvas = Canvas(filename, (width, height)) return GraphicsContext(canvas) From 137798e0074ca78c1c130c6d3a8b627e2d50adb0 Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 08:15:53 +0000 Subject: [PATCH 61/68] fix typo --- .travis_before_install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis_before_install b/.travis_before_install index 9d7c01df4..77ce13d54 100644 --- a/.travis_before_install +++ b/.travis_before_install @@ -12,7 +12,7 @@ python -c 'import PyQt4.QtGui' wget -nv http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 tar -xf py2cairo-1.10.0.tar.bz2 pushd py2cairo-1.10.0 -,/waf configure +./waf configure ./waf build sudo ./waf install popd From 6132a9e2049919a5116728b44e66992e1acb1e64 Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 08:26:46 +0000 Subject: [PATCH 62/68] add more skipif cases --- kiva/tests/test_gl_drawing.py | 10 +++++++++- kiva/tests/test_qpainter_drawing.py | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 2f2eb1e53..cd720e62e 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -1,6 +1,13 @@ import contextlib -import pyglet +try: + import pyglet +except ImportError: + PYGLET_NOT_AVAILABLE = True +else: + PYGLET_NOT_AVAILABLE = False + + from pyglet.image.codecs.png import PNGImageEncoder from kiva.tests.drawing_tester import DrawingImageTester @@ -8,6 +15,7 @@ from traits.testing.unittest_tools import unittest +@unittest.skipIf(PYGLET_NOT_AVAILABLE, "Cannot import pyglet") class TestGLDrawing(DrawingImageTester, unittest.TestCase): def tearDown(self): diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py index 82cdfb52c..89913b274 100644 --- a/kiva/tests/test_qpainter_drawing.py +++ b/kiva/tests/test_qpainter_drawing.py @@ -1,10 +1,16 @@ -from pyface.qt import QtGui +try: + from pyface.qt import QtGui +except ImportError: + QT_NOT_AVAILABLE = True +else: + QT_NOT_AVAILABLE = False from kiva.tests.drawing_tester import DrawingImageTester from kiva.qpainter import GraphicsContext from traits.testing.unittest_tools import unittest +@unittest.skipIf(QT_NOT_AVAILABLE, "Cannot import qt") class TestQPainterDrawing(DrawingImageTester, unittest.TestCase): def setUp(self): From ab0b4f8aeb09133346230c026b828ccaa20c454c Mon Sep 17 00:00:00 2001 From: itziakos Date: Fri, 28 Nov 2014 10:16:37 +0000 Subject: [PATCH 63/68] place imports inside the function to avoid import errors when requirements are not available --- kiva/tests/test_gl_drawing.py | 2 +- kiva/tests/test_qpainter_drawing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index cd720e62e..7ac77e5bc 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -11,7 +11,6 @@ from pyglet.image.codecs.png import PNGImageEncoder from kiva.tests.drawing_tester import DrawingImageTester -from kiva.gl import GraphicsContext from traits.testing.unittest_tools import unittest @@ -25,6 +24,7 @@ def tearDown(self): DrawingImageTester.tearDown(self) def create_graphics_context(self, width, height): + from kiva.gl import GraphicsContext self.window = pyglet.window.Window(width=width, height=height) gc = GraphicsContext((width, height)) gc.gl_init() diff --git a/kiva/tests/test_qpainter_drawing.py b/kiva/tests/test_qpainter_drawing.py index 89913b274..19149ff11 100644 --- a/kiva/tests/test_qpainter_drawing.py +++ b/kiva/tests/test_qpainter_drawing.py @@ -6,7 +6,6 @@ QT_NOT_AVAILABLE = False from kiva.tests.drawing_tester import DrawingImageTester -from kiva.qpainter import GraphicsContext from traits.testing.unittest_tools import unittest @@ -23,6 +22,7 @@ def setUp(self): DrawingImageTester.setUp(self) def create_graphics_context(self, width, height): + from kiva.qpainter import GraphicsContext return GraphicsContext((width, height)) From 012bba56592eba4fd213dfc385a06bcb3563539d Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 12 Dec 2014 15:57:30 +0000 Subject: [PATCH 64/68] Update CHANGES.txt --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index a75c9b4d8..e96db21c8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,7 +8,7 @@ Enhancements ------------ * Added a base class for drag and drop tools, example and test support. - + * PR #160 Basic testing for kiva backends. Enable 4.4.0 (May 1, 2014) From 66f1e7abdbd98535b6a982603a9974be30c1484f Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 12 Dec 2014 15:57:50 +0000 Subject: [PATCH 65/68] [ci-skip] --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index e96db21c8..c3071f728 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,7 +8,7 @@ Enhancements ------------ * Added a base class for drag and drop tools, example and test support. - * PR #160 Basic testing for kiva backends. + * PR #160: Basic testing for kiva backends. Enable 4.4.0 (May 1, 2014) From 229415e12872c8497f5311655bebc122f758a748 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 12 Dec 2014 18:31:15 +0000 Subject: [PATCH 66/68] cleanup tests --- kiva/tests/test_agg_drawing.py | 3 --- kiva/tests/test_gl_drawing.py | 4 ++-- kiva/tests/test_pdf_drawing.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/kiva/tests/test_agg_drawing.py b/kiva/tests/test_agg_drawing.py index c348a771d..154f523f9 100644 --- a/kiva/tests/test_agg_drawing.py +++ b/kiva/tests/test_agg_drawing.py @@ -5,9 +5,6 @@ class TestAggDrawing(DrawingImageTester, unittest.TestCase): - def setUp(self): - DrawingImageTester.setUp(self) - def create_graphics_context(self, width, height): return GraphicsContext((width, height)) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index 7ac77e5bc..fb296a40c 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -8,8 +8,6 @@ PYGLET_NOT_AVAILABLE = False -from pyglet.image.codecs.png import PNGImageEncoder - from kiva.tests.drawing_tester import DrawingImageTester from traits.testing.unittest_tools import unittest @@ -42,6 +40,8 @@ def test_text_clip(self): @contextlib.contextmanager def draw_and_check(self): + from pyglet.image.codecs.png import PNGImageEncoder + self.window.clear() self.window.switch_to() self.window.dispatch_events() diff --git a/kiva/tests/test_pdf_drawing.py b/kiva/tests/test_pdf_drawing.py index 58cce5228..8a94c5664 100644 --- a/kiva/tests/test_pdf_drawing.py +++ b/kiva/tests/test_pdf_drawing.py @@ -19,9 +19,9 @@ @unittest.skipIf(PYPDF2_NOT_AVAILABLE, "PDF tests require PyPDF2") +@unittest.skipIf(REPORTLAB_NOT_AVAILABLE, "Cannot import reportlab") class TestPDFDrawing(DrawingTester, unittest.TestCase): - @unittest.skipIf(REPORTLAB_NOT_AVAILABLE, "Cannot import reportlab") def create_graphics_context(self, width, height): from reportlab.pdfgen.canvas import Canvas from kiva.pdf import GraphicsContext From b1fb165e7fb0c1234aee3a5b173c1ae01fd48da9 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 12 Dec 2014 18:38:36 +0000 Subject: [PATCH 67/68] Update test_gl_drawing.py --- kiva/tests/test_gl_drawing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index fb296a40c..e133ac223 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -28,7 +28,7 @@ def create_graphics_context(self, width, height): gc.gl_init() return gc - @unittest.skip("gl graphics context does not support start_clip") + @unittest.skip("gl graphics context does not support star_clip (#164)") def test_star_clip(self): # FIXME: overriding test since it segfaults DrawingImageTester.test_star_clip(self) From 70edcee5e3b381e43ef002768f16de1722409ec9 Mon Sep 17 00:00:00 2001 From: Ioannis Tziakos Date: Fri, 12 Dec 2014 18:41:49 +0000 Subject: [PATCH 68/68] Update test_gl_drawing.py --- kiva/tests/test_gl_drawing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiva/tests/test_gl_drawing.py b/kiva/tests/test_gl_drawing.py index e133ac223..783e112ac 100644 --- a/kiva/tests/test_gl_drawing.py +++ b/kiva/tests/test_gl_drawing.py @@ -35,7 +35,7 @@ def test_star_clip(self): @unittest.expectedFailure def test_text_clip(self): - # gl graphics context does not clip text properly + # gl graphics context does not clip text properly (#165). DrawingImageTester.test_text_clip(self) @contextlib.contextmanager