Skip to content

Commit

Permalink
tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
azvegint committed Dec 4, 2023
1 parent 328d33f commit 2ed7c83
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
5 changes: 2 additions & 3 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all

java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
Expand Down Expand Up @@ -651,6 +652,7 @@ javax/sound/sampled/Clip/ClipIsRunningAfterStop.java 8307574 linux-x64

javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all

javax/swing/JFrame/MaximizeWindowTest.java 8321289 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedTranslucentPerPixelTranslucentGradient.java 8233582 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java 8233582 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 8194128 macosx-all
Expand Down Expand Up @@ -683,9 +685,6 @@ sanity/client/SwingSet/src/EditorPaneDemoTest.java 8212240 linux-x64

# jdk_swing Ubuntu 23.04 specific

javax/swing/JTree/8003400/Test8003400.java 8309734 linux-all
javax/swing/JTable/7124218/SelectEditTableCell.java 8309734 linux-all
javax/swing/JFileChooser/JFileChooserSetLocationTest.java 8309734 linux-all
javax/swing/JComboBox/TestComboBoxComponentRendering.java 8309734 linux-all

############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@
import java.awt.event.KeyEvent;

public class NestedModalDialogTest {
private static Frame frame;
private static StartFrame frame;
private static IntermediateDialog interDiag;
private static TextDialog txtDiag;

// Global variables so the robot thread can locate things.
private static Button[] robot_button = new Button[2];
private static TextField robot_text = null;
private static Robot robot = null;

Expand All @@ -78,6 +77,9 @@ private static void blockTillDisplayed(Component comp) {
}

private static void clickOnComp(Component comp) {
robot.waitForIdle();
robot.delay(1000);

Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize());
robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
robot.waitForIdle();
Expand All @@ -94,11 +96,11 @@ public void testModalDialogs() throws Exception {
// launch first frame with firstButton
frame = new StartFrame();
blockTillDisplayed(frame);
clickOnComp(robot_button[0]);
clickOnComp(frame.button);

// Dialog must be created and onscreen before we proceed.
blockTillDisplayed(interDiag);
clickOnComp(robot_button[1]);
clickOnComp(interDiag.button);

// Again, the Dialog must be created and onscreen before we proceed.
blockTillDisplayed(robot_text);
Expand Down Expand Up @@ -144,6 +146,8 @@ public void testModalDialogs() throws Exception {
*/
class StartFrame extends Frame {

public volatile Button button;

/**
* Constructs a new instance.
*/
Expand All @@ -168,7 +172,7 @@ public void actionPerformed(ActionEvent e) {
pan.add(but);
add(pan);
setVisible(true);
robot_button[0] = but;
button = but;
}
}

Expand All @@ -177,6 +181,7 @@ public void actionPerformed(ActionEvent e) {
class IntermediateDialog extends Dialog {

Dialog m_parent;
public volatile Button button;

public IntermediateDialog(Frame parent) {
super(parent, "Intermediate Modal", true /*Modal*/);
Expand All @@ -193,9 +198,7 @@ public void actionPerformed(ActionEvent e) {
pan.add(but);
add(pan);
pack();

// The robot needs to know about us, so set global
robot_button[1] = but;
button = but;
}
}

Expand All @@ -215,12 +218,12 @@ public TextDialog(Dialog parent) {
}
}

public static void main(String[] args) throws RuntimeException, Exception {
public static void main(String[] args) throws Exception {
try {
new NestedModalDialogTest().testModalDialogs();
} catch (Exception e) {
throw new RuntimeException("NestedModalDialogTest object creation "
+ "failed");
+ "failed", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void start() {
window.setVisible(true);

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

test();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static void testSplash(ImageInfo test) throws Exception {
static void testFocus() throws Exception {

Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(50);

Frame frame = new Frame();
Expand All @@ -130,6 +131,7 @@ static void testFocus() throws Exception {
frame.add(textField);
frame.setVisible(true);
robot.waitForIdle();
robot.delay(1000);

robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
Expand Down
3 changes: 3 additions & 0 deletions test/jdk/javax/swing/JRootPane/DefaultButtonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void createUI() {

public void runTest() throws Exception {
Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(100);
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
try {
Expand All @@ -100,6 +101,8 @@ public void runTest() throws Exception {
createUI();
});
robot.waitForIdle();
robot.delay(1000);

robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.waitForIdle();
Expand Down
4 changes: 4 additions & 0 deletions test/jdk/javax/swing/JTree/8003400/Test8003400.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public void run() {

Robot robot = new Robot();
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
robot.waitForIdle();
robot.delay(500);

SwingUtilities.invokeAndWait(() -> {
point = tree.getLocationOnScreen();
rect = tree.getBounds();
Expand Down

0 comments on commit 2ed7c83

Please sign in to comment.