MCPcopy
hub / github.com/matplotlib/matplotlib / test_ft2font_face_index

Function test_ft2font_face_index

lib/matplotlib/tests/test_ft2font.py:208–222  ·  view source on GitHub ↗
(name, size, skippable)

Source from the content-addressed store, hash-verified

206@pytest.mark.parametrize('name, size, skippable',
207 [('DejaVu Sans', 1, False), ('WenQuanYi Zen Hei', 3, True)])
208def test_ft2font_face_index(name, size, skippable):
209 try:
210 file = fm.findfont(name, fallback_to_default=False)
211 except ValueError:
212 if skippable:
213 pytest.skip(r'Font {name} may be missing')
214 raise
215 for index in range(size):
216 font = ft2font.FT2Font(file, face_index=index)
217 assert font.num_faces >= size
218 assert font.face_index == index
219 with pytest.raises(ValueError, match='must be between'): # out of bounds for spec
220 ft2font.FT2Font(file, face_index=0x1ffff)
221 with pytest.raises(RuntimeError, match='invalid argument'): # invalid for this font
222 ft2font.FT2Font(file, face_index=0xff)
223
224
225def test_ft2font_clear():

Callers

nothing calls this directly

Calls 1

findfontMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…