Skip to content

Commit

Permalink
Update words unit test (modern hinting doesn't change glyph positions…
Browse files Browse the repository at this point in the history
… anymore)
  • Loading branch information
scotty007 committed Sep 3, 2020
1 parent 2af581a commit 3fc1a1b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/test/WordsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,24 @@ def checkPositions():
hint = root.getChild(1)
posNoHint = noHint.getGlyphPos(6)
posHint = hint.getGlyphPos(6)
self.assertNotEqual(posNoHint, posHint)
self.assertEqual(posNoHint, posHint)
noHint.hint = True
hint.hint = False
self.assertEqual(posNoHint, hint.getGlyphPos(6))
self.assertEqual(posHint, noHint.getGlyphPos(6))

if platform.system() == "Linux":
self.skip("Linux support requires modified font config")
else:
root = self.loadEmptyScene()
avg.WordsNode(pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
variant="roman", hint=False, text="Lorem ipsum dolor (no hinting)",
parent=root)
avg.WordsNode(pos=(1,15), fontsize=12, font="Bitstream Vera Sans",
variant="roman", hint=True, text="Lorem ipsum dolor (hinting)",
parent=root)
self.start(True, [checkPositions])
self.assertEqual(posHint, hint.getGlyphPos(6))
self.assertEqual(posNoHint, noHint.getGlyphPos(6))

root = self.loadEmptyScene()
avg.WordsNode(pos=(1,1), fontsize=12, font="Bitstream Vera Sans",
variant="roman", hint=False, text="Lorem ipsum dolor (no hinting)",
parent=root)
avg.WordsNode(pos=(1,15), fontsize=12, font="Bitstream Vera Sans",
variant="roman", hint=True, text="Lorem ipsum dolor (hinting)",
parent=root)
self.start(True,
(lambda: self.compareImage("testHinting1"),
checkPositions, # toggles hinting
lambda: self.compareImage("testHinting2"),
))

def testSpanWords(self):
def setTextAttrib():
Expand Down
Binary file modified src/test/baseline/testHinting1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/test/baseline/testHinting2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3fc1a1b

Please sign in to comment.