(pkg)
| 103 | |
| 104 | @pytest.mark.parametrize('pkg', ['xcolor', 'chemformula']) |
| 105 | def test_usetex_packages(pkg): |
| 106 | if not _has_tex_package(pkg): |
| 107 | pytest.skip(f'{pkg} is not available') |
| 108 | mpl.rcParams['text.usetex'] = True |
| 109 | |
| 110 | fig = plt.figure() |
| 111 | text = fig.text(0.5, 0.5, "Some text 0123456789") |
| 112 | fig.canvas.draw() |
| 113 | |
| 114 | mpl.rcParams['text.latex.preamble'] = ( |
| 115 | r'\PassOptionsToPackage{dvipsnames}{xcolor}\usepackage{%s}' % pkg) |
| 116 | fig = plt.figure() |
| 117 | text2 = fig.text(0.5, 0.5, "Some text 0123456789") |
| 118 | fig.canvas.draw() |
| 119 | np.testing.assert_array_equal(text2.get_window_extent(), |
| 120 | text.get_window_extent()) |
| 121 | |
| 122 | |
| 123 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…