Skip to content

Commit fb31d90

Browse files
committed
Fixed SVG-as-text image comparison tests.
SVG-as-text tests make make the figure background transparent, but the underlying colour is black. Before the expected and actual images are compared, they are converted from RGBA to RGB, which makes them both completely black (since the text is also black). As a result, the test passes even if the expected and actual images differ. Making the text white solves this problem.
1 parent 40dea5a commit fb31d90

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/matplotlib/tests/baseline_images/test_mathtext/mathtext0_cm_00.svg

Lines changed: 1 addition & 1 deletion
Loading

lib/matplotlib/tests/baseline_images/test_mathtext/mathtext0_dejavusans_00.svg

Lines changed: 1 addition & 1 deletion
Loading

lib/matplotlib/tests/test_mathtext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def test_mathtext_rendering(baseline_images, fontset, index, text):
216216
def test_mathtext_rendering_svgastext(baseline_images, fontset, index, text):
217217
mpl.rcParams['mathtext.fontset'] = fontset
218218
mpl.rcParams['svg.fonttype'] = 'none' # Minimize image size.
219+
mpl.rcParams['text.color'] = 'white'
219220
fig = plt.figure(figsize=(5.25, 0.75))
220221
fig.patch.set(visible=False) # Minimize image size.
221222
fig.text(0.5, 0.5, text,

0 commit comments

Comments
 (0)