Skip to content

Commit eb51274

Browse files
committed
TST: Use text placeholders for empty legends
These tests use `remove_text=True` and set legend labels to empty strings. However, they are still affected by font metrics because even the empty string is as tall as the line height (which is calculated from the height of the "lp" string.)
1 parent 1840d9b commit eb51274

File tree

12 files changed

+320
-342
lines changed

12 files changed

+320
-342
lines changed
-113 Bytes
Loading
Binary file not shown.
Binary file not shown.
-2.44 KB
Loading

lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight.svg

Lines changed: 312 additions & 333 deletions
Loading
-108 Bytes
Loading
1.38 KB
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4593,7 +4593,7 @@ def test_hist_stacked_weighted():
45934593

45944594

45954595
@image_comparison(['stem.png'], style='mpl20', remove_text=True)
4596-
def test_stem():
4596+
def test_stem(text_placeholders):
45974597
x = np.linspace(0.1, 2 * np.pi, 100)
45984598

45994599
fig, ax = plt.subplots()

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ def test_pdfpages_fspath():
296296
pdf.savefig(plt.figure())
297297

298298

299-
@image_comparison(['hatching_legend.pdf'])
300-
def test_hatching_legend():
299+
@image_comparison(['hatching_legend.pdf'], style='mpl20')
300+
def test_hatching_legend(text_placeholders):
301301
"""Test for correct hatching on patches in legend"""
302302
fig = plt.figure(figsize=(1, 2))
303303

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
1212

1313

14-
@image_comparison(['bbox_inches_tight'], remove_text=True,
14+
@image_comparison(['bbox_inches_tight'], remove_text=True, style='mpl20',
1515
savefig_kwarg={'bbox_inches': 'tight'})
16-
def test_bbox_inches_tight():
16+
def test_bbox_inches_tight(text_placeholders):
1717
#: Test that a figure saved using bbox_inches='tight' is clipped correctly
1818
data = [[66386, 174296, 75131, 577908, 32015],
1919
[58230, 381139, 78045, 99308, 160454],

0 commit comments

Comments
 (0)