Skip to content

Commit f487c99

Browse files
committed
add test for the new --keep-cvar option to toggle cvar table removal off
1 parent 1e902bb commit f487c99

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/test_main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,33 @@ def test_default_run_opensans_vf():
148148
shutil.rmtree(test_dir)
149149

150150

151+
def test_default_run_opensans_vf_keep_cvar():
152+
"""This is used to test cvar table removal in a var font"""
153+
test_dir = os.path.join("tests", "test_files", "fonts", "temp")
154+
notouch_inpath = os.path.join("tests", "test_files", "fonts", "OpenSans-VF.ttf")
155+
test_inpath = os.path.join("tests", "test_files", "fonts", "temp", "OpenSans.ttf")
156+
test_outpath = os.path.join(
157+
"tests", "test_files", "fonts", "temp", "OpenSans-dehinted.ttf"
158+
)
159+
test_args = [test_inpath, "--keep-cvar"]
160+
161+
# setup
162+
if os.path.isdir(test_dir):
163+
shutil.rmtree(test_dir)
164+
os.mkdir(test_dir)
165+
shutil.copyfile(notouch_inpath, test_inpath)
166+
167+
# execute
168+
run(test_args)
169+
170+
# test
171+
font_validator(test_outpath)
172+
assert "cvar" in TTFont(test_outpath)
173+
174+
# tear down
175+
shutil.rmtree(test_dir)
176+
177+
151178
def test_run_roboto_keep_cvt():
152179
test_dir = os.path.join("tests", "test_files", "fonts", "temp")
153180
notouch_inpath = os.path.join("tests", "test_files", "fonts", "Roboto-Regular.ttf")

0 commit comments

Comments
 (0)