diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java new file mode 100644 index 00000000000..d2a21a9a93d --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a null Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal1Test + */ + +public class FileDialogAppModal1Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL, + FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java new file mode 100644 index 00000000000..e9d2b1591ee --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a null Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal2Test + */ + +public class FileDialogAppModal2Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL, + FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java new file mode 100644 index 00000000000..adc9709d928 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a hidden Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal3Test + */ + +public class FileDialogAppModal3Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java new file mode 100644 index 00000000000..9dc6149beb4 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a hidden Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal4Test + */ + +public class FileDialogAppModal4Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java new file mode 100644 index 00000000000..3bb80e399da --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a visible Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal5Test + */ + +public class FileDialogAppModal5Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL, + FileDialogFWDTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java new file mode 100644 index 00000000000..16f03f7d7d9 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks an application modal Dialog + * created with a visible Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogAppModal6Test + */ + +public class FileDialogAppModal6Test { + + public static void main(String[] args) throws Exception { + (new FileDialogDWDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java new file mode 100644 index 00000000000..045c7e5ad49 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; + + +// DWD: Dialog, Window, Dialog + +public class FileDialogDWDTest { + + private volatile FileDialog fileDialog; + private volatile ParentDialog parent; + private volatile CustomDialog dialog; + private volatile TestWindow window; + + private static final int delay = 500; + private final ExtendedRobot robot; + + boolean setModal; + + Dialog.ModalityType modalityType; + + private FileDialogDWDTest(Dialog.ModalityType modType, + boolean modal) throws Exception { + modalityType = modType; + setModal = modal; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + public FileDialogDWDTest(Dialog.ModalityType modalityType) throws Exception { + this(modalityType, false); + } + + public FileDialogDWDTest() throws Exception { + this(null, true); + } + + private void createGUI() { + + parent = new ParentDialog(); + dialog = new CustomDialog(parent); + + if (setModal) { + dialog.setModal(true); + modalityType = dialog.getModalityType(); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + window = new CustomWindow(parent); + + int x = Toolkit.getDefaultToolkit().getScreenSize().width - + parent.getWidth() - 50; + int y = 50; + parent.setLocation(x, y); + y += (parent.getHeight() + 50); + window.setLocation(x, y); + y += (window.getHeight() + 50); + dialog.setLocation(x, y); + + parent.setVisible(true); + } + + private void openAll() throws Exception { + robot.waitForIdle(delay); + parent.clickOpenButton(robot); + robot.waitForIdle(delay); + window.clickOpenButton(robot); + robot.waitForIdle(delay); + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + } + + private void checkBlockedWindows() throws Exception { + + String msg = "FileDialog should block this "; + parent.checkBlockedDialog(robot, msg + "Dialog."); + robot.waitForIdle(delay); + window.checkBlockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + dialog.checkBlockedDialog(robot, msg + "Dialog."); + robot.waitForIdle(delay); + } + + private void checkUnblockedWindows() throws Exception { + + String msg = "Blocking dialogs were closed."; + parent.checkUnblockedDialog(robot, msg + "Frame."); + robot.waitForIdle(delay); + window.checkUnblockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + } + + + private void modalTest(String type) throws Exception { + + checkBlockedWindows(); + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + String msg = "FileDialog was closed, " + + "but the " + type + " modal dialog should block this "; + + parent.checkBlockedDialog(robot, msg + "Dialog."); + robot.waitForIdle(delay); + + window.checkBlockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + + dialog.checkUnblockedDialog(robot, "FileDialog was closed."); + robot.waitForIdle(delay); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + checkUnblockedWindows(); + } + + private void nonModalTest() throws Exception { + + checkBlockedWindows(); + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + dialog.checkUnblockedDialog(robot, "FileDialog was closed."); + robot.waitForIdle(delay); + + checkUnblockedWindows(); + } + + public void doTest() throws Exception { + + try { + + openAll(); + + if (modalityType == null) { + nonModalTest(); + return; + } + + switch (modalityType) { + case APPLICATION_MODAL: + modalTest("application"); + break; + case DOCUMENT_MODAL: + modalTest("document"); + break; + case TOOLKIT_MODAL: + modalTest("toolkit"); + break; + case MODELESS: + nonModalTest(); + break; + } + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (parent != null) { parent.dispose(); } + if (dialog != null) { dialog.dispose(); } + if (window != null) { window.dispose(); } + if (fileDialog != null) { fileDialog.dispose(); } + + } + + class ParentDialog extends TestDialog { + + public ParentDialog() { super((Frame) null); } + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + } + + } + + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + fileDialog = new FileDialog((Frame) null); + fileDialog.setLocation(50, 50); + fileDialog.setVisible(true); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java new file mode 100644 index 00000000000..4ff0bcef4dc --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a null Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal1Test + */ + +public class FileDialogDocModal1Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL, + FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java new file mode 100644 index 00000000000..a8179c133aa --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a null Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal2Test + */ + +public class FileDialogDocModal2Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL, + FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java new file mode 100644 index 00000000000..5b95dbc00dc --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a hidden Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal3Test + */ + +public class FileDialogDocModal3Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java new file mode 100644 index 00000000000..0c5de04e49e --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a hidden Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal4Test + */ + +public class FileDialogDocModal4Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java new file mode 100644 index 00000000000..e27c97c5db1 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a visible Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal5Test + */ + +public class FileDialogDocModal5Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL, + FileDialogFWDTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java new file mode 100644 index 00000000000..9aa2f2ac311 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a document modal Dialog + * created with a visible Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal6Test + */ + +public class FileDialogDocModal6Test { + + public static void main(String[] args) throws Exception { + (new FileDialogDWDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java new file mode 100644 index 00000000000..d3c0a687213 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * @summary Check whether a FileDialog set to document modality behaves as expected. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogDocModal7Test + */ + +public class FileDialogDocModal7Test { + + public static void main(String[] args) throws Exception { + (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java new file mode 100644 index 00000000000..0026c0da50f --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; + + + +// FWD: Frame, Window, Dialog + +public class FileDialogFWDTest { + + private volatile FileDialog fileDialog; + private volatile CustomDialog dialog; + private volatile TestFrame frame; + private volatile TestWindow window; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private volatile Dialog hiddenDialog; + private volatile Frame hiddenFrame; + + public enum DialogOwner { + HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, FRAME}; + + private DialogOwner owner; + boolean setModal; + + Dialog.ModalityType modalityType; + + private FileDialogFWDTest(Dialog.ModalityType modType, + boolean modal, + DialogOwner o) throws Exception { + modalityType = modType; + setModal = modal; + owner = o; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + public FileDialogFWDTest(Dialog.ModalityType modalityType, + DialogOwner o) throws Exception { + this(modalityType, false, o); + } + + public FileDialogFWDTest(DialogOwner o) throws Exception { + this(null, true, o); + } + + private void createGUI() { + + frame = new CustomFrame(); + + switch (owner) { + case HIDDEN_DIALOG: + hiddenDialog = new Dialog((Frame) null); + dialog = new CustomDialog(hiddenDialog); + break; + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + case HIDDEN_FRAME: + hiddenFrame = new Frame(); + dialog = new CustomDialog(hiddenFrame); + break; + case NULL_FRAME: + dialog = new CustomDialog((Frame) null); + break; + case FRAME: + dialog = new CustomDialog(frame); + break; + } + + if (setModal) { + dialog.setModal(true); + modalityType = dialog.getModalityType(); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + window = new CustomWindow(frame); + + int x = Toolkit.getDefaultToolkit().getScreenSize().width - + frame.getWidth() - 50; + int y = 50; + frame.setLocation(x, y); + y += (frame.getHeight() + 50); + window.setLocation(x, y); + y += (window.getHeight() + 50); + dialog.setLocation(x, y); + + frame.setVisible(true); + } + + private void openAll() throws Exception { + robot.waitForIdle(delay); + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + window.clickOpenButton(robot); + robot.waitForIdle(delay); + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + } + + private void checkBlockedWindows() throws Exception { + + String msg = "FileDialog should block this "; + frame.checkBlockedFrame(robot, msg + "Frame."); + robot.waitForIdle(delay); + window.checkBlockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + dialog.checkBlockedDialog(robot, msg + "Dialog."); + robot.waitForIdle(delay); + } + + private void checkUnblockedWindows() throws Exception { + + String msg = "Blocking dialogs were closed."; + frame.checkUnblockedFrame(robot, msg + "Frame."); + robot.waitForIdle(delay); + window.checkUnblockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + } + + private void modalTest(String type) throws Exception { + + checkBlockedWindows(); + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + String msg = "FileDialog was closed, " + + "but the " + type + " modal dialog should block this "; + + frame.checkBlockedFrame(robot, msg + "Frame."); + robot.waitForIdle(delay); + + window.checkBlockedWindow(robot, msg + "Window."); + robot.waitForIdle(delay); + + dialog.checkUnblockedDialog(robot, "FileDialog was closed."); + robot.waitForIdle(delay); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + checkUnblockedWindows(); + } + + private void docModalTest() throws Exception { + + if (owner == DialogOwner.FRAME) { + + checkBlockedWindows(); + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + String msg = "FileDialog was closed."; + + dialog.checkUnblockedDialog(robot, msg); + robot.waitForIdle(delay); + + msg += " But the blocking document modal dialog is still open."; + + frame.checkBlockedFrame(robot, msg); + robot.waitForIdle(delay); + + window.checkBlockedWindow(robot, msg); + robot.waitForIdle(delay); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + checkUnblockedWindows(); + + } else { + nonModalTest(); + } + } + + private void nonModalTest() throws Exception { + + checkBlockedWindows(); + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + dialog.checkUnblockedDialog(robot, "FileDialog was closed."); + robot.waitForIdle(delay); + + checkUnblockedWindows(); + } + + public void doTest() throws Exception { + + try { + openAll(); + + if (modalityType == null) { + nonModalTest(); + return; + } + + switch (modalityType) { + case APPLICATION_MODAL: + modalTest("application"); + break; + case DOCUMENT_MODAL: + docModalTest(); + break; + case TOOLKIT_MODAL: + modalTest("toolkit"); + break; + case MODELESS: + nonModalTest(); + break; + } + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if (frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + if (fileDialog != null) { fileDialog.dispose(); } + if (hiddenDialog != null) { hiddenDialog.dispose(); } + if (hiddenFrame != null) { hiddenFrame.dispose(); } + } + + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog d) { super(d); } + public CustomDialog(Frame f) { super(f); } + + @Override + public void doOpenAction() { + fileDialog = new FileDialog((Frame) null); + fileDialog.setLocation(50, 50); + fileDialog.setVisible(true); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Frame f) { super(f); } + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java new file mode 100644 index 00000000000..f9cae23b85e --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a null Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal1Test + */ + +public class FileDialogModal1Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest( + FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java new file mode 100644 index 00000000000..037f5969081 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a null Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal2Test + */ + +public class FileDialogModal2Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest( + FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java new file mode 100644 index 00000000000..b2423e35827 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a hidden Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal3Test + */ + +public class FileDialogModal3Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest( + FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java new file mode 100644 index 00000000000..0899eb39d4d --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a hidden Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal4Test + */ + +public class FileDialogModal4Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest( + FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java new file mode 100644 index 00000000000..d2940397a69 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a visible Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal5Test + */ + +public class FileDialogModal5Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest( + FileDialogFWDTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java new file mode 100644 index 00000000000..8cbee49e871 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a modal Dialog + * created with a visible Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogModal6Test + */ + +public class FileDialogModal6Test { + + public static void main(String[] args) throws Exception { + (new FileDialogDWDTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java new file mode 100644 index 00000000000..7f69d6176d0 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; + +public class FileDialogModalityTest { + + private volatile TestDialog dialog; + private volatile ParentFrame parent; + private volatile TestWindow window; + private volatile FileDialog fileDialog; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + + public static void main(String[] args) throws Exception { + (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest(); + } + + public FileDialogModalityTest(Dialog.ModalityType t) throws Exception { + modalityType = t; + robot = new ExtendedRobot(); + } + + private void createGUI() { + + parent = new ParentFrame(); + dialog = new CustomDialog((Frame) null); + window = new CustomWindow(parent); + + int x = Toolkit.getDefaultToolkit().getScreenSize().width - + parent.getWidth() - 50; + int y = 50; + + parent.setLocation(x, y); + y += (parent.getHeight() + 50); + window.setLocation(x, y); + y += (window.getHeight() + 50); + dialog.setLocation(x, y); + + parent.setVisible(true); + } + + private void startTest() throws Exception { + + EventQueue.invokeLater(this::createGUI); + + robot.waitForIdle(delay); + parent.clickOpenButton(robot); + robot.waitForIdle(delay); + window.clickOpenButton(robot); + robot.waitForIdle(delay); + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + } + + private void checkUnblockedWindows() throws Exception { + + String msg = " should not be blocked."; + parent.checkUnblockedFrame (robot, "This frame" + msg); + robot.waitForIdle(delay); + window.checkUnblockedWindow(robot, "This window" + msg); + robot.waitForIdle(delay); + dialog.checkUnblockedDialog(robot, "This dialog" + msg); + robot.waitForIdle(delay); + } + + private void checkBlockedWindows() throws Exception { + + String msg = " should be blocked by the FileDialog."; + parent.checkBlockedFrame (robot, "This Frame" + msg); + robot.waitForIdle(delay); + window.checkBlockedWindow(robot, "This Window" + msg); + robot.waitForIdle(delay); + dialog.checkBlockedDialog(robot, "This Dialog" + msg); + robot.waitForIdle(delay); + } + + private void docModalTest() throws Exception { + + String msg = "Document modal FileDialog should "; + parent.checkUnblockedFrame (robot, msg + "not block this Frame."); + robot.waitForIdle(delay); + window.checkUnblockedWindow(robot, msg + "not block this Window."); + robot.waitForIdle(delay); + dialog.checkBlockedDialog(robot, msg + "block its parent Dialog."); + robot.waitForIdle(delay); + } + + public void doTest() throws Exception { + + try { + startTest(); + + switch (modalityType) { + case APPLICATION_MODAL: + case TOOLKIT_MODAL: + checkBlockedWindows(); + break; + case DOCUMENT_MODAL: + docModalTest(); + break; + case MODELESS: + checkUnblockedWindows(); + break; + } + + EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); + robot.waitForIdle(delay); + + if (modalityType != Dialog.ModalityType.MODELESS) { + checkUnblockedWindows(); + } + } finally { + EventQueue.invokeLater(this::closeAll); + } + } + + private void closeAll() { + if (parent != null) { parent.dispose(); } + if (dialog != null) { dialog.dispose(); } + if (window != null) { window.dispose(); } + if (fileDialog != null) { fileDialog.dispose(); } + } + + class ParentFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { super(f); } + + @Override + public void doOpenAction() { + fileDialog = new FileDialog(this); + fileDialog.setModalityType(modalityType); + fileDialog.setLocation(50, 50); + fileDialog.setVisible(true); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(TestFrame f) { super(f); } + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java new file mode 100644 index 00000000000..b941c09865d --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 7186009 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a null Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal1Test + */ + +public class FileDialogNonModal1Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(null, + FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java new file mode 100644 index 00000000000..a35d39f5252 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a null Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal2Test + */ + +public class FileDialogNonModal2Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(null, + FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java new file mode 100644 index 00000000000..83b7a468a21 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a hidden Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal3Test + */ + +public class FileDialogNonModal3Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(null, + FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java new file mode 100644 index 00000000000..b7d1641132f --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a hidden Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal4Test + */ + +public class FileDialogNonModal4Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(null, + FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java new file mode 100644 index 00000000000..d2ff38ade9a --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a visible Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal5Test + */ + +public class FileDialogNonModal5Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(null, + FileDialogFWDTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java new file mode 100644 index 00000000000..49b5ce07dac --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8054359 + * + * @summary Check whether FileDialog blocks a non-modal Dialog + * created with a visible Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal6Test + */ + +public class FileDialogNonModal6Test { + + public static void main(String[] args) throws Exception { + (new FileDialogDWDTest(null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java new file mode 100644 index 00000000000..3712112dd3c --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 + * @summary Check whether a modeless FileDialog behaves as expected. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogNonModal7Test + */ + +public class FileDialogNonModal7Test { + + public static void main(String[] args) throws Exception { + (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java new file mode 100644 index 00000000000..b9c6e05284c --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a null Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal1Test + */ + +public class FileDialogTKModal1Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL, + FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java new file mode 100644 index 00000000000..36db1d01775 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a null Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal2Test + */ + +public class FileDialogTKModal2Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL, + FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java new file mode 100644 index 00000000000..99a177aa386 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a hidden Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal3Test + */ + +public class FileDialogTKModal3Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java new file mode 100644 index 00000000000..abc6cb60232 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a hidden Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal4Test + */ + +public class FileDialogTKModal4Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL, + FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java new file mode 100644 index 00000000000..8e84650dd29 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a visible Frame constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal5Test + */ + +public class FileDialogTKModal5Test { + + public static void main(String[] args) throws Exception { + (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL, + FileDialogFWDTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java new file mode 100644 index 00000000000..4e0d1d1b481 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 8055752 + * + * @summary Check whether FileDialog blocks a toolkit modal Dialog + * created with a visible Dialog constructor. Also check if other + * windows are blocked by the FileDialog too. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal6Test + */ + +public class FileDialogTKModal6Test { + + public static void main(String[] args) throws Exception { + (new FileDialogDWDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java new file mode 100644 index 00000000000..f4a2ac34692 --- /dev/null +++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8054359 7186009 + * @summary Check whether a FileDialog set to toolkit modality behaves as expected. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FileDialogTKModal7Test + */ + +public class FileDialogTKModal7Test { + + public static void main(String[] args) throws Exception { + (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +}