Skip to content

Commit

Permalink
Test changes reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Jan 28, 2021
1 parent 87d371a commit 6fdcc0d
Showing 1 changed file with 20 additions and 32 deletions.
52 changes: 20 additions & 32 deletions test/jdk/javax/swing/JColorChooser/Test6827032.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,57 +38,45 @@


public class Test6827032 {
private static JFrame frame;
private static volatile Point point;
private static JColorChooser cc;

public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
UIManager.setLookAndFeel(new NimbusLookAndFeel());

Robot robot = new Robot();
robot.setAutoDelay(100);
Robot robot = new Robot();
robot.setAutoDelay(50);

SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});

robot.waitForIdle();
robot.delay(1000);
robot.waitForIdle();

SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel");
point = previewPanel.getLocationOnScreen();
}
});
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel");
point = previewPanel.getLocationOnScreen();
}
});

point.translate(5, 5);
point.translate(5, 5);

robot.mouseMove(point.x, point.y);
robot.waitForIdle();
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
robot.delay(1000);
} finally {
if (frame != null) {
SwingUtilities.invokeAndWait(() -> frame.dispose());
}
}
robot.mouseMove(point.x, point.y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}


private static void createAndShowGUI() {
frame = new JFrame(Test6827032.class.getName());
JFrame frame = new JFrame(Test6827032.class.getName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cc = new JColorChooser();
cc.setDragEnabled(true);
frame.add(cc);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}

0 comments on commit 6fdcc0d

Please sign in to comment.