TST: Set tests touched by text overhaul to mpl20 style#31300
TST: Set tests touched by text overhaul to mpl20 style#31300QuLogic wants to merge 7 commits intomatplotlib:text-overhaulfrom
Conversation
There was a problem hiding this comment.
The test forces a low DPI, but I guess this is okay.
There was a problem hiding this comment.
probably an attempt to save space?
There was a problem hiding this comment.
Again a low DPI, but probably okay?
There was a problem hiding this comment.
same as below, probably to save space? Came in like this from 94d044e
lib/matplotlib/tests/baseline_images/test_axes/bar_tick_label_multiple_old_label_alignment.png
Show resolved
Hide resolved
There was a problem hiding this comment.
This one seems like it might be wrong, given the red is a bit different, but it could be an illusion since the border is gone.
There was a problem hiding this comment.
We need to set the legend.framealpha rcparam to None to get this test back.
There was a problem hiding this comment.
With the new style, ticks on top/right spines are turned off. I'm not sure if we want to re-enable them here, mostly for aesthetic reasons; it's not really relevant to the test per se.
There was a problem hiding this comment.
I'm in favor of turning them back on, but no strong feeling either way.
There was a problem hiding this comment.
Bit uncertain why this moved so much; I guess because text is in physical units, while everything else was scaled down for the smaller figure size. I'll try a larger figure to see if it matches again.
There was a problem hiding this comment.
the figure got smaller in real units, the text stayed the same size in real units, the limits stayed the same in data units, so the text takes up more space in data units.
Either restore the old figure size in inches or make the range of points we try to hit bigger.
There was a problem hiding this comment.
OK, made it bigger and it looks much closer to what it used to be.
|
|
||
| @image_comparison(['test_stairs_options.png'], remove_text=True) | ||
| @image_comparison(['test_stairs_options.png'], style='mpl20', remove_text=True) | ||
| def test_stairs_options(): |
There was a problem hiding this comment.
I have not yet investigated yet, but this test actually breaks after changing styles:
__________________ test_stairs_options[png] ___________________
args = (), kwds = {'extension': 'png', 'request': <FixtureRequest for <Function test_stairs_options[png]>>}
@wraps(func)
def inner(*args, **kwds):
with self._recreate_cm():
> return func(*args, **kwds)
/usr/lib64/python3.13/contextlib.py:85:
_ _ _ _ _ _ _ _ _ _ _ _
lib/matplotlib/figure.py:3508: in savefig
self.canvas.print_figure(fname, **kwargs)
lib/matplotlib/backend_bases.py:2275: in print_figure
result = print_method(
lib/matplotlib/backend_bases.py:2132: in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
lib/matplotlib/backends/backend_agg.py:539: in print_png
self._print_pil(filename_or_obj, "png", pil_kwargs, metadata)
lib/matplotlib/backends/backend_agg.py:487: in _print_pil
FigureCanvasAgg.draw(self)
lib/matplotlib/backends/backend_agg.py:440: in draw
self.figure.draw(self.renderer)
lib/matplotlib/artist.py:94: in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/figure.py:3275: in draw
mimage._draw_list_compositing_images(
lib/matplotlib/image.py:133: in _draw_list_compositing_images
a.draw(renderer)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/axes/_base.py:3282: in draw
mimage._draw_list_compositing_images(
lib/matplotlib/image.py:133: in _draw_list_compositing_images
a.draw(renderer)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/patches.py:740: in draw
self._draw_paths_with_artist_properties(
lib/matplotlib/patches.py:723: in _draw_paths_with_artist_properties
gc.set_dashes(*self._dash_pattern)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <matplotlib.backend_bases.GraphicsContextBase object at 0x7f3016ba3750>, dash_offset = 0.0, dash_list = [0.0, 0.0]
def set_dashes(self, dash_offset, dash_list):
"""
Set the dash style for the gc.
Parameters
----------
dash_offset : float
Distance, in points, into the dash pattern at which to
start the pattern. It is usually set to 0.
dash_list : array-like or None
The on-off sequence as points. None specifies a solid line. All
values must otherwise be non-negative (:math:`\\ge 0`).
Notes
-----
See p. 666 of the PostScript
`Language Reference
<https://www.adobe.com/jp/print/postscript/pdfs/PLRM.pdf>`_
for more info.
"""
if dash_list is not None:
dl = np.asarray(dash_list)
if np.any(dl < 0.0):
raise ValueError(
"All values in the dash list must be non-negative")
if dl.size and not np.any(dl > 0.0):
> raise ValueError(
'At least one value in the dash list must be positive')
E ValueError: At least one value in the dash list must be positive
lib/matplotlib/backend_bases.py:897: ValueError
42792b2 to
8109dbb
Compare
- `test_backend_ps::test_type3_font` is covered by `test_backend_ps::test_multi_font_type3` - `test_text::test_pdf_chars_beyond_bmp` is covered by `test_backend_pdf::test_multi_font_type3` and `test_backend_pdf::test_multi_font_type42` - `test_text::test_pdf_kerning` is covered by `test_backend_pdf::test_kerning` - `test_text::test_pdf_type42_kerning` is covered by `test_backend_pdf::test_kerning`
8109dbb to
1403060
Compare
These tests had previously kept some code or settings to prevent regenerating the test image, but since they are now going to be regenerated from the text overhaul, we can remove those.
1403060 to
c0ccc2f
Compare
PR summary
This is based on several other PRs to make it easier for me to track what needs changing. I will rebase those extra commits out once ready.
The first commit changes all related tests to
mpl20, while the second commit changes a few so that they better work in the new style (e.g., moves a transparent legend over top something so that you can actually confirm that it's transparent.) I do expect to squash these together, but kept them separate so that it'd be easier to review the secondary changes.AI Disclosure
None
PR checklist