From ae46f22e28d14c63d1e82abdf9767ee140fa1ab6 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Wed, 12 May 2021 19:00:29 +0100 Subject: [PATCH 1/2] Leave guidelines alone when at x or y = 0 --- src/ufonormalizer/__init__.py | 4 ++-- tests/test_ufonormalizer.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ufonormalizer/__init__.py b/src/ufonormalizer/__init__.py index d891773..1f16a99 100644 --- a/src/ufonormalizer/__init__.py +++ b/src/ufonormalizer/__init__.py @@ -524,9 +524,9 @@ def _normalizeDictGuideline(guideline): # The spec was ambiguous about y=0 or x=0, so don't raise an error here, # instead, or are allowed, and the 0 becomes None. if angle is None: - if x == 0: + if x == 0 and y is not None: x = None - if y == 0: + if y == 0 and x is not None: y = None # either x or y must be defined if x is None and y is None: diff --git a/tests/test_ufonormalizer.py b/tests/test_ufonormalizer.py index 09dbcd4..4589f80 100644 --- a/tests/test_ufonormalizer.py +++ b/tests/test_ufonormalizer.py @@ -710,6 +710,13 @@ def test_normalizeFontInfoPlist_guidelines_vertical_y_is_zero(self): _normalizeGlifGuideline(element, writer) self.assertEqual(writer.getText(), '') + def test_normalizeFontInfoPlist_guidelines_vertical_y_is_zero2(self): + # Actually a vertical guide + element = ET.fromstring("") + writer = XMLWriter(declaration=None) + _normalizeGlifGuideline(element, writer) + self.assertEqual(writer.getText(), '') + def test_normalizeFontInfoPlist_guidelines_horizontal_x_is_zero(self): # Actually an horizontal guide element = ET.fromstring("") @@ -717,6 +724,13 @@ def test_normalizeFontInfoPlist_guidelines_horizontal_x_is_zero(self): _normalizeGlifGuideline(element, writer) self.assertEqual(writer.getText(), '') + def test_normalizeFontInfoPlist_guidelines_horizontal_x_is_zero2(self): + # Actually an horizontal guide + element = ET.fromstring("") + writer = XMLWriter(declaration=None) + _normalizeGlifGuideline(element, writer) + self.assertEqual(writer.getText(), '') + def test_normalizeGLIF_lib_defined(self): e = ''' From 2afb3a3ee00202b2f84b840ae4ce3dd5be3fedf0 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Thu, 13 May 2021 08:27:13 +0100 Subject: [PATCH 2/2] Try and unbreak coveralls --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7c54bbd..bebf1ab 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -47,4 +47,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | coverage run setup.py test - coveralls + coveralls --service=github