Make simpler test in cffLib tests

This commit is contained in:
Nikolaus Waxweiler 2019-02-05 14:33:58 +00:00
parent 3011f3b7d4
commit e50733df21
2 changed files with 17 additions and 16 deletions

View File

@ -2,6 +2,8 @@ from __future__ import print_function, division, absolute_import
from fontTools.cffLib import TopDict, PrivateDict, CharStrings
from fontTools.misc.testTools import parseXML, DataFilesHandler
from fontTools.ttLib import TTFont
import copy
import os
import sys
import unittest
@ -59,6 +61,21 @@ class CffLibTest(DataFilesHandler):
topDict2 = font2["CFF "].cff.topDictIndex[0]
self.assertEqual(topDict2.Encoding[32], "space")
def test_CFF_deepcopy(self):
"""Test that deepcopying a TTFont with a CFF table does not recurse
infinitely."""
ttx_path = os.path.join(
os.path.dirname(__file__),
"..",
"varLib",
"data",
"master_ttx_interpolatable_otf",
"TestFamily2-Master0.ttx",
)
font = TTFont(recalcBBoxes=False, recalcTimestamp=False)
font.importXML(ttx_path)
copy.deepcopy(font)
if __name__ == "__main__":
sys.exit(unittest.main())

View File

@ -162,22 +162,6 @@ class InterpolateLayoutTest(unittest.TestCase):
with self.assertRaisesRegex(DesignSpaceDocumentError, "No axes defined"):
instfont = interpolate_layout(ds_path, {'weight': 500})
def test_varlib_interpolate_layout_GSUB_only_otf(self):
"""A smoke-test for layout-interpolating of OTFs."""
ds_path = self.get_test_input('InterpolateLayout.designspace')
ds = DesignSpaceDocument.fromfile(ds_path)
ttx_dir = self.get_test_input('master_ttx_interpolatable_otf')
self.temp_dir()
ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily2-')
for path, source in zip(ttx_paths, ds.sources):
font = TTFont(recalcBBoxes=False, recalcTimestamp=False)
font.importXML(path)
source.font = font
finder = lambda s: s
instfont = interpolate_layout(ds, {'weight': 500}, finder)
def test_varlib_interpolate_layout_GPOS_only_size_feat_same_val_ttf(self):
"""Only GPOS; 'size' feature; same values in all masters.
"""