[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')
|
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
|
foreach file_name : in_house_tests
|
||||||
test_name = file_name.split('.')[0].underscorify()
|
test_name = file_name.split('.')[0].underscorify()
|
||||||
|
|
||||||
|
@ -13,6 +18,7 @@ foreach file_name : in_house_tests
|
||||||
hb_shape,
|
hb_shape,
|
||||||
meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name,
|
meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name,
|
||||||
],
|
],
|
||||||
|
env: env,
|
||||||
workdir: meson.current_build_dir() / '..' / '..',
|
workdir: meson.current_build_dir() / '..' / '..',
|
||||||
suite: ['shaping', 'in-house'],
|
suite: ['shaping', 'in-house'],
|
||||||
)
|
)
|
||||||
|
@ -26,6 +32,7 @@ foreach file_name : aots_tests
|
||||||
hb_shape,
|
hb_shape,
|
||||||
meson.current_source_dir() / 'data' / 'aots' / 'tests' / file_name,
|
meson.current_source_dir() / 'data' / 'aots' / 'tests' / file_name,
|
||||||
],
|
],
|
||||||
|
env: env,
|
||||||
workdir: meson.current_build_dir() / '..' / '..',
|
workdir: meson.current_build_dir() / '..' / '..',
|
||||||
suite: ['shaping', 'aots'],
|
suite: ['shaping', 'aots'],
|
||||||
)
|
)
|
||||||
|
@ -39,6 +46,7 @@ foreach file_name : text_rendering_tests
|
||||||
hb_shape,
|
hb_shape,
|
||||||
meson.current_source_dir() / 'data' / 'text-rendering-tests' / 'tests' / file_name,
|
meson.current_source_dir() / 'data' / 'text-rendering-tests' / 'tests' / file_name,
|
||||||
],
|
],
|
||||||
|
env: env,
|
||||||
workdir: meson.current_build_dir() / '..' / '..',
|
workdir: meson.current_build_dir() / '..' / '..',
|
||||||
suite: ['shaping', 'text-rendering-tests'],
|
suite: ['shaping', 'text-rendering-tests'],
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,6 +15,8 @@ if len (args) and args[0] == "--reference":
|
||||||
reference = True
|
reference = True
|
||||||
args = args[1:]
|
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]):
|
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.""")
|
sys.exit ("""First argument does not seem to point to usable hb-shape.""")
|
||||||
hb_shape, args = args[0], args[1:]
|
hb_shape, args = args[0], args[1:]
|
||||||
|
@ -59,6 +61,7 @@ for filename in args:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fontfile, options, unicodes, glyphs_expected = line.split (":")
|
fontfile, options, unicodes, glyphs_expected = line.split (":")
|
||||||
|
options = options.split ()
|
||||||
if fontfile.startswith ('/') or fontfile.startswith ('"/'):
|
if fontfile.startswith ('/') or fontfile.startswith ('"/'):
|
||||||
if os.name == 'nt': # Skip on Windows
|
if os.name == 'nt': # Skip on Windows
|
||||||
continue
|
continue
|
||||||
|
@ -100,23 +103,25 @@ for filename in args:
|
||||||
shutil.copyfile(fontfile, new_fontfile)
|
shutil.copyfile(fontfile, new_fontfile)
|
||||||
fontfile = new_fontfile
|
fontfile = new_fontfile
|
||||||
|
|
||||||
glyphs1 = cmd ([hb_shape, "--font-funcs=ft",
|
if "--font-funcs=ft" in options and no_ft_funcs:
|
||||||
fontfile] + extra_options + ["--unicodes",
|
skips += 1
|
||||||
unicodes] + (options.split (' ') if options else []))
|
continue
|
||||||
|
|
||||||
glyphs2 = cmd ([hb_shape, "--font-funcs=ot",
|
if "--font-funcs=ot" in options or no_ft_funcs:
|
||||||
fontfile] + extra_options + ["--unicodes",
|
glyphs1 = cmd ([hb_shape, "--font-funcs=ot", fontfile] + extra_options + ["--unicodes", unicodes] + options)
|
||||||
unicodes] + (options.split (' ') if options else []))
|
|
||||||
|
|
||||||
if glyphs1 != glyphs2 and glyphs_expected != '*':
|
|
||||||
print ("FT funcs: " + glyphs1, file=sys.stderr)
|
|
||||||
print ("OT funcs: " + glyphs2, file=sys.stderr)
|
|
||||||
fails += 1
|
|
||||||
else:
|
else:
|
||||||
passes += 1
|
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)
|
||||||
|
print ("OT funcs: " + glyphs2, file=sys.stderr)
|
||||||
|
fails += 1
|
||||||
|
else:
|
||||||
|
passes += 1
|
||||||
|
|
||||||
if reference:
|
if reference:
|
||||||
print (":".join ([fontfile, options, unicodes, glyphs1]))
|
print (":".join ([fontfile, " ".join(options), unicodes, glyphs1]))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if glyphs1.strip() != glyphs_expected and glyphs_expected != '*':
|
if glyphs1.strip() != glyphs_expected and glyphs_expected != '*':
|
||||||
|
|
Loading…
Reference in New Issue