10000 TST: Use shapes instead of actual text for layout manager tests · Issue #29825 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

TST: Use shapes instead of actual text for layout manager tests #29825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jklymak opened this issue Mar 28, 2025 · 0 comments
Open

TST: Use shapes instead of actual text for layout manager tests #29825

jklymak opened this issue Mar 28, 2025 · 0 comments

Comments

@jklymak
Copy link
Member
jklymak commented Mar 28, 2025

If we are going to go through and re-generate a lot of test images it should be coupled with an audit of if that image actually needs text in it and switching them to the new defaults.

Originally posted by @tacaswell in #16447

Currently the layout managers main job is to avoid overwriting text between subplots on a page. They currently use image tests to check that this works, and those image tests change a fair bit if kerning or glyphs change in the font management.

I think most, if not all, of these tests could be changed to replace the text with shapes. Maybe even automatically - eg instead of "remove text" we have "shapify-text", where it gets a nominal text size from rcParams and makes a nominal shape in the correct spot of the correct, but nominal, size. eg it does not use the actual size of any text elements as rendered, but says its 12-pt font, x characters, so we make a box that is 14 points by 13*x points large centered where the label should go. If these tests were made deterministic this way, then they could even possibly drop the image tests and just test the position of the axes, which is what the layout engines do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0