Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Automatic merge of client:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Jul 29, 2020
2 parents 0fa3c6a + f38fb70 commit 74618f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 49 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -760,7 +760,6 @@ javax/swing/Action/8133039/bug8133039.java 8196089 windows-all,macosx-all
javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all
javax/swing/JComboBox/8032878/bug8032878.java 8196092,8196439 windows-all,macosx-all,linux-all
javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all
javax/swing/JComponent/4337267/bug4337267.java 8146451 windows-all
javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all
javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all
javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all
Expand Down
63 changes: 15 additions & 48 deletions test/jdk/javax/swing/JComponent/4337267/bug4337267.java
Expand Up @@ -50,7 +50,6 @@ public class bug4337267 {
JComponent[] printq;
static JFrame window;
static boolean testFailed = false;
static boolean done = false;

String shaped =
"000 (E) 111 (A) \u0641\u0642\u0643 \u0662\u0662\u0662 (E) 333";
Expand All @@ -62,7 +61,6 @@ void run() {
testNonTextComponentHTML();
testNonTextComponentPlain();

doneTask();
}

void initUI() {
Expand All @@ -74,33 +72,6 @@ void initUI() {
window.setVisible(true);
}

Runnable printComponents = new Runnable() {
public void run() {
printComponent(printq[0], i1);
printComponent(printq[1], i2);
}
};

Runnable compareRasters = new Runnable() {
public void run() {
assertEquals(p1.image, p2.image);
assertEquals(i1, i2);
}
};

void doneTask() {
final Object monitor = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
done = true;
synchronized(monitor) {
monitor.notify();
}
}
});
}


void fail(String message) {
testFailed = true;
throw new RuntimeException(message);
Expand All @@ -126,8 +97,10 @@ void testTextComponent() {
area2.setText(text);
window.repaint();
printq = new JComponent[] { area1, area2 };
SwingUtilities.invokeLater(printComponents);
SwingUtilities.invokeLater(compareRasters);
printComponent(printq[0], i1);
printComponent(printq[1], i2);
assertEquals(p1.image, p2.image);
assertEquals(i1, i2);
}

void testNonTextComponentHTML() {
Expand All @@ -140,12 +113,14 @@ void testNonTextComponentHTML() {
label2.setText("<html>" + text);
window.repaint();
printq = new JComponent[] { label1, label2 };
SwingUtilities.invokeLater(printComponents);
SwingUtilities.invokeLater(compareRasters);
printComponent(printq[0], i1);
printComponent(printq[1], i2);
assertEquals(p1.image, p2.image);
assertEquals(i1, i2);
}

void testNonTextComponentPlain() {
System.out.println("testNonTextComponentHTML:");
System.out.println("testNonTextComponentPlain:");
JLabel label1 = new JLabel();
injectComponent(p1, label1, false);
label1.setText(shaped);
Expand All @@ -154,8 +129,10 @@ void testNonTextComponentPlain() {
label2.setText(text);
window.repaint();
printq = new JComponent[] { label1, label2 };
SwingUtilities.invokeLater(printComponents);
SwingUtilities.invokeLater(compareRasters);
printComponent(printq[0], i1);
printComponent(printq[1], i2);
assertEquals(p1.image, p2.image);
assertEquals(i1, i2);
}

void setShaping(JComponent c) {
Expand Down Expand Up @@ -250,25 +227,15 @@ public void paint(Graphics g) {



public static void main(String[] args) throws Throwable {
public static void main(String[] args) throws Exception {
try {
final bug4337267 test = new bug4337267();
SwingUtilities.invokeLater(new Runnable() {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
test.run();
}
});

synchronized(test) {
while (!done) {
try {
test.wait();
} catch (InterruptedException ex) {
// do nothing
}
}
}

if (testFailed) {
throw new RuntimeException("FAIL");
}
Expand Down

0 comments on commit 74618f7

Please sign in to comment.