On Tue, 26 Mar 2024 20:40:11 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

> If I write a test that uses the StubToolkit, one that requires some kind of 
> font metrics - would that work? Will I get some kind of semi-valid values for 
> preferred width of a text (Text, Labeled, etc.), or I cannot really rely on 
> the correctness of the StubTextLayout?

Yes, it should! Especially with the hopefully more clear rules here. I added 
more javadoc in my last commit and used the System font as fallback since this 
is more aligned with what JavaFX is doing. Local tests seems fine, but we will 
see here.

You could for example put a `Label` inside a container with the (max) width of 
100px. With a normal font (size=12), 8 characters should be good (8x12=96), 
while 9 characters should make the `Label` truncated since we exceed the 100 
pixels then. This is close to what JavaFX is doing, while you can still write a 
Headless tests about the basic rules of the truncated property.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1422#issuecomment-2021445366

Reply via email to