[test/text-rendering-tests] Update from upstream

This commit is contained in:
Behdad Esfahbod 2018-10-04 12:13:55 +02:00
parent 6ff8a8a10b
commit 55468ca01b
12 changed files with 36 additions and 11 deletions

View File

@ -15,6 +15,7 @@ TESTS = \
tests/GPOS-5.tests \
tests/GSUB-1.tests \
tests/GSUB-2.tests \
tests/GSUB-3.tests \
tests/GVAR-1.tests \
tests/GVAR-2.tests \
tests/GVAR-3.tests \
@ -42,6 +43,7 @@ TESTS = \
tests/MORX-21.tests \
tests/MORX-22.tests \
tests/MORX-23.tests \
tests/MORX-24.tests \
tests/MORX-25.tests \
tests/MORX-26.tests \
tests/MORX-27.tests \
@ -50,6 +52,9 @@ TESTS = \
tests/MORX-2.tests \
tests/MORX-30.tests \
tests/MORX-31.tests \
tests/MORX-32.tests \
tests/MORX-33.tests \
tests/MORX-34.tests \
tests/MORX-3.tests \
tests/MORX-4.tests \
tests/MORX-5.tests \
@ -68,5 +73,4 @@ DISBALED_TESTS = \
tests/SHBALI-2.tests \
tests/SHKNDA-2.tests \
tests/SHKNDA-3.tests \
tests/MORX-32.tests \
$(NULL)

View File

@ -28,6 +28,7 @@ def glyphstr(glyphs):
html = ET.fromstring(sys.stdin.read())
found = False
for elt in html.findall(".//*[@class='expected'][@ft:id]", namespaces):
found = True
name = elt.get(ns('ft:id'))
@ -47,4 +48,15 @@ for elt in html.findall(".//*[@class='expected'][@ft:id]", namespaces):
opts = opts + ' --variations=%s' % variations
print ("../fonts/%s:%s:%s:%s" % (font, opts, unistr(text), glyphstr(glyphs)))
for elt in html.findall(".//*[@class='should-not-crash'][@ft:id]", namespaces):
found = True
name = elt.get(ns('ft:id'))
text = elt.get(ns('ft:render'))
font = elt.get(ns('ft:font'))
variations = elt.get(ns('ft:var'), '').replace(':', '=').replace(';', ',')
opts = ''
if variations:
opts = '--variations=%s' % variations
print ("../fonts/%s:%s:%s:*" % (font, opts, unistr(text)))
sys.exit(0 if found else 1)

View File

@ -0,0 +1 @@
../fonts/TestGSUBThree.ttf::U+006C,U+006F,U+006C:*

View File

@ -0,0 +1 @@
../fonts/TestMORXTwentyfour.ttf::U+0041,U+0042,U+0043,U+0044,U+0045:*

View File

@ -1,4 +1,4 @@
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0041:[I|N@830,0|S@1660,0|A@2490,0]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0041,U+0059:[I|N@830,0|S@1660,0|X@2490,0|A@2854,0|Y@3684,0]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0042:[B|I@830,0|N@1660,0|S@2490,0]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0042,U+0059:[X|I@364,0|N@1194,0|S@2024,0|B@2854,0|Y@3684,0]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0041:[A]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0041,U+0059:[X|A@364,0|Y@1194,0]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0042:[B]
../fonts/TestMORXThirtytwo.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0042,U+0059:[X|B@364,0|Y@1194,0]

View File

@ -0,0 +1,3 @@
../fonts/TestMORXThirtythree.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0068,U+0061:[h|a@618,0|h@1179,0|a@1797,0]
../fonts/TestMORXThirtythree.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0068,U+0061,U+0068,U+0061:[h|a@618,0|h@1179,0|a@1797,0|h@2358,0|a@2976,0|h@3537,0|a@4155,0]
../fonts/TestMORXThirtythree.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0061,U+0068:[a|h@561,0]

View File

@ -0,0 +1 @@
../fonts/TestMORXThirtyfour.ttf::U+0068,U+0061:*

View File

@ -19,8 +19,6 @@ if not args or sys.argv[1].find('hb-shape') == -1 or not os.path.exists (sys.arg
sys.exit (1)
hb_shape, args = args[0], args[1:]
extra_options = "--verify"
fails = 0
reference = False
@ -48,6 +46,11 @@ for filename in args:
cwd = os.path.dirname(filename)
fontfile = os.path.normpath (os.path.join (cwd, fontfile))
extra_options = []
glyphs_expected = glyphs_expected.strip()
if glyphs_expected != '*':
extra_options.append("--verify")
if line.startswith ("#"):
if not reference:
print ("# %s %s --unicodes %s" % (hb_shape, fontfile, unicodes))
@ -55,10 +58,10 @@ for filename in args:
if not reference:
print ("%s %s %s %s --unicodes %s" %
(hb_shape, fontfile, extra_options, options, unicodes))
(hb_shape, fontfile, ' '.join(extra_options), options, unicodes))
glyphs1, returncode = cmd ([hb_shape, "--font-funcs=ft",
fontfile, extra_options, "--unicodes",
fontfile] + extra_options + ["--unicodes",
unicodes] + (options.split (' ') if options else []))
if returncode:
@ -67,7 +70,7 @@ for filename in args:
#continue
glyphs2, returncode = cmd ([hb_shape, "--font-funcs=ot",
fontfile, extra_options, "--unicodes",
fontfile] + extra_options + ["--unicodes",
unicodes] + (options.split (' ') if options else []))
if returncode:
@ -84,7 +87,7 @@ for filename in args:
print (":".join ([fontfile, options, unicodes, glyphs1]))
continue
if glyphs1.strip() != glyphs_expected.strip() and glyphs_expected.strip() != '*':
if glyphs1.strip() != glyphs_expected and glyphs_expected != '*':
print ("Actual: " + glyphs1) # file=sys.stderr
print ("Expected: " + glyphs_expected) # file=sys.stderr
fails = fails + 1