MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_minus_no_descent

Function test_minus_no_descent

lib/matplotlib/tests/test_usetex.py:85–101  ·  view source on GitHub ↗
(fontsize)

Source from the content-addressed store, hash-verified

83
84@pytest.mark.parametrize("fontsize", [8, 10, 12])
85def test_minus_no_descent(fontsize):
86 # Test special-casing of minus descent in DviFont._height_depth_of, by
87 # checking that overdrawing a 1 and a -1 results in an overall height
88 # equivalent to drawing either of them separately.
89 mpl.style.use("mpl20")
90 mpl.rcParams['font.size'] = fontsize
91 heights = {}
92 fig = plt.figure()
93 for vals in [(1,), (-1,), (-1, 1)]:
94 fig.clear()
95 for x in vals:
96 fig.text(.5, .5, f"${x}$", usetex=True)
97 fig.canvas.draw()
98 # The following counts the number of non-fully-blank pixel rows.
99 heights[vals] = ((np.array(fig.canvas.buffer_rgba())[..., 0] != 255)
100 .any(axis=1).sum())
101 assert len({*heights.values()}) == 1
102
103
104@pytest.mark.parametrize('pkg', ['xcolor', 'chemformula'])

Callers

nothing calls this directly

Calls 6

figureMethod · 0.80
valuesMethod · 0.80
clearMethod · 0.45
textMethod · 0.45
drawMethod · 0.45
buffer_rgbaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…