1313# Integration tests
1414#
1515
16+
1617def font_validator (filepath ):
1718 assert os .path .exists (filepath )
1819 tt = TTFont (filepath )
@@ -29,7 +30,7 @@ def font_validator(filepath):
2930 assert not hasattr (glyph , "program" )
3031 if hasattr (glyph , "program" ):
3132 assert glyph .program .bytecode == array .array ("B" , [])
32- assert tt ["gasp" ].gaspRange == {65535 : 15 }
33+ assert tt ["gasp" ].gaspRange == {65535 : 0x000A }
3334 assert tt ["maxp" ].maxZones == 0
3435 assert tt ["maxp" ].maxTwilightPoints == 0
3536 assert tt ["maxp" ].maxStorage == 0
@@ -41,8 +42,12 @@ def font_validator(filepath):
4142def test_default_run_roboto ():
4243 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
4344 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
44- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
45- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
45+ test_inpath = os .path .join (
46+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
47+ )
48+ test_outpath = os .path .join (
49+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
50+ )
4651 test_args = [test_inpath ]
4752
4853 # setup
@@ -63,9 +68,15 @@ def test_default_run_roboto():
6368
6469def test_default_run_noto ():
6570 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
66- notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf" )
67- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
68- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf" )
71+ notouch_inpath = os .path .join (
72+ "tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf"
73+ )
74+ test_inpath = os .path .join (
75+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
76+ )
77+ test_outpath = os .path .join (
78+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf"
79+ )
6980 test_args = [test_inpath ]
7081
7182 # setup
@@ -88,8 +99,12 @@ def test_default_run_ubuntu():
8899 """This is used to test VDMX table removal"""
89100 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
90101 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Ubuntu-Regular.ttf" )
91- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular.ttf" )
92- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular-dehinted.ttf" )
102+ test_inpath = os .path .join (
103+ "tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular.ttf"
104+ )
105+ test_outpath = os .path .join (
106+ "tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular-dehinted.ttf"
107+ )
93108 test_args = [test_inpath ]
94109
95110 # setup
@@ -111,8 +126,12 @@ def test_default_run_ubuntu():
111126def test_run_roboto_keep_cvt ():
112127 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
113128 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
114- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
115- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
129+ test_inpath = os .path .join (
130+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
131+ )
132+ test_outpath = os .path .join (
133+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
134+ )
116135 test_args = [test_inpath , "--keep-cvt" ]
117136
118137 # setup
@@ -135,8 +154,12 @@ def test_run_roboto_keep_cvt():
135154def test_run_roboto_keep_fpgm ():
136155 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
137156 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
138- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
139- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
157+ test_inpath = os .path .join (
158+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
159+ )
160+ test_outpath = os .path .join (
161+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
162+ )
140163 test_args = [test_inpath , "--keep-fpgm" ]
141164
142165 # setup
@@ -159,8 +182,12 @@ def test_run_roboto_keep_fpgm():
159182def test_run_roboto_keep_hdmx ():
160183 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
161184 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
162- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
163- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
185+ test_inpath = os .path .join (
186+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
187+ )
188+ test_outpath = os .path .join (
189+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
190+ )
164191 test_args = [test_inpath , "--keep-hdmx" ]
165192
166193 # setup
@@ -183,8 +210,12 @@ def test_run_roboto_keep_hdmx():
183210def test_run_roboto_keep_ltsh ():
184211 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
185212 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
186- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
187- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
213+ test_inpath = os .path .join (
214+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
215+ )
216+ test_outpath = os .path .join (
217+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
218+ )
188219 test_args = [test_inpath , "--keep-ltsh" ]
189220
190221 # setup
@@ -207,8 +238,12 @@ def test_run_roboto_keep_ltsh():
207238def test_run_roboto_keep_prep ():
208239 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
209240 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
210- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
211- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
241+ test_inpath = os .path .join (
242+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
243+ )
244+ test_outpath = os .path .join (
245+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
246+ )
212247 test_args = [test_inpath , "--keep-prep" ]
213248
214249 # setup
@@ -230,9 +265,15 @@ def test_run_roboto_keep_prep():
230265
231266def test_run_noto_keep_ttfa (): # this has to be tested in Noto as it contains a TTFA table
232267 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
233- notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf" )
234- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
235- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf" )
268+ notouch_inpath = os .path .join (
269+ "tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf"
270+ )
271+ test_inpath = os .path .join (
272+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
273+ )
274+ test_outpath = os .path .join (
275+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf"
276+ )
236277 test_args = [test_inpath , "--keep-ttfa" ]
237278
238279 # setup
@@ -256,8 +297,12 @@ def test_default_run_ubuntu_keep_vdmx():
256297 """This is used to test VDMX table removal"""
257298 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
258299 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Ubuntu-Regular.ttf" )
259- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular.ttf" )
260- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular-dehinted.ttf" )
300+ test_inpath = os .path .join (
301+ "tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular.ttf"
302+ )
303+ test_outpath = os .path .join (
304+ "tests" , "test_files" , "fonts" , "temp" , "Ubuntu-Regular-dehinted.ttf"
305+ )
261306 test_args = [test_inpath , "--keep-vdmx" ]
262307
263308 # setup
@@ -280,8 +325,12 @@ def test_default_run_ubuntu_keep_vdmx():
280325def test_run_roboto_keep_glyf ():
281326 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
282327 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
283- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
284- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
328+ test_inpath = os .path .join (
329+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
330+ )
331+ test_outpath = os .path .join (
332+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
333+ )
285334 test_args = [test_inpath , "--keep-glyf" ]
286335
287336 # setup
@@ -305,8 +354,12 @@ def test_run_roboto_keep_glyf():
305354def test_run_roboto_keep_gasp ():
306355 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
307356 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
308- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
309- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
357+ test_inpath = os .path .join (
358+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
359+ )
360+ test_outpath = os .path .join (
361+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
362+ )
310363 test_args = [test_inpath , "--keep-gasp" ]
311364
312365 # setup
@@ -328,9 +381,15 @@ def test_run_roboto_keep_gasp():
328381
329382def test_run_noto_keep_maxp ():
330383 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
331- notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf" )
332- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
333- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf" )
384+ notouch_inpath = os .path .join (
385+ "tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf"
386+ )
387+ test_inpath = os .path .join (
388+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
389+ )
390+ test_outpath = os .path .join (
391+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehinted.ttf"
392+ )
334393 test_args = [test_inpath , "--keep-maxp" ]
335394
336395 # setup
@@ -358,8 +417,12 @@ def test_run_noto_keep_maxp():
358417def test_run_roboto_keep_head ():
359418 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
360419 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
361- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
362- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf" )
420+ test_inpath = os .path .join (
421+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
422+ )
423+ test_outpath = os .path .join (
424+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehinted.ttf"
425+ )
363426 test_args = [test_inpath , "--keep-head" ]
364427
365428 # setup
@@ -382,8 +445,12 @@ def test_run_roboto_keep_head():
382445def test_run_with_outfile_path_roboto ():
383446 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
384447 notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "Roboto-Regular.ttf" )
385- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf" )
386- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehintilio.ttf" )
448+ test_inpath = os .path .join (
449+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular.ttf"
450+ )
451+ test_outpath = os .path .join (
452+ "tests" , "test_files" , "fonts" , "temp" , "Roboto-Regular-dehintilio.ttf"
453+ )
387454 test_args = [test_inpath , "--out" , test_outpath ]
388455
389456 # setup
@@ -404,9 +471,15 @@ def test_run_with_outfile_path_roboto():
404471
405472def test_run_with_outfile_path_noto ():
406473 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
407- notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf" )
408- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
409- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehintilio.ttf" )
474+ notouch_inpath = os .path .join (
475+ "tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf"
476+ )
477+ test_inpath = os .path .join (
478+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
479+ )
480+ test_outpath = os .path .join (
481+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular-dehintilio.ttf"
482+ )
410483 test_args = [test_inpath , "-o" , test_outpath ]
411484
412485 # setup
@@ -429,6 +502,7 @@ def test_run_with_outfile_path_noto():
429502# Validation error testing
430503#
431504
505+
432506def test_run_with_invalid_filepath ():
433507 with pytest .raises (SystemExit ):
434508 run (["bogusfile.txt" ])
@@ -441,9 +515,15 @@ def test_run_with_non_font_file():
441515
442516def test_run_dehinted_file_write_inplace ():
443517 test_dir = os .path .join ("tests" , "test_files" , "fonts" , "temp" )
444- notouch_inpath = os .path .join ("tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf" )
445- test_inpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
446- test_outpath = os .path .join ("tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf" )
518+ notouch_inpath = os .path .join (
519+ "tests" , "test_files" , "fonts" , "NotoSans-Regular.ttf"
520+ )
521+ test_inpath = os .path .join (
522+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
523+ )
524+ test_outpath = os .path .join (
525+ "tests" , "test_files" , "fonts" , "temp" , "NotoSans-Regular.ttf"
526+ )
447527 test_args = [test_inpath , "-o" , test_outpath ]
448528
449529 # setup
0 commit comments