From 283e704d4ee4d59462cba8ab7f19723c5b9395b3 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 13 Oct 2021 15:47:21 +0100 Subject: [PATCH] Add extrema test --- tests/filters/addExtrema_test.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/filters/addExtrema_test.py diff --git a/tests/filters/addExtrema_test.py b/tests/filters/addExtrema_test.py new file mode 100644 index 000000000..f1e751108 --- /dev/null +++ b/tests/filters/addExtrema_test.py @@ -0,0 +1,24 @@ +from ufo2ft.filters.addExtrema import AddExtremaFilter + + +class AddExtremaFilterTest: + def test_add_extrema_O(self, FontClass): + ufo = FontClass() + a = ufo.newGlyph("O") + a.width = 300 + pen = a.getPen() + pen.moveTo((150, 0)) + pen.curveTo((249, 0), (249, 150), (150, 150)) + pen.curveTo((52, 150), (52, 0), (150, 0)) + pen.closePath() + + contour = ufo["O"][0] + assert len(contour) == 6 + + filter_ = AddExtremaFilter() + + assert filter_(ufo) + + contour = ufo["O"][0] + assert len(contour) == 12 + ufo.save("t.ufo")