RFR: 8280020: Underline and line-through not straight in WebView [v3]

Kevin Rushforth kcr at openjdk.java.net
Wed Feb 23 01:28:49 UTC 2022


On Mon, 21 Feb 2022 01:57:29 GMT, Jay Bhaskar <duke at openjdk.java.net> wrote:

>> tests/system/src/test/java/test/javafx/scene/web/StraightLineTest.java line 105:
>> 
>>> 103:         Platform.runLater(() -> {
>>> 104:             webView = new WebView();
>>> 105:             Scene scene = new Scene(webView,80,60);
>> 
>> This test passes on my Windows system even without the fix. Based on what I see on the screen, I think its because the scene size is too small. I would make it larger (at least 150x100). 
>> 
>> Minor: add a space after the commas to separate the args
>
> space added, i will look this observation on windows

I can confirm that even on Mac, the only reason that this test passes -- and it does so either with or without the fix -- is because the window size is too small. You need to make the Scene larger. I recommend this:


    new Scene(webView, 200, 150);


It's generally better to set the size of the scene rather than the stage for tests like this -- especially since you are taking a snapshot of the scene.

>> tests/system/src/test/java/test/javafx/scene/web/StraightLineTest.java line 167:
>> 
>>> 165:             int line_start_y = start_y + height;
>>> 166:             String line_color = "rgba(0,0,0,255)"; // color of line
>>> 167:             for (int i = line_start_y; i < snapshot.getHeight(); i++) {
>> 
>> The snapshot height is irrelevant. You should use thickness minus 6 (3 pixels on each of the top and bottom):
>> 
>> 
>>     i < line_start_y + thickness - 6;
>
> I think it should be like        for (int i = line_start_y; i <= (width - line_start_y -6); i++) , as we need to iterate in x direction

No, see my earlier comment. it needs to use thickness (which is the height of the line) not width.

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

PR: https://git.openjdk.java.net/jfx/pull/731


More information about the openjfx-dev mailing list