Skip to content

Commit d6ca382

Browse files
committed
8369335: Two sun/java2d/OpenGL tests fail on Windows after JDK-8358058
Reviewed-by: jdv
1 parent 4ca4485 commit d6ca382

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

test/jdk/sun/java2d/OpenGL/OpaqueDest.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 6277977 6319663
26+
* @bug 6277977 6319663 8369335
2727
* @key headful
2828
* @requires (os.family != "mac")
2929
* @summary Verifies that blending operations do not inadvertantly leave
@@ -71,6 +71,7 @@ public class OpaqueDest extends Canvas {
7171

7272
private static volatile Frame frame;
7373
private static volatile OpaqueDest test;
74+
private static final int W = 100, H = 100;
7475

7576
public void paint(Graphics g) {
7677

@@ -93,7 +94,7 @@ public void paint(Graphics g) {
9394
}
9495

9596
public Dimension getPreferredSize() {
96-
return new Dimension(100, 100);
97+
return new Dimension(W, H);
9798
}
9899

99100
static void createUI() {
@@ -124,7 +125,7 @@ public static void main(String[] args) throws Exception {
124125
return;
125126
}
126127
Point pt1 = test.getLocationOnScreen();
127-
Rectangle rect = new Rectangle(pt1.x, pt1.y, 100, 100);
128+
Rectangle rect = new Rectangle(pt1.x, pt1.y, W, H);
128129
capture = robot.createScreenCapture(rect);
129130
} finally {
130131
if (frame != null) {
@@ -134,18 +135,23 @@ public static void main(String[] args) throws Exception {
134135

135136

136137
// Test all pixels (every one should be red)
137-
for (int y = 0; y < 100; y++) {
138-
for (int x = 0; x < 100; x++) {
138+
for (int y = 0; y < W; y++) {
139+
for (int x = 0; x < H; x++) {
139140
int actual = capture.getRGB(x, y);
140141
int expected = 0xffff0000;
141142
if (!similar(actual, expected)) {
142-
saveImage(capture);
143-
throw new RuntimeException("Test failed at x="+x+" y="+y+
144-
" (expected="+
145-
Integer.toHexString(expected) +
146-
" actual="+
147-
Integer.toHexString(actual) +
148-
")");
143+
String msg = "Test failed at x="+x+" y="+y+
144+
" (expected="+
145+
Integer.toHexString(expected) +
146+
" actual="+
147+
Integer.toHexString(actual) +
148+
")";
149+
if ( ( x== 0) || ( x == W) || ( y == 0) || ( y == H)) {
150+
System.err.println(msg);
151+
} else {
152+
saveImage(capture);
153+
throw new RuntimeException(msg);
154+
}
149155
}
150156
}
151157
}

test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 5104584 8237244
26+
* @bug 5104584 8237244 8369335
2727
* @key headful
2828
* @requires (os.family != "mac")
2929
* @summary Verifies that scaling an image works properly when the
@@ -105,6 +105,11 @@ private static void testRegion(BufferedImage bi,
105105
int x2 = x1 + wholeRegion.width;
106106
int y2 = y1 + wholeRegion.height;
107107

108+
int ax1 = affectedRegion.x;
109+
int ay1 = affectedRegion.y;
110+
int ax2 = ax1 + affectedRegion.width;
111+
int ay2 = ay1 + affectedRegion.height;
112+
108113
for (int y = y1; y < y2; y++) {
109114
for (int x = x1; x < x2; x++) {
110115
int actual = bi.getRGB(x, y);
@@ -128,13 +133,20 @@ private static void testRegion(BufferedImage bi,
128133
(Math.abs(red - standardRed) > TOLERANCE) ||
129134
(Math.abs(green - standardGreen) > TOLERANCE) ||
130135
(Math.abs(blue - standardBlue) > TOLERANCE)) {
131-
saveImage(bi);
132-
throw new RuntimeException("Test failed at x="+x+" y="+y+
133-
" (expected="+
134-
Integer.toHexString(expected) +
135-
" actual="+
136-
Integer.toHexString(actual) +
137-
")");
136+
137+
String msg = ("Test failed at x="+x+" y="+y+
138+
" (expected="+
139+
Integer.toHexString(expected) +
140+
" actual="+
141+
Integer.toHexString(actual) +
142+
")");
143+
// log edge pixel differences, but don't fail the test.
144+
if ((x == ax1) || (x == ax2) || (y == ay1) || (y == ay2)) {
145+
System.err.println(msg);
146+
} else {
147+
saveImage(bi);
148+
throw new RuntimeException(msg);
149+
}
138150
}
139151
}
140152
}

0 commit comments

Comments
 (0)