[ttGlyphPen_test] add test for decomposeOverflowingTransform=False

This commit is contained in:
Cosimo Lupo 2018-03-01 20:10:32 +00:00
parent 56be13915b
commit 6ce8eec89c
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -3,6 +3,7 @@ from fontTools.misc.py23 import *
import os
import unittest
import struct
from fontTools import ttLib
from fontTools.misc.testTools import TestCase
@ -217,6 +218,27 @@ class TTGlyphPenTest(TestCase):
self.assertEqual(expectedGlyph, compositeGlyph)
def test_no_decompose_overflowing_transform(self):
componentName = 'a'
glyphSet = {}
pen = TTGlyphPen(glyphSet, decomposeOverflowingTransform=False)
pen.moveTo((0, 0))
pen.lineTo((0, 1))
pen.lineTo((1, 0))
pen.closePath()
baseGlyph = pen.glyph()
glyphSet[componentName] = _TestGlyph(baseGlyph)
pen.addComponent(componentName, (3, 0, 0, 1, 0, 0))
compositeGlyph = pen.glyph()
self.assertEqual(compositeGlyph.components[0].transform,
((3, 0), (0, 1)))
with self.assertRaises(struct.error):
compositeGlyph.compile({'a': baseGlyph})
class _TestGlyph(object):
def __init__(self, glyph):