8369335: Two sun/java2d/OpenGL tests fail on Windows after JDK-8358058

Reviewed-by: jdv
This commit is contained in:
Phil Race 2025-10-14 03:33:23 +00:00
parent 4ca4485e9a
commit d6ca382f4e
2 changed files with 38 additions and 20 deletions

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 6277977 6319663
* @bug 6277977 6319663 8369335
* @key headful
* @requires (os.family != "mac")
* @summary Verifies that blending operations do not inadvertantly leave
@ -71,6 +71,7 @@ public class OpaqueDest extends Canvas {
private static volatile Frame frame;
private static volatile OpaqueDest test;
private static final int W = 100, H = 100;
public void paint(Graphics g) {
@ -93,7 +94,7 @@ public class OpaqueDest extends Canvas {
}
public Dimension getPreferredSize() {
return new Dimension(100, 100);
return new Dimension(W, H);
}
static void createUI() {
@ -124,7 +125,7 @@ public class OpaqueDest extends Canvas {
return;
}
Point pt1 = test.getLocationOnScreen();
Rectangle rect = new Rectangle(pt1.x, pt1.y, 100, 100);
Rectangle rect = new Rectangle(pt1.x, pt1.y, W, H);
capture = robot.createScreenCapture(rect);
} finally {
if (frame != null) {
@ -134,18 +135,23 @@ public class OpaqueDest extends Canvas {
// Test all pixels (every one should be red)
for (int y = 0; y < 100; y++) {
for (int x = 0; x < 100; x++) {
for (int y = 0; y < W; y++) {
for (int x = 0; x < H; x++) {
int actual = capture.getRGB(x, y);
int expected = 0xffff0000;
if (!similar(actual, expected)) {
saveImage(capture);
throw new RuntimeException("Test failed at x="+x+" y="+y+
" (expected="+
Integer.toHexString(expected) +
" actual="+
Integer.toHexString(actual) +
")");
String msg = "Test failed at x="+x+" y="+y+
" (expected="+
Integer.toHexString(expected) +
" actual="+
Integer.toHexString(actual) +
")";
if ( ( x== 0) || ( x == W) || ( y == 0) || ( y == H)) {
System.err.println(msg);
} else {
saveImage(capture);
throw new RuntimeException(msg);
}
}
}
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 5104584 8237244
* @bug 5104584 8237244 8369335
* @key headful
* @requires (os.family != "mac")
* @summary Verifies that scaling an image works properly when the
@ -105,6 +105,11 @@ public class ScaleParamsOOB extends Panel {
int x2 = x1 + wholeRegion.width;
int y2 = y1 + wholeRegion.height;
int ax1 = affectedRegion.x;
int ay1 = affectedRegion.y;
int ax2 = ax1 + affectedRegion.width;
int ay2 = ay1 + affectedRegion.height;
for (int y = y1; y < y2; y++) {
for (int x = x1; x < x2; x++) {
int actual = bi.getRGB(x, y);
@ -128,13 +133,20 @@ public class ScaleParamsOOB extends Panel {
(Math.abs(red - standardRed) > TOLERANCE) ||
(Math.abs(green - standardGreen) > TOLERANCE) ||
(Math.abs(blue - standardBlue) > TOLERANCE)) {
saveImage(bi);
throw new RuntimeException("Test failed at x="+x+" y="+y+
" (expected="+
Integer.toHexString(expected) +
" actual="+
Integer.toHexString(actual) +
")");
String msg = ("Test failed at x="+x+" y="+y+
" (expected="+
Integer.toHexString(expected) +
" actual="+
Integer.toHexString(actual) +
")");
// log edge pixel differences, but don't fail the test.
if ((x == ax1) || (x == ax2) || (y == ay1) || (y == ay2)) {
System.err.println(msg);
} else {
saveImage(bi);
throw new RuntimeException(msg);
}
}
}
}