File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
jdk/test/javax/swing/JFrame/NSTexturedJFrame Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 2323
2424import java .awt .Rectangle ;
2525import java .awt .Toolkit ;
26+ import java .awt .Color ;
2627import java .awt .image .BufferedImage ;
2728
2829import javax .swing .JFrame ;
@@ -74,9 +75,16 @@ public static void main(final String[] args) throws Exception {
7475 private static void testImages (BufferedImage img1 , BufferedImage img2 ,
7576 boolean shouldbeDifferent ) {
7677 boolean different = false ;
78+ int tol = 5 ;
7779 for (int x = 0 ; x < img1 .getWidth (); ++x ) {
7880 for (int y = 0 ; y < img1 .getHeight (); ++y ) {
79- if (img1 .getRGB (x , y ) != img2 .getRGB (x , y )) {
81+ Color c1 = new Color (img1 .getRGB (x , y ));
82+ Color c2 = new Color (img2 .getRGB (x , y ));
83+
84+ if ((Math .abs (c1 .getRed () - c2 .getRed ()) > tol ) &&
85+ (Math .abs (c1 .getBlue () - c2 .getBlue ()) > tol ) &&
86+ (Math .abs (c1 .getGreen () - c2 .getGreen ()) > tol )) {
87+
8088 different = true ;
8189 }
8290 }
You can’t perform that action at this time.
0 commit comments