slint
slint copied to clipboard
Provide a test case for text elision and letter spacing
Along with this test case comes a change to the font selection in the software renderer to always prefer embedded bitmap fonts. This way when running cargo test -p test-driver-screenshots the pixel fonts are used (as before this patch) as well as in the CI, when all features are enabled (including "systemfonts").
Note that PR #2134 clipping stuff is already covered by #2139 (it failed when the 2134 was not there)
This at least test a bunch of other properties like elide and letter-spacing and some other alignment.
(but it would be nice if the text elision was visible)
Ahh, good point. Shall I simplify the test case to not do clipping but show elision and letter spacing?
Suggestion for test case that test elision and an added letter spacing. I'd prefer a positive value for the letter spacing, because I think that's more realistic choice for real-life use of the property.
export component TestCase inherits Window {
width: 64px;
height: 64px;
Text {
text: "Elide me please for I am a very long paragraph";
wrap: word-wrap;
overflow: elide;
font-size: 10px;
height: 40px;
width: 100%;
letter-spacing: 3px;
}
}
Oh, that's not a good test case in fact, because it shows a bug that the letter spacing ruins the elision :)
It works with the software renderer though ;), so a bug in femtovg.

That's a bug :p. The elision should only be applied to the last line when we run out of height and there are still glyphs left to place.
I'm leaning towards a separate PR, but can also combine if you prefer.
I'm leaning towards a separate PR, but can also combine if you prefer.
We shouldn't have a test that enforce a bug :-)
But this doesn't have to be fixed now.
Just to be explicit about this change.
- i think it's important to default to embedded fonts when they are there because that's the only way to test it on desktop.
- the test itself doesn't hurt much. But also doesn't help much, so that's just 1.8K "wasted" in the history
I agree. Ok, I'll push a change to prefer embedded fonts over system fonts into master directly, and keep this PR for the elision issue.