|
116 | 116 | r'$\left(X\right)_{a}^{b}$', # github issue 7615
|
117 | 117 | r'$\dfrac{\$100.00}{y}$', # github issue #1888
|
118 | 118 | ]
|
119 |
| -# 'Lightweight' tests test only a single fontset (dejavusans, which is the |
| 119 | +# 'svgastext' tests switch svg output to embed text as text (rather than as |
| 120 | +# paths). |
| 121 | +svgastext_math_tests = [ |
| 122 | +] |
| 123 | +# 'lightweight' tests test only a single fontset (dejavusans, which is the |
120 | 124 | # default) and only png outputs, in order to minimize the size of baseline
|
121 | 125 | # images.
|
122 | 126 | lightweight_math_tests = [
|
@@ -200,6 +204,24 @@ def test_mathtext_rendering(baseline_images, fontset, index, text):
|
200 | 204 | horizontalalignment='center', verticalalignment='center')
|
201 | 205 |
|
202 | 206 |
|
| 207 | +@pytest.mark.parametrize('index, text', enumerate(svgastext_math_tests), |
| 208 | + ids=range(len(svgastext_math_tests))) |
| 209 | +@pytest.mark.parametrize( |
| 210 | + 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif']) |
| 211 | +@pytest.mark.parametrize('baseline_images', ['mathtext0'], indirect=True) |
| 212 | +@image_comparison( |
| 213 | + baseline_images=None, |
| 214 | + savefig_kwarg={'metadata': { # Minimize image size. |
| 215 | + 'Creator': None, 'Date': None, 'Format': None, 'Type': None}}) |
| 216 | +def test_mathtext_rendering_svgastext(baseline_images, fontset, index, text): |
| 217 | + mpl.rcParams['mathtext.fontset'] = fontset |
| 218 | + mpl.rcParams['svg.fonttype'] = 'none' # Minimize image size. |
| 219 | + fig = plt.figure(figsize=(5.25, 0.75)) |
| 220 | + fig.patch.set(visible=False) # Minimize image size. |
| 221 | + fig.text(0.5, 0.5, text, |
| 222 | + horizontalalignment='center', verticalalignment='center') |
| 223 | + |
| 224 | + |
203 | 225 | @pytest.mark.parametrize('index, text', enumerate(lightweight_math_tests),
|
204 | 226 | ids=range(len(lightweight_math_tests)))
|
205 | 227 | @pytest.mark.parametrize('fontset', ['dejavusans'])
|
|
0 commit comments