RFR: JDK-8357082 : Stabilize and add debug logs to CopyAreaOOB.java [v4]
Harshitha Onkar
honkar at openjdk.org
Fri May 30 00:34:52 UTC 2025
On Thu, 29 May 2025 10:52:16 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> added back screencapture code to paint method
>
> test/jdk/java/awt/Graphics2D/CopyAreaOOB.java line 57:
>
>> 55: // copy the region such that part of it goes below the bottom of the
>> 56: // destination surface
>> 57: g2d.copyArea(0, 10, 50, h-10, 60, 10);
>
> The new version looks like a different test, previously we copyArea from the paint method for the awt frame, then call sync to flush all rendering, then check the rendering on screen, and all of that on "each render frame".
>
> Now it will draw everything in paint then sometime later(or even after a few repaints) we check the actual rendering(waitForIdle/delay(100))....
@mrserb
Added back Toolkit.sync() and canvas capture to paint method. I'm not sure if I understood _"each render frame"_. Can you please explain?
BufferedImage capture = null;
try {
Thread.sleep(500);
if (robot == null) robot = new Robot();
Point pt1 = getLocationOnScreen();
Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
capture = robot.createScreenCapture(rect);
} catch (Exception e) {
throw new RuntimeException("Problems handling Robot");
}
// Test pixels
testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00);
testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000);
testRegion(capture, "background", 50, 10, 60, 400, 0xff000000);
testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000);
testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000);
testRegion(capture, "background", 110, 10, 400, 400, 0xff000000);
Isn't capture going to be the same image throughout? I'm not sure why it is passed as an extra argument to testRegion. It can be saved once as static BufferedImage var and the same can be used for testing or am I missing something?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25279#discussion_r2114942573
More information about the client-libs-dev
mailing list