From: Simon Cozens Date: Mon, 31 Oct 2022 11:13:45 +0000 (+0000) Subject: Add test for dotted circles in sample text X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76468926c1efe4d18477a70d767f91d4c6e38768;p=thirdparty%2Fgoogle%2Ffonts.git Add test for dotted circles in sample text --- diff --git a/tests/test_dottedcircle.py b/tests/test_dottedcircle.py new file mode 100644 index 0000000000..4594ac740d --- /dev/null +++ b/tests/test_dottedcircle.py @@ -0,0 +1,30 @@ +import uharfbuzz as hb +import gflanguages +import pytest + +langs = gflanguages.LoadLanguages() + + +@pytest.fixture +def hb_font(): + # Persuade Harfbuzz we have a font that supports + # every codepoint. + face = hb.Face(b"") + font = hb.Font(face) + funcs = hb.FontFuncs.create() + funcs.set_nominal_glyph_func((lambda font,cp,data: cp), None) + font.funcs = funcs + return font + + +@pytest.mark.parametrize("lang", langs.keys()) +def test_dotted_circle(lang, hb_font): + item = langs[lang] + samples = [x for (_,x) in item.sample_text.ListFields()] + for sample in sorted(samples, key=lambda x:len(x)): + buf = hb.Buffer() + buf.add_str(sample) + buf.guess_segment_properties() + hb.shape(hb_font, buf) + ok = not any(info.codepoint == 0x25CC for info in buf.glyph_infos) + assert ok, f"Dotted circle found in {sample} ({lang})"