From 719dafdaad1944fbc9ba3cd404ef37b1986e505f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 17 Mar 2025 18:06:14 -0600 Subject: [PATCH] [test/shape] Allow comments in directives Also adjust tests for directwrite font-funcs. --- .../in-house/tests/arabic-fallback-shaping.tests | 2 +- test/shape/data/in-house/tests/color-fonts.tests | 2 +- test/shape/data/in-house/tests/variations.tests | 1 + test/shape/run-tests.py | 13 +++++++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/shape/data/in-house/tests/arabic-fallback-shaping.tests b/test/shape/data/in-house/tests/arabic-fallback-shaping.tests index e85afc1f9..550cbfa0d 100644 --- a/test/shape/data/in-house/tests/arabic-fallback-shaping.tests +++ b/test/shape/data/in-house/tests/arabic-fallback-shaping.tests @@ -1,4 +1,4 @@ -@font-funcs=ot,ft,directwrite,uniscribe +@font-funcs=ot,ft ../fonts/df768b9c257e0c9c35786c47cae15c46571d56be.ttf;;U+0633,U+064F,U+0644,U+064E,U+0651,U+0627,U+0651,U+0650,U+0645,U+062A,U+06CC;[uni06CC.fina=10+1655|uni062A.medi=9+868|uni0645.init=8+1098|uni0650=2@148,0+0|uni0651=2@187,736+0|uni064E=2@883,1259+0|uni0651=2@922,736+0|uni06440627.fina=2+1470|uni064F=0@629,-10+0|uni0633.init=0+1585] ../fonts/SimpArabicTest.ttf;--no-positions;U+0628,U+0650,U+0633,U+0652,U+0645,U+0650,U+0020,U+0020,U+0627,U+0644,U+0644,U+0647,U+0020,U+0627,U+0644,U+0631,U+0651,U+064E,U+062D,U+0652,U+0645,U+064E,U+0646,U+0650,U+0020,U+0627,U+0644,U+0631,U+062D,U+0650,U+064A,U+0645;[daggerdbl=31|c142=30|twosuperior=28|bracketleft=28|c=27|quotedblbase=26|J=25|parenright=24|twosuperior=22|Eacute=22|logicalnot=20|dagger=20|registered=18|bracketleft=18|logicalnot=15|plusminus=15|c=15|quotedblbase=14|J=13|parenright=12|guilsinglleft=11|quotedblbase=10|quotedblbase=9|J=8|parenright=7|parenright=6|twosuperior=4|daggerdbl=4|registered=2|j=2|twosuperior=0|R=0] ../fonts/SimpArabicTest.ttf;;U+0020,U+0644,U+0627,U+0020,U+0644,U+0623,U+0020,U+0644,U+064E,U+0623,U+064E,U+0020,U+0623,U+064E,U+0646,U+062A;[U=15+693|DEL=14+227|logicalnot=12@17,307+0|L=12+289|parenright=11+391|logicalnot=7@41,267+0|logicalnot=7@378,267+0|brokenbar=7+674|parenright=6+391|brokenbar=4+674|parenright=3+391|yen=1+709|parenright=0+391] diff --git a/test/shape/data/in-house/tests/color-fonts.tests b/test/shape/data/in-house/tests/color-fonts.tests index d1ba1638d..adaa9dec5 100644 --- a/test/shape/data/in-house/tests/color-fonts.tests +++ b/test/shape/data/in-house/tests/color-fonts.tests @@ -1,3 +1,3 @@ -@font-funcs=ot,ft +@font-funcs=ot,ft # hb-fontations seems to infinite-loop ../fonts/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf;--show-extents;U+1F42F;[gid1=0+2963<0,2179,2963,-2789>] ../fonts/fcbaa518d3cce441ed37ae3b1fed6a19e9b54efd.ttf;--show-extents;U+1F600;[gid4=0+2550<0,1898,2555,-2405>] diff --git a/test/shape/data/in-house/tests/variations.tests b/test/shape/data/in-house/tests/variations.tests index 52f74f22e..1b803b38f 100644 --- a/test/shape/data/in-house/tests/variations.tests +++ b/test/shape/data/in-house/tests/variations.tests @@ -1,3 +1,4 @@ +@font-funcs-=directwrite # hb-directwrite doe not support variations yet ../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] diff --git a/test/shape/run-tests.py b/test/shape/run-tests.py index 166402bba..da50f6d27 100755 --- a/test/shape/run-tests.py +++ b/test/shape/run-tests.py @@ -132,9 +132,12 @@ for filename in args: if line.startswith("@"): # Directive + line = line.strip() + line = line.split("#")[0].strip()[1:] + consumed = False for what in ["shaper", "face-loader", "font-funcs"]: whats = plural(what) - if line.startswith("@" + whats): + if line.startswith(whats): command, values = line.split("=") values = values.strip().split(",") @@ -149,7 +152,13 @@ for filename in args: var_name = all_whats_var_name(what) print(f"Setting {var_name} to {values}") globals()[var_name] = values - continue + consumed = True + if consumed: + print(line) + continue + else: + print("Unrecognized directive: %s" % line) + sys.exit(1) fontfile, options, unicodes, glyphs_expected = line.split(";") options = options.split()