Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8239312: [macos] javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame…
….java

Reviewed-by: serb
  • Loading branch information
prsadhuk committed Mar 26, 2020
1 parent 5456438 commit 40e667c174269a73cd9b5612673c5e4b2293d6c0
Showing with 9 additions and 1 deletion.
  1. +9 −1 test/jdk/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java
@@ -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 @@ public static void main(final String[] args) throws Exception {
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;
}
}

0 comments on commit 40e667c

Please sign in to comment.