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 }
0 commit comments