Debian Codegraph @

tests/test_dottedcircle.py

raw symbols SCIP
1 import uharfbuzz as hb
2 import gflanguages
3 import pytest
4
5 langs = gflanguages.LoadLanguages()
6 xfail_langs = {"kkh_Lana": "Tai Tham encoding is over-differentiated (see L2/19-365)"}
7
8
9 @pytest.fixture
10 def hb_font():
11 # Persuade Harfbuzz we have a font that supports
12 # every codepoint.
13 face = hb.Face(b"")
14 font = hb.Font(face)
15 funcs = hb.FontFuncs.create()
16 funcs.set_nominal_glyph_func((lambda font, cp, data: cp), None)
17 font.funcs = funcs
18 return font
19
20
21 @pytest.mark.parametrize("lang", langs.keys())
22 def test_dotted_circle(lang, hb_font):
23 if lang in xfail_langs:
24 pytest.xfail("Language is expected to fail: " + xfail_langs[lang])
25 item = langs[lang]
26 samples = item.sample_text.ListFields()
27 for sample_name, sample in sorted(samples, key=lambda x: len(x[1])):
28 buf = hb.Buffer()
29 buf.add_str(sample)
30 buf.guess_segment_properties()
31 hb.shape(hb_font, buf)
32 ok = not any(info.codepoint == 0x25CC for info in buf.glyph_infos)
33 assert ok, f"Dotted circle found in {sample} ({lang}.{sample_name.name})"