From 3c59ffda5eebddae42bc63114a581e9329a4c1ff Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 11 Sep 2018 18:33:53 +0200 Subject: [PATCH] Test: raise DesignSpaceDocumentError when no axes defined --- Tests/varLib/interpolate_layout_test.py | 20 +++----------------- Tests/varLib/varLib_test.py | 10 ++++------ 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/Tests/varLib/interpolate_layout_test.py b/Tests/varLib/interpolate_layout_test.py index 6f6efe061..00039295c 100644 --- a/Tests/varLib/interpolate_layout_test.py +++ b/Tests/varLib/interpolate_layout_test.py @@ -4,6 +4,7 @@ from fontTools.ttLib import TTFont from fontTools.varLib import build from fontTools.varLib.interpolate_layout import interpolate_layout from fontTools.varLib.interpolate_layout import main as interpolate_layout_main +from fontTools.designspaceLib import DesignSpaceDocumentError from fontTools.feaLib.builder import addOpenTypeFeaturesFromString import difflib import os @@ -157,24 +158,9 @@ class InterpolateLayoutTest(unittest.TestCase): The variable font will inherit the GSUB table from the base master. """ - suffix = '.ttf' ds_path = self.get_test_input('InterpolateLayout3.designspace') - ufo_dir = self.get_test_input('master_ufo') - ttx_dir = self.get_test_input('master_ttx_interpolatable_ttf') - - self.temp_dir() - ttx_paths = self.get_file_list(ttx_dir, '.ttx', 'TestFamily2-') - for path in ttx_paths: - self.compile_font(path, suffix, self.tempdir) - - finder = lambda s: s.replace(ufo_dir, self.tempdir).replace('.ufo', suffix) - instfont = interpolate_layout(ds_path, {'weight': 500}, finder) - - tables = ['GSUB'] - expected_ttx_path = self.get_test_output('InterpolateLayout.ttx') - self.expect_ttx(instfont, expected_ttx_path, tables) - self.check_ttx_dump(instfont, expected_ttx_path, tables, suffix) - + with self.assertRaisesRegex(DesignSpaceDocumentError, "No axes defined"): + instfont = interpolate_layout(ds_path, {'weight': 500}) def test_varlib_interpolate_layout_GPOS_only_size_feat_same_val_ttf(self): """Only GPOS; 'size' feature; same values in all masters. diff --git a/Tests/varLib/varLib_test.py b/Tests/varLib/varLib_test.py index 12c4874d7..05b4ef38f 100644 --- a/Tests/varLib/varLib_test.py +++ b/Tests/varLib/varLib_test.py @@ -3,6 +3,7 @@ from fontTools.misc.py23 import * from fontTools.ttLib import TTFont from fontTools.varLib import build from fontTools.varLib import main as varLib_main +from fontTools.designspaceLib import DesignSpaceDocumentError import difflib import os import shutil @@ -126,12 +127,9 @@ class BuildTest(unittest.TestCase): def test_varlib_build_no_axes_ttf(self): """Designspace file does not contain an element.""" - self._run_varlib_build_test( - designspace_name='InterpolateLayout3', - font_name='TestFamily2', - tables=['GDEF', 'HVAR', 'MVAR', 'fvar', 'gvar'], - expected_ttx_name='Build3' - ) + ds_path = self.get_test_input('InterpolateLayout3.designspace') + with self.assertRaisesRegex(DesignSpaceDocumentError, "No axes defined"): + build(ds_path) def test_varlib_avar_single_axis(self): """Designspace file contains a 'weight' axis with elements