8255916: [macos] javax/swing/JInternalFrame/6647340/bug6647340.java timed out
Reviewed-by: serb
This commit is contained in:
parent
8638cd9acf
commit
35284e4667
@ -26,9 +26,6 @@
|
||||
* @bug 6647340
|
||||
* @summary Checks that iconified internal frame follows
|
||||
* the main frame borders properly.
|
||||
* @author Mikhail Lapshin
|
||||
* @library /lib/client/
|
||||
* @build ExtendedRobot
|
||||
* @run main bug6647340
|
||||
*/
|
||||
|
||||
@ -38,22 +35,22 @@ import java.beans.PropertyVetoException;
|
||||
|
||||
public class bug6647340 {
|
||||
private JFrame frame;
|
||||
private Point location;
|
||||
private volatile Point location;
|
||||
private volatile Point iconloc;
|
||||
private JInternalFrame jif;
|
||||
private static ExtendedRobot robot = createRobot();
|
||||
private static Robot robot;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
final bug6647340 test = new bug6647340();
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
test.setupUI();
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeAndWait(() -> test.setupUI());
|
||||
robot.waitForIdle();
|
||||
robot.delay(1000);
|
||||
test.test();
|
||||
} finally {
|
||||
if (test.frame != null) {
|
||||
test.frame.dispose();
|
||||
SwingUtilities.invokeAndWait(() -> test.frame.dispose());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,77 +74,69 @@ public class bug6647340 {
|
||||
}
|
||||
|
||||
private void test() throws Exception {
|
||||
sync();
|
||||
test1();
|
||||
sync();
|
||||
|
||||
robot.waitForIdle();
|
||||
robot.delay(500);
|
||||
check1();
|
||||
sync();
|
||||
robot.waitForIdle();
|
||||
|
||||
test2();
|
||||
sync();
|
||||
robot.waitForIdle();
|
||||
robot.delay(500);
|
||||
check2();
|
||||
}
|
||||
|
||||
private void test1() throws Exception {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
setIcon(true);
|
||||
location = jif.getDesktopIcon().getLocation();
|
||||
Dimension size = frame.getSize();
|
||||
frame.setSize(size.width + 100, size.height + 100);
|
||||
}
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
setIcon(true);
|
||||
location = jif.getDesktopIcon().getLocation();
|
||||
Dimension size = frame.getSize();
|
||||
frame.setSize(size.width + 100, size.height + 100);
|
||||
});
|
||||
}
|
||||
|
||||
private void test2() throws Exception {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
setIcon(false);
|
||||
}
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
setIcon(false);
|
||||
});
|
||||
sync();
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
Dimension size = frame.getSize();
|
||||
frame.setSize(size.width - 100, size.height - 100);
|
||||
}
|
||||
robot.waitForIdle();
|
||||
robot.delay(500);
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
Dimension size = frame.getSize();
|
||||
frame.setSize(size.width - 100, size.height - 100);
|
||||
});
|
||||
sync();
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
setIcon(true);
|
||||
}
|
||||
robot.waitForIdle();
|
||||
robot.delay(500);
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
setIcon(true);
|
||||
});
|
||||
}
|
||||
|
||||
private void check1() {
|
||||
if (!jif.getDesktopIcon().getLocation().equals(location)) {
|
||||
private void check1() throws Exception {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
iconloc = jif.getDesktopIcon().getLocation();
|
||||
});
|
||||
if (!iconloc.equals(location)) {
|
||||
System.out.println("First test passed");
|
||||
} else {
|
||||
throw new RuntimeException("Icon isn't shifted with the frame bounds");
|
||||
}
|
||||
}
|
||||
|
||||
private void check2() {
|
||||
if (jif.getDesktopIcon().getLocation().equals(location)) {
|
||||
private void check2() throws Exception {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
iconloc = jif.getDesktopIcon().getLocation();
|
||||
});
|
||||
if (iconloc.equals(location)) {
|
||||
System.out.println("Second test passed");
|
||||
} else {
|
||||
throw new RuntimeException("Icon isn't located near the frame bottom");
|
||||
}
|
||||
}
|
||||
|
||||
private static void sync() {
|
||||
robot.waitForIdle();
|
||||
}
|
||||
private static ExtendedRobot createRobot() {
|
||||
try {
|
||||
ExtendedRobot robot = new ExtendedRobot();
|
||||
return robot;
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Error("Unexpected Failure");
|
||||
}
|
||||
}
|
||||
|
||||
private void setIcon(boolean b) {
|
||||
try {
|
||||
jif.setIcon(b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user