[tests] make tests work when ft isn't present
This commit is contained in:
parent
c4b6bad73a
commit
43e3ab019c
|
@ -5,6 +5,11 @@ subdir('data/text-rendering-tests') # text_rendering_tests
|
|||
|
||||
shaping_run_tests_py = find_program('run-tests.py')
|
||||
|
||||
env = environment()
|
||||
if conf.get('HAVE_FREETYPE', 0) == 0
|
||||
env.set('no_ft_funcs', '1')
|
||||
endif
|
||||
|
||||
foreach file_name : in_house_tests
|
||||
test_name = file_name.split('.')[0].underscorify()
|
||||
|
||||
|
@ -13,6 +18,7 @@ foreach file_name : in_house_tests
|
|||
hb_shape,
|
||||
meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name,
|
||||
],
|
||||
env: env,
|
||||
workdir: meson.current_build_dir() / '..' / '..',
|
||||
suite: ['shaping', 'in-house'],
|
||||
)
|
||||
|
@ -26,6 +32,7 @@ foreach file_name : aots_tests
|
|||
hb_shape,
|
||||
meson.current_source_dir() / 'data' / 'aots' / 'tests' / file_name,
|
||||
],
|
||||
env: env,
|
||||
workdir: meson.current_build_dir() / '..' / '..',
|
||||
suite: ['shaping', 'aots'],
|
||||
)
|
||||
|
@ -39,6 +46,7 @@ foreach file_name : text_rendering_tests
|
|||
hb_shape,
|
||||
meson.current_source_dir() / 'data' / 'text-rendering-tests' / 'tests' / file_name,
|
||||
],
|
||||
env: env,
|
||||
workdir: meson.current_build_dir() / '..' / '..',
|
||||
suite: ['shaping', 'text-rendering-tests'],
|
||||
)
|
||||
|
|
|
@ -15,6 +15,8 @@ if len (args) and args[0] == "--reference":
|
|||
reference = True
|
||||
args = args[1:]
|
||||
|
||||
no_ft_funcs = bool(int(os.getenv('no_ft_funcs', '0')))
|
||||
|
||||
if not args or args[0].find('hb-shape') == -1 or not os.path.exists (args[0]):
|
||||
sys.exit ("""First argument does not seem to point to usable hb-shape.""")
|
||||
hb_shape, args = args[0], args[1:]
|
||||
|
@ -59,6 +61,7 @@ for filename in args:
|
|||
continue
|
||||
|
||||
fontfile, options, unicodes, glyphs_expected = line.split (":")
|
||||
options = options.split ()
|
||||
if fontfile.startswith ('/') or fontfile.startswith ('"/'):
|
||||
if os.name == 'nt': # Skip on Windows
|
||||
continue
|
||||
|
@ -100,13 +103,15 @@ for filename in args:
|
|||
shutil.copyfile(fontfile, new_fontfile)
|
||||
fontfile = new_fontfile
|
||||
|
||||
glyphs1 = cmd ([hb_shape, "--font-funcs=ft",
|
||||
fontfile] + extra_options + ["--unicodes",
|
||||
unicodes] + (options.split (' ') if options else []))
|
||||
if "--font-funcs=ft" in options and no_ft_funcs:
|
||||
skips += 1
|
||||
continue
|
||||
|
||||
glyphs2 = cmd ([hb_shape, "--font-funcs=ot",
|
||||
fontfile] + extra_options + ["--unicodes",
|
||||
unicodes] + (options.split (' ') if options else []))
|
||||
if "--font-funcs=ot" in options or no_ft_funcs:
|
||||
glyphs1 = cmd ([hb_shape, "--font-funcs=ot", fontfile] + extra_options + ["--unicodes", unicodes] + options)
|
||||
else:
|
||||
glyphs1 = cmd ([hb_shape, "--font-funcs=ft", fontfile] + extra_options + ["--unicodes", unicodes] + options)
|
||||
glyphs2 = cmd ([hb_shape, "--font-funcs=ot", fontfile] + extra_options + ["--unicodes", unicodes] + options)
|
||||
|
||||
if glyphs1 != glyphs2 and glyphs_expected != '*':
|
||||
print ("FT funcs: " + glyphs1, file=sys.stderr)
|
||||
|
@ -116,7 +121,7 @@ for filename in args:
|
|||
passes += 1
|
||||
|
||||
if reference:
|
||||
print (":".join ([fontfile, options, unicodes, glyphs1]))
|
||||
print (":".join ([fontfile, " ".join(options), unicodes, glyphs1]))
|
||||
continue
|
||||
|
||||
if glyphs1.strip() != glyphs_expected and glyphs_expected != '*':
|
||||
|
|
Loading…
Reference in New Issue