On Wed, 16 Nov 2022 04:08:44 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> Jayathirth D V has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Enable DirectDraw/GDI test
>
> test/jdk/sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java
> line 126:
>
>> 124: robot.mouseMove(0,0);
>> 125: } catch (AWTException ex) {
>> 126: System.err.println("Robot creation failed,
>> continuing.");
>
> Not sure if we should continue here as createScreenCapture is being used down
> below which would result in NPE
> Also this try-block is for creation so I think setAutoDelay and mouseMove
> needs to be moved out of this block..
> Also, better to use try-finally block to do frame.dispose()
We will not throw NPE if robot is null. Because we have null check for robot
when we want to use it.
This test was originally written to check for crash after producing artifacts,
thats why i think we continue to drawImage onto resizing frame even if Robot
fails. So its better if we keep it that way.
Also initially i used mouseMove() before we do screen capture, but this was
causing considerably lag in drawing on my local mac machine. So i have kept it
in initialization logic and i can see that mouse moves to (0, 0) and stays
there until the test is completed. Next operation we do after this mouseMove is
screenCapture. So keeping autodelay here or later should not matter.
I have moved whole logic under try block and disposing frame under finally
block.
-------------
PR: https://git.openjdk.org/jdk/pull/11158