From 46a30fe390b6f55001b47eb71fa020bc5a2a63c9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Mar 2025 18:23:34 -0600 Subject: [PATCH] [test/shape] Respect @shapers directive --- test/shape/data/in-house/tests/coretext.tests | 3 +- .../data/in-house/tests/directwrite.tests | 21 ++--- test/shape/run-tests.py | 79 ++++++++++--------- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/test/shape/data/in-house/tests/coretext.tests b/test/shape/data/in-house/tests/coretext.tests index 4cecf4779..9817c7094 100644 --- a/test/shape/data/in-house/tests/coretext.tests +++ b/test/shape/data/in-house/tests/coretext.tests @@ -1 +1,2 @@ -../fonts/872d2955d326bd6676a06f66b8238ebbaabc212f.ttf;--shaper=coretext;U+0628,U+0628,U+0628;[uni0628.fina=2+883|uni0628.medi_High=1+244|uni0628.init_High=0+233] +@shapers=ot,coretext +../fonts/872d2955d326bd6676a06f66b8238ebbaabc212f.ttf;;U+0628,U+0628,U+0628;[uni0628.fina=2+883|uni0628.medi_High=1+244|uni0628.init_High=0+233] diff --git a/test/shape/data/in-house/tests/directwrite.tests b/test/shape/data/in-house/tests/directwrite.tests index cb75bc4c9..2d8f574f4 100644 --- a/test/shape/data/in-house/tests/directwrite.tests +++ b/test/shape/data/in-house/tests/directwrite.tests @@ -1,11 +1,12 @@ @font-funcs-=directwrite -../fonts/872d2955d326bd6676a06f66b8238ebbaabc212f.ttf;--shaper=directwrite;U+0628,U+0628,U+0628;[uni0628.fina=2+883|uni0628.medi_High=1+244|uni0628.init_High=0+233] -../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--shaper=directwrite;U+0066,U+0066,U+0069;[f_f_i=0+795] -../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--shaper=directwrite --features=-liga;U+0066,U+0066,U+0069;[f=0+300|f=1+300|i=2+263] -../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--shaper=directwrite;U+0648,U+0628,U+0627;[alef-ar.fina=2+229|beh-ar.init=1+190|waw-ar=0+483] -../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--shaper=directwrite --features=ss01;U+0648,U+0628,U+0627;[alef-ar.fina=2+229|beh-ar.init.LD=1+190|waw-ar=0+400] -#../fonts/HBTest-VF.ttf;--shaper=directwrite --variations=TEST=491;U+0041;[A=0+496] -#../fonts/HBTest-VF.ttf;--shaper=directwrite --variations=TEST=509;U+0041;[A=0+505] -../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf;--shaper=directwrite --variations=wdth=60;U+0020;[space=0+266] -../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf;--shaper=directwrite --variations=wdth=402;U+0020;[space=0+639] -../fonts/e8691822f6a705e3e9fb48a0405c645b1a036590.ttf;--shaper=directwrite --variations=0001=500;U+002E,U+0065;[period=0+681|e=1+650] +@shapers=directwrite +../fonts/872d2955d326bd6676a06f66b8238ebbaabc212f.ttf;;U+0628,U+0628,U+0628;[uni0628.fina=2+883|uni0628.medi_High=1+244|uni0628.init_High=0+233] +../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;;U+0066,U+0066,U+0069;[f_f_i=0+795] +../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--features=-liga;U+0066,U+0066,U+0069;[f=0+300|f=1+300|i=2+263] +../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;;U+0648,U+0628,U+0627;[alef-ar.fina=2+229|beh-ar.init=1+190|waw-ar=0+483] +../fonts/7bbd3175734d5d291e1c15271ec0cbb97b626ebf.ttf;--features=ss01;U+0648,U+0628,U+0627;[alef-ar.fina=2+229|beh-ar.init.LD=1+190|waw-ar=0+400] +#../fonts/HBTest-VF.ttf;--variations=TEST=491;U+0041;[A=0+496] +#../fonts/HBTest-VF.ttf;--variations=TEST=509;U+0041;[A=0+505] +../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf;--variations=wdth=60;U+0020;[space=0+266] +../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf;--variations=wdth=402;U+0020;[space=0+639] +../fonts/e8691822f6a705e3e9fb48a0405c645b1a036590.ttf;--variations=0001=500;U+002E,U+0065;[period=0+681|e=1+650] diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 8e6a31f97..daa1312cd 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -249,54 +249,55 @@ for filename in args: continue options = new_options - for font_funcs in [font_funcs] if font_funcs else all_whats("font-funcs"): - extra_options = [] + for shaper in [shaper] if shaper else all_whats("shaper"): + for font_funcs in [font_funcs] if font_funcs else all_whats("font-funcs"): + extra_options = [] - if shaper: - extra_options.append("--shaper=" + shaper) - if face_loader: - extra_options.append("--face-loader=" + face_loader) - if font_funcs: - extra_options.append("--font-funcs=" + font_funcs) + if shaper: + extra_options.append("--shaper=" + shaper) + if face_loader: + extra_options.append("--face-loader=" + face_loader) + if font_funcs: + extra_options.append("--font-funcs=" + font_funcs) - if glyphs_expected != "*": - extra_options.append("--verify") - extra_options.append("--unsafe-to-concat") + if glyphs_expected != "*": + extra_options.append("--verify") + extra_options.append("--unsafe-to-concat") - if verbose: - print( - "# shaper=%s face-loader=%s font-funcs=%s" - % (shaper, face_loader, font_funcs) - ) - cmd = [fontfile] + ["--unicodes", unicodes] + options + extra_options - glyphs = shape_cmd(cmd, shape_process, verbose).strip() + if verbose: + print( + "# shaper=%s face-loader=%s font-funcs=%s" + % (shaper, face_loader, font_funcs) + ) + cmd = [fontfile] + ["--unicodes", unicodes] + options + extra_options + glyphs = shape_cmd(cmd, shape_process, verbose).strip() - if glyphs_expected == "*": - passes += 1 - continue + if glyphs_expected == "*": + passes += 1 + continue - final_glyphs = glyphs - final_glyphs_expected = glyphs_expected + final_glyphs = glyphs + final_glyphs_expected = glyphs_expected - if glyphs != glyphs_expected and glyphs.find("gid") != -1: - if not no_glyph_names_process: - no_glyph_names_process = open_shape_batch_process() + if glyphs != glyphs_expected and glyphs.find("gid") != -1: + if not no_glyph_names_process: + no_glyph_names_process = open_shape_batch_process() - cmd2 = [fontfile] + ["--glyphs", "--no-glyph-names", glyphs] - final_glyphs = shape_cmd(cmd2, no_glyph_names_process).strip() + cmd2 = [fontfile] + ["--glyphs", "--no-glyph-names", glyphs] + final_glyphs = shape_cmd(cmd2, no_glyph_names_process).strip() - cmd2 = [fontfile] + ["--glyphs", "--no-glyph-names", glyphs_expected] - final_glyphs_expected = shape_cmd(cmd2, no_glyph_names_process).strip() + cmd2 = [fontfile] + ["--glyphs", "--no-glyph-names", glyphs_expected] + final_glyphs_expected = shape_cmd(cmd2, no_glyph_names_process).strip() - # If the removal of glyph_ids failed, fail the test. - # https://github.com/harfbuzz/harfbuzz/issues/5169 - if not final_glyphs_expected or final_glyphs != final_glyphs_expected: - print(hb_shape + " " + " ".join(cmd), file=sys.stderr) - print("Actual: " + final_glyphs, file=sys.stderr) - print("Expected: " + final_glyphs_expected, file=sys.stderr) - fails += 1 - else: - passes += 1 + # If the removal of glyph_ids failed, fail the test. + # https://github.com/harfbuzz/harfbuzz/issues/5169 + if not final_glyphs_expected or final_glyphs != final_glyphs_expected: + print(hb_shape + " " + " ".join(cmd), file=sys.stderr) + print("Actual: " + final_glyphs, file=sys.stderr) + print("Expected: " + final_glyphs_expected, file=sys.stderr) + fails += 1 + else: + passes += 1 print( "%d tests passed; %d failed; %d skipped." % (passes, fails, skips), file=sys.stderr