On 3/25/20 7:09 am, Prasanta Sadhukhan wrote:
It seems there is a difference of 1 in all the color components
ok +1
x 0 y 1 img1.getRGB(x,y) ff9e9e9e img2.getRGB(x,y) ff9f9f9f
x 0 y 2 img1.getRGB(x,y) ffa2a2a2 img2.getRGB(x,y) ffa1a1a1
x 1 y 0 img1.getRGB(x,y) fff8f8f8 img2.getRGB(x,y) fff7f7f7
x 1 y 1 img1.getRGB(x,y) ff9d9d9d img2.getRGB(x,y) ff9e9e9e
x 2 y 0 img1.getRGB(x,y) fff7f7f7 img2.getRGB(x,y) fff6f6f6
x 2 y 1 img1.getRGB(x,y) ff9d9d9d img2.getRGB(x,y) ff9e9e9e
x 2 y 3 img1.getRGB(x,y) ffdadada img2.getRGB(x,y) ffd9d9d9
x 3 y 0 img1.getRGB(x,y) fff5f5f5 img2.getRGB(x,y) fff6f6f6
x 3 y 3 img1.getRGB(x,y) ffd9d9d9 img2.getRGB(x,y) ffdadada
x 4 y 2 img1.getRGB(x,y) ffa1a1a1 img2.getRGB(x,y) ff9f9f9f
x 5 y 0 img1.getRGB(x,y) fff4f4f4 img2.getRGB(x,y) fff3f3f3
…….
…...
so I added a tolerance check for each color. The test now passes in osx10.14
and without the fix of 7124513, the test fails.
diff -r 20374b37dd01
test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java
--- a/test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.javaThu Mar
19 22:22:39 2020 -0700
+++ b/test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.javaWed Mar
25 19:36:05 2020 +0530
@@ -23,6 +23,7 @@
import java.awt.Rectangle;
import java.awt.Toolkit;
+import java.awt.Color;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
@@ -78,9 +79,16 @@
private static void testImages(BufferedImage img1, BufferedImage img2,
boolean shouldbeDifferent) {
boolean different = false;
+ int tol = 5;
for (int x = 0; x < img1.getWidth(); ++x) {
for (int y = 0; y < img1.getHeight(); ++y) {
- if (img1.getRGB(x, y) != img2.getRGB(x, y)) {
+ Color c1 = new Color(img1.getRGB(x, y));
+ Color c2 = new Color(img2.getRGB(x, y));
+
+ if ((Math.abs(c1.getRed() - c2.getRed()) > tol) &&
+ (Math.abs(c1.getBlue() - c2.getBlue()) > tol) &&
+ (Math.abs(c1.getGreen() - c2.getGreen()) > tol )) {
+
different = true;
}
--
Best regards, Sergey.
--
Best regards, Sergey.