diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources b/test/shaping/data/text-rendering-tests/Makefile.sources index 6fe174e49..79f22adb4 100644 --- a/test/shaping/data/text-rendering-tests/Makefile.sources +++ b/test/shaping/data/text-rendering-tests/Makefile.sources @@ -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) diff --git a/test/shaping/data/text-rendering-tests/extract-tests.py b/test/shaping/data/text-rendering-tests/extract-tests.py index 2292cf45d..27d568615 100755 --- a/test/shaping/data/text-rendering-tests/extract-tests.py +++ b/test/shaping/data/text-rendering-tests/extract-tests.py @@ -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) diff --git a/test/shaping/data/text-rendering-tests/fonts/TestGSUBThree.ttf b/test/shaping/data/text-rendering-tests/fonts/TestGSUBThree.ttf new file mode 100644 index 000000000..8fce4ac4d Binary files /dev/null and b/test/shaping/data/text-rendering-tests/fonts/TestGSUBThree.ttf differ diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyfour.ttf b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyfour.ttf new file mode 100644 index 000000000..a70dadccf Binary files /dev/null and b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyfour.ttf differ diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtythree.ttf b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtythree.ttf new file mode 100644 index 000000000..5cab73e5a Binary files /dev/null and b/test/shaping/data/text-rendering-tests/fonts/TestMORXThirtythree.ttf differ diff --git a/test/shaping/data/text-rendering-tests/fonts/TestMORXTwentyfour.ttf b/test/shaping/data/text-rendering-tests/fonts/TestMORXTwentyfour.ttf new file mode 100644 index 000000000..271dddb01 Binary files /dev/null and b/test/shaping/data/text-rendering-tests/fonts/TestMORXTwentyfour.ttf differ diff --git a/test/shaping/data/text-rendering-tests/tests/GSUB-3.tests b/test/shaping/data/text-rendering-tests/tests/GSUB-3.tests new file mode 100644 index 000000000..c2f7e6ef2 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/GSUB-3.tests @@ -0,0 +1 @@ +../fonts/TestGSUBThree.ttf::U+006C,U+006F,U+006C:* diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-24.tests b/test/shaping/data/text-rendering-tests/tests/MORX-24.tests new file mode 100644 index 000000000..79a3d7bb1 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-24.tests @@ -0,0 +1 @@ +../fonts/TestMORXTwentyfour.ttf::U+0041,U+0042,U+0043,U+0044,U+0045:* diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-32.tests b/test/shaping/data/text-rendering-tests/tests/MORX-32.tests index 6f3ae888e..87c115252 100644 --- a/test/shaping/data/text-rendering-tests/tests/MORX-32.tests +++ b/test/shaping/data/text-rendering-tests/tests/MORX-32.tests @@ -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] diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-33.tests b/test/shaping/data/text-rendering-tests/tests/MORX-33.tests new file mode 100644 index 000000000..17d080a60 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-33.tests @@ -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] diff --git a/test/shaping/data/text-rendering-tests/tests/MORX-34.tests b/test/shaping/data/text-rendering-tests/tests/MORX-34.tests new file mode 100644 index 000000000..8c309df84 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/tests/MORX-34.tests @@ -0,0 +1 @@ +../fonts/TestMORXThirtyfour.ttf::U+0068,U+0061:* diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py index ffe622a2b..5592aea58 100755 --- a/test/shaping/run-tests.py +++ b/test/shaping/run-tests.py @@ -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