Add machinery for png-only, single-font mathtext tests.#19261
Add machinery for png-only, single-font mathtext tests.#19261QuLogic merged 3 commits intomatplotlib:masterfrom
Conversation
| horizontalalignment='center', verticalalignment='center') | ||
|
|
||
|
|
||
| font_tests = list(filter(lambda x: x[1] is not None, enumerate(font_tests))) |
There was a problem hiding this comment.
I think this filtering should stay right below the definition of font_tests, because it's only a helper to sanetize the list (namely, to skip deleted tests).
There was a problem hiding this comment.
I added another commit (actually, a first commit) to factor out test skipping for all of mathtext_rendering, mathtext_rendering_lightweight, and mathfont_rendering.
Just pytest.skip()ping them in the baseline_images fixture will avoid having to duplicate the logic in the upcoming png-only tests.
(For the sqrt test added below, each font adds ~2k to the size of the baseline image file.)
86f97b2 to
7f7fad9
Compare
| # default) and only png outputs, in order to minimize the size of baseline | ||
| # images. | ||
| lightweight_math_tests = [ | ||
| r'$\sqrt[ab]{123}$', # github issue #8665 |
There was a problem hiding this comment.
What's up with the ab alignment? It doesn't appear to follow the baseline to me, but align to top instead.
There was a problem hiding this comment.
This only appears with text.hinting = "none" (which is used by tests, but is not the default otherwise). I suspect this is just one of the vertical alignments problems mentioned in #5414.
Also manually testing with a large text size (e.g. 48) allows verifying that there is no top-alignment.
|
Thanks for doing this. Can't wait for it to be released, mainly for "noninteger bases in mathtext sqrt" which I ran in to recently. |
Alternate for #19201. png turns out to be heavier than svg-without-font embedding, but if we stick to a single font it's cheaper that testing all 5 fonts in svg. (For the sqrt test added below, each font adds ~2k to the size of the baseline image file.)
PR Summary
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).