undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDAppModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDDAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDDocModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDDDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDModelessTest
|
||||
*/
|
||||
|
||||
public class BlockingDDModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest(Dialog.ModalityType.MODELESS)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDNonModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDDNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest(null)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDSetModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDDSetModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest()).doTest();
|
||||
}
|
||||
}
|
||||
124
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java
Normal file
124
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
// DD: Dialog -> Dialog
|
||||
|
||||
public class BlockingDDTest {
|
||||
|
||||
private TestDialog parent, dialog;
|
||||
|
||||
private static final int delay = 1000;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private final Dialog.ModalityType modalityType;
|
||||
private final boolean setModal;
|
||||
|
||||
private BlockingDDTest(Dialog.ModalityType modType, boolean modal) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
setModal = modal;
|
||||
robot = new ExtendedRobot();
|
||||
createGUI();
|
||||
}
|
||||
|
||||
public BlockingDDTest(Dialog.ModalityType modType) throws Exception {
|
||||
this(modType, false);
|
||||
}
|
||||
|
||||
public BlockingDDTest() throws Exception {
|
||||
this(null, true);
|
||||
}
|
||||
|
||||
|
||||
private void showParent() {
|
||||
|
||||
parent = new TestDialog((Frame) null);
|
||||
parent.setTitle("Parent");
|
||||
parent.setLocation(50, 50);
|
||||
parent.setVisible(true);
|
||||
}
|
||||
|
||||
private void showChild() {
|
||||
|
||||
dialog = new TestDialog(parent);
|
||||
if (setModal) {
|
||||
dialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setLocation(250, 50);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
private void createGUI() throws Exception {
|
||||
|
||||
EventQueue.invokeAndWait(this::showParent);
|
||||
robot.waitForIdle(delay);
|
||||
EventQueue.invokeLater(this::showChild);
|
||||
robot.waitForIdle(delay);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " +
|
||||
"did not gain focus when it became visible");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " +
|
||||
"gained the focus but lost it afterwards");
|
||||
|
||||
dialog.checkUnblockedDialog(robot, "Modal Dialog shouldn't be blocked.");
|
||||
|
||||
if ((modalityType == Dialog.ModalityType.APPLICATION_MODAL) ||
|
||||
(modalityType == Dialog.ModalityType.DOCUMENT_MODAL) ||
|
||||
(modalityType == Dialog.ModalityType.TOOLKIT_MODAL) ||
|
||||
dialog.isModal())
|
||||
{
|
||||
parent.checkBlockedDialog(robot,
|
||||
"Dialog is the parent of a visible " + modalityType + " Dialog.");
|
||||
} else {
|
||||
parent.checkUnblockedDialog(robot,
|
||||
"Dialog is the parent of a visible " + modalityType + " Dialog.");
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (parent != null) { parent.dispose(); }
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Dialog.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDDToolkitModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDDToolkitModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDFAppModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDFAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDFSetModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDFSetModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFTest()).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
// DF: Dialog -> Frame
|
||||
|
||||
public class BlockingDFTest {
|
||||
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private BlockingDFTest(Dialog.ModalityType modalityType,
|
||||
boolean setModal) throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(() -> { createGUI(modalityType, setModal); });
|
||||
}
|
||||
|
||||
public BlockingDFTest(Dialog.ModalityType modalityType) throws Exception {
|
||||
this(modalityType, false);
|
||||
}
|
||||
|
||||
public BlockingDFTest() throws Exception { this(null, true); }
|
||||
|
||||
|
||||
private void createGUI(Dialog.ModalityType modalityType,
|
||||
boolean setModal) {
|
||||
|
||||
frame = new TestFrame();
|
||||
frame.setLocation(50, 50);
|
||||
frame.setVisible(true);
|
||||
|
||||
dialog = new TestDialog((Dialog) null);
|
||||
dialog.setLocation(250, 50);
|
||||
if (setModal) {
|
||||
dialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "The 1st button did not " +
|
||||
"gain focus when the dialog became visible");
|
||||
|
||||
dialog.checkUnblockedDialog(robot, "");
|
||||
frame.checkBlockedFrame(robot, "");
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (frame != null) { frame.dispose(); }
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receives focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main BlockingDFToolkitModalTest
|
||||
*/
|
||||
|
||||
public class BlockingDFToolkitModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also if the other windows
|
||||
* receive mouse and key events.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingDFWModeless1Test
|
||||
*/
|
||||
|
||||
public class BlockingDFWModeless1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFWTest(
|
||||
BlockingDFWTest.Parent.FRAME,
|
||||
Dialog.ModalityType.MODELESS)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also if the other windows
|
||||
* receive mouse and key events.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingDFWModeless2Test
|
||||
*/
|
||||
|
||||
public class BlockingDFWModeless2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFWTest(
|
||||
BlockingDFWTest.Parent.DIALOG,
|
||||
Dialog.ModalityType.MODELESS)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also if the other windows
|
||||
* receive mouse and key events.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingDFWNonModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingDFWNonModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFWTest(
|
||||
BlockingDFWTest.Parent.FRAME, null)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a Dialog
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also if the other windows
|
||||
* receive mouse and key events.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingDFWNonModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingDFWNonModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDFWTest(
|
||||
BlockingDFWTest.Parent.DIALOG, null)).doTest();
|
||||
}
|
||||
}
|
||||
162
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java
Normal file
162
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
// DFW: Dialog -> Frame -> Window
|
||||
|
||||
public class BlockingDFWTest {
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
public enum Parent {DIALOG, FRAME};
|
||||
|
||||
private ParentDialog parentDialog;
|
||||
private ParentFrame parentFrame;
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
|
||||
public BlockingDFWTest(Parent parentWin, Dialog.ModalityType modalityType) throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(() -> { createGUI(parentWin, modalityType); });
|
||||
}
|
||||
|
||||
private void createGUI(Parent parentWin, Dialog.ModalityType modalityType) {
|
||||
|
||||
Window p = null;
|
||||
switch (parentWin) {
|
||||
case DIALOG:
|
||||
parentDialog = new ParentDialog((Dialog) null);
|
||||
dialog = new CustomDialog(parentDialog);
|
||||
p = parentDialog;
|
||||
break;
|
||||
case FRAME:
|
||||
parentFrame = new ParentFrame();
|
||||
dialog = new CustomDialog(parentFrame);
|
||||
p = parentFrame;
|
||||
break;
|
||||
}
|
||||
|
||||
assertFalse(p == null, "invalid parent");
|
||||
p.setLocation(50, 50);
|
||||
dialog.setLocation(250, 50);
|
||||
if (modalityType != null) { dialog.setModalityType(modalityType); }
|
||||
|
||||
frame = new TestFrame();
|
||||
frame.setLocation(50, 250);
|
||||
window = new TestWindow(frame);
|
||||
window.setLocation(250, 250);
|
||||
|
||||
p.setVisible(true);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
if (parentDialog != null) { parentDialog.clickOpenButton(robot); }
|
||||
else if (parentFrame != null) { parentFrame.clickOpenButton(robot); }
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "the 1st button did not gain " +
|
||||
"focus when the dialog became visible");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "the 1st dialog button " +
|
||||
"gained focus, but lost it afterwards");
|
||||
|
||||
dialog.openGained.reset();
|
||||
robot.type(KeyEvent.VK_TAB);
|
||||
|
||||
dialog.openGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.openGained.flag(), "Tab navigation did not happen " +
|
||||
"properly; open button did not gain focus on tab press " +
|
||||
"when parent frame is visible");
|
||||
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.activated.waitForFlagTriggered();
|
||||
assertTrue(frame.activated.flag(), "Frame did not trigger " +
|
||||
"Window Activated event when made visible.");
|
||||
|
||||
frame.checkUnblockedFrame(robot, "Frame should not be blocked.");
|
||||
window.checkUnblockedWindow(robot, "Window should not be blocked.");
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if ( frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
if (parentDialog != null) { parentDialog.dispose(); }
|
||||
if (parentFrame != null) { parentFrame.dispose(); }
|
||||
}
|
||||
|
||||
|
||||
class ParentDialog extends TestDialog {
|
||||
|
||||
public ParentDialog(Dialog d) { super(d); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class ParentFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Dialog d) { super(d); }
|
||||
public CustomDialog(Frame f) { super(f); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (frame != null) { frame.setVisible(true); }
|
||||
if (window != null) { window.setVisible(true); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Test if a document modality works as expected:
|
||||
* whether all the windows lying down the document root
|
||||
* (Frame) get blocked.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingDocModalTest
|
||||
*/
|
||||
|
||||
|
||||
public class BlockingDocModalTest {
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private TestDialog dialog, childDialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
|
||||
public BlockingDocModalTest() throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
frame.setVisible(true);
|
||||
|
||||
dialog = new TestDialog(frame);
|
||||
dialog.setLocation(250, 250);
|
||||
dialog.setVisible(true);
|
||||
|
||||
childDialog = new CustomDialog(dialog);
|
||||
childDialog.setLocation(250, 50);
|
||||
childDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
|
||||
|
||||
window = new TestWindow(frame);
|
||||
window.setLocation(50, 250);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
childDialog.activated.waitForFlagTriggered();
|
||||
assertTrue(childDialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
childDialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(childDialog.closeGained.flag(), "the 1st button did not " +
|
||||
"gain focus when the Dialog became visible");
|
||||
|
||||
assertTrue(childDialog.closeButton.hasFocus(), "the 1st dialog button " +
|
||||
"gained focus but lost it afterwards");
|
||||
|
||||
frame.checkBlockedFrame(robot, "A document modal Dialog from " +
|
||||
"this Frame's child hierarchy should block this frame");
|
||||
|
||||
childDialog.checkUnblockedDialog(robot,
|
||||
"This is a document modal childDialog.");
|
||||
|
||||
childDialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkBlockedWindow(robot,
|
||||
"A document modal dialog having a parent belonging " +
|
||||
"to this Window's document hierarchy is displayed.");
|
||||
|
||||
dialog.checkBlockedDialog(robot,
|
||||
"A document modal child dialog should block this Dialog.");
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if ( frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
if (childDialog != null) { childDialog.dispose(); }
|
||||
}
|
||||
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (childDialog != null) { childDialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Dialog d) { super(d); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) { window.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingDocModalTest()).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDAppModalTest
|
||||
*/
|
||||
|
||||
public class BlockingFDAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDDocModalTest
|
||||
*/
|
||||
|
||||
public class BlockingFDDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDModelessTest
|
||||
*/
|
||||
|
||||
public class BlockingFDModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest(Dialog.ModalityType.MODELESS)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDNonModalTest
|
||||
*/
|
||||
|
||||
public class BlockingFDNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest(null)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDSetModalTest
|
||||
*/
|
||||
|
||||
public class BlockingFDSetModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest()).doTest();
|
||||
}
|
||||
}
|
||||
124
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java
Normal file
124
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
// FD: Frame -> Dialog
|
||||
|
||||
public class BlockingFDTest {
|
||||
|
||||
private TestFrame frame;
|
||||
private TestDialog dialog;
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private final Dialog.ModalityType modalityType;
|
||||
private final boolean setModal;
|
||||
|
||||
private BlockingFDTest(Dialog.ModalityType modType, boolean modal) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
setModal = modal;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
public BlockingFDTest(Dialog.ModalityType modType) throws Exception {
|
||||
this(modType, false);
|
||||
}
|
||||
|
||||
public BlockingFDTest() throws Exception {
|
||||
this(null, true);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
dialog = new TestDialog(frame);
|
||||
if (setModal) {
|
||||
dialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
dialog.setLocation(250, 50);
|
||||
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " +
|
||||
"did not gain focus when it became visible");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " +
|
||||
"gained the focus but lost it afterwards");
|
||||
|
||||
if ((modalityType == Dialog.ModalityType.APPLICATION_MODAL) ||
|
||||
(modalityType == Dialog.ModalityType.DOCUMENT_MODAL) ||
|
||||
(modalityType == Dialog.ModalityType.TOOLKIT_MODAL) ||
|
||||
setModal)
|
||||
{
|
||||
frame.checkBlockedFrame(robot,
|
||||
"Frame is the parent of a visible " + modalityType + " Dialog.");
|
||||
} else {
|
||||
frame.checkUnblockedFrame(robot,
|
||||
"Frame is the parent of a visible " + modalityType + " Dialog.");
|
||||
}
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (frame != null) { frame.dispose(); }
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
}
|
||||
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a Frame
|
||||
* constructor receives focus, whether its components receive focus
|
||||
* and respond to key events. Check also the correctness
|
||||
* of the blocking behavior for the parent Frame.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @run main BlockingFDToolkitModalTest
|
||||
*/
|
||||
|
||||
public class BlockingFDToolkitModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWDocModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWDocModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWDocModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWDocModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWDocModal3Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWDocModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWDocModal4Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWDocModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWModeless1Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWModeless1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.MODELESS,
|
||||
BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWModeless2Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWModeless2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.MODELESS,
|
||||
BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWModeless3Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWModeless3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.MODELESS,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWModeless4Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWModeless4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(Dialog.ModalityType.MODELESS,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWNonModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWNonModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(null,
|
||||
BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWNonModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWNonModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(null,
|
||||
BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWNonModal3Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWNonModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(null,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Check also the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingFDWNonModal4Test
|
||||
*/
|
||||
|
||||
public class BlockingFDWNonModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingFDWTest(null,
|
||||
BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
162
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java
Normal file
162
test/jdk/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
// FDW: Frame -> Dialog -> Window
|
||||
|
||||
public class BlockingFDWTest {
|
||||
|
||||
private TestFrame frame;
|
||||
private TestDialog dialog;
|
||||
private TestWindow window;
|
||||
|
||||
private Dialog hiddenDialog;
|
||||
private Frame hiddenFrame;
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME};
|
||||
|
||||
public BlockingFDWTest(Dialog.ModalityType modalityType,
|
||||
DialogOwner owner) throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(() -> { createGUI(modalityType, owner); });
|
||||
}
|
||||
|
||||
private void createGUI(Dialog.ModalityType modalityType,
|
||||
DialogOwner owner) {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
assertFalse(dialog == null, "error: null dialog");
|
||||
|
||||
dialog.setLocation(250, 50);
|
||||
if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
window = new TestWindow(frame);
|
||||
window.setLocation(450, 50);
|
||||
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " +
|
||||
"did not gain focus when it became visible");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " +
|
||||
"gained the focus but lost it afterwards");
|
||||
|
||||
frame.checkUnblockedFrame(robot, "A " + dialog.getModalityType() + " dialog is visible.");
|
||||
|
||||
dialog.checkUnblockedDialog(robot, "A Frame is visible.");
|
||||
|
||||
dialog.openClicked.reset();
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkUnblockedWindow(robot,
|
||||
"A Frame and a " + dialog.getModalityType() + " Dialog are visible.");
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (frame != null) { frame.dispose(); }
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
if (hiddenDialog != null) { hiddenDialog.dispose(); }
|
||||
if (hiddenFrame != null) { hiddenFrame.dispose(); }
|
||||
}
|
||||
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Dialog dialog) {
|
||||
super(dialog);
|
||||
}
|
||||
|
||||
public CustomDialog(Frame frame) {
|
||||
super(frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) { window.setVisible(true); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal3Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal4Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal5Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal5Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog created with a Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsAppModal6Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsAppModal6Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsDocModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsDocModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsDocModalTest(
|
||||
BlockingWindowsDocModalTest.Parent.FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog created with a Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsDocModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsDocModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsDocModalTest(
|
||||
BlockingWindowsDocModalTest.Parent.DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockingWindowsDocModalTest {
|
||||
|
||||
private ParentDialog parentDialog;
|
||||
private ParentFrame parentFrame;
|
||||
private CustomDialog dialog;
|
||||
private TestDialog secondDialog, childDialog;
|
||||
private TestFrame secondFrame;
|
||||
private TestWindow window, childWindow, secondWindow;
|
||||
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private List<Window> allWindows;
|
||||
|
||||
public enum Parent {DIALOG, FRAME};
|
||||
private Parent root;
|
||||
|
||||
public BlockingWindowsDocModalTest(Parent p) throws Exception {
|
||||
|
||||
root = p;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
allWindows = new ArrayList<>();
|
||||
|
||||
switch (root) {
|
||||
case DIALOG:
|
||||
parentDialog = new ParentDialog((Dialog) null);
|
||||
parentDialog.setLocation(50, 50);
|
||||
parentDialog.setVisible(true);
|
||||
allWindows.add(parentDialog);
|
||||
|
||||
dialog = new CustomDialog(parentDialog);
|
||||
secondDialog = new TestDialog(parentDialog);
|
||||
window = new TestWindow(parentDialog);
|
||||
break;
|
||||
case FRAME:
|
||||
parentFrame = new ParentFrame();
|
||||
parentFrame.setLocation(50, 50);
|
||||
parentFrame.setVisible(true);
|
||||
allWindows.add(parentFrame);
|
||||
|
||||
dialog = new CustomDialog(parentFrame);
|
||||
secondDialog = new TestDialog(parentFrame);
|
||||
window = new TestWindow(parentFrame);
|
||||
break;
|
||||
}
|
||||
|
||||
allWindows.add(dialog);
|
||||
allWindows.add(secondDialog);
|
||||
allWindows.add(window);
|
||||
|
||||
dialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
|
||||
dialog.setLocation(250, 50);
|
||||
window.setLocation(450, 50);
|
||||
secondDialog.setLocation(450, 250);
|
||||
|
||||
secondFrame = new TestFrame();
|
||||
allWindows.add(secondFrame);
|
||||
secondFrame.setLocation(50, 250);
|
||||
|
||||
secondWindow = new TestWindow(secondFrame);
|
||||
allWindows.add(secondWindow);
|
||||
secondWindow.setLocation(250, 250);
|
||||
|
||||
childDialog = new TestDialog(dialog);
|
||||
allWindows.add(childDialog);
|
||||
childDialog.setLocation(250, 450);
|
||||
|
||||
childWindow = new TestWindow(dialog);
|
||||
allWindows.add(childWindow);
|
||||
childWindow.setLocation(50, 450);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
if (root == Parent.DIALOG) {
|
||||
parentDialog.clickOpenButton(robot);
|
||||
} else { //Parent.FRAME
|
||||
parentFrame.clickOpenButton(robot);
|
||||
}
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Acivated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(),
|
||||
"the 1st Dialog button didn't gain focus");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " +
|
||||
"gained focus but lost it afterwards");
|
||||
|
||||
dialog.openGained.reset();
|
||||
robot.type(KeyEvent.VK_TAB);
|
||||
|
||||
dialog.openGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.openGained.flag(), "Tab navigation did not happen properly on Dialog; " +
|
||||
"Open button did not gain focus on tab press when parent frame is visible");
|
||||
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
secondFrame.checkUnblockedFrame(robot,
|
||||
"A document modal dialog and its parent are visible.");
|
||||
secondWindow.checkUnblockedWindow(robot,
|
||||
"A Frame and a document modal Dialog are visible.");
|
||||
|
||||
if (root == Parent.DIALOG) {
|
||||
parentDialog.checkBlockedDialog(robot, "Dialog is a parent of a document modal dialog.");
|
||||
} else { //Parent.FRAME
|
||||
parentFrame.checkBlockedFrame(robot, "Frame is a parent of a document modal dialog.");
|
||||
}
|
||||
|
||||
secondDialog.checkBlockedDialog(robot,
|
||||
"The parent of the Dialog is also the parent of a document modal dialog");
|
||||
window.checkBlockedWindow(robot,
|
||||
"The parent of the Window is also the parent of a document modal dialog");
|
||||
|
||||
childWindow.checkUnblockedWindow(robot,
|
||||
"The parent of the Window is a document modal dialog");
|
||||
childDialog.checkUnblockedDialog(robot,
|
||||
"The parent of the Dialog is a document modal dialog");
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
for (Window w: allWindows) {
|
||||
if (w != null) { w.dispose(); }
|
||||
}
|
||||
}
|
||||
|
||||
class ParentDialog extends TestDialog {
|
||||
|
||||
public ParentDialog(Dialog d) { super(d); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class ParentFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Dialog d) { super(d); }
|
||||
public CustomDialog(Frame f) { super(f); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (secondFrame != null) { secondFrame.setVisible(true); }
|
||||
if (secondWindow != null) { secondWindow.setVisible(true); }
|
||||
if (secondDialog != null) { secondDialog.setVisible(true); }
|
||||
if (window != null) { window.setVisible(true); }
|
||||
if (childWindow != null) { childWindow.setVisible(true); }
|
||||
if (childDialog != null) { childDialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal3Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal4Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal5Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal5Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog created with a Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsSetModal6Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsSetModal6Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(
|
||||
BlockingWindowsTest.DialogOwner.DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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 static jdk.test.lib.Asserts.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockingWindowsTest {
|
||||
|
||||
private TestDialog dialog, childDialog, secondDialog, dummyDialog, parentDialog;
|
||||
private TestFrame frame, secondFrame;
|
||||
private TestWindow window, childWindow;
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private List<Window> allWindows;
|
||||
|
||||
private Dialog hiddenDialog;
|
||||
private Frame hiddenFrame;
|
||||
|
||||
private Dialog.ModalityType modalityType;
|
||||
|
||||
public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, DIALOG, FRAME};
|
||||
|
||||
private BlockingWindowsTest(Dialog.ModalityType modType,
|
||||
boolean setModal,
|
||||
DialogOwner owner) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(() -> {
|
||||
createGUI(setModal, owner);
|
||||
});
|
||||
}
|
||||
|
||||
public BlockingWindowsTest(
|
||||
Dialog.ModalityType modalityType, DialogOwner owner) throws Exception {
|
||||
this(modalityType, false, owner);
|
||||
}
|
||||
|
||||
public BlockingWindowsTest(DialogOwner owner) throws Exception {
|
||||
this(null, true, owner);
|
||||
}
|
||||
|
||||
private void createGUI(boolean setModal,
|
||||
DialogOwner owner) {
|
||||
|
||||
allWindows = new ArrayList<>();
|
||||
|
||||
if (owner != DialogOwner.DIALOG) {
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
frame.setVisible(true);
|
||||
allWindows.add(frame);
|
||||
}
|
||||
|
||||
switch (owner) {
|
||||
case DIALOG:
|
||||
parentDialog = new ParentDialog((Dialog) null);
|
||||
parentDialog.setLocation(50, 50);
|
||||
parentDialog.setVisible(true);
|
||||
allWindows.add(parentDialog);
|
||||
dialog = new CustomDialog(parentDialog);
|
||||
break;
|
||||
case FRAME:
|
||||
dialog = new CustomDialog(frame);
|
||||
break;
|
||||
case HIDDEN_DIALOG:
|
||||
hiddenDialog = new Dialog((Frame) null);
|
||||
dialog = new CustomDialog(hiddenDialog);
|
||||
allWindows.add(hiddenDialog);
|
||||
break;
|
||||
case NULL_DIALOG:
|
||||
dialog = new CustomDialog((Dialog) null);
|
||||
break;
|
||||
case HIDDEN_FRAME:
|
||||
hiddenFrame = new Frame();
|
||||
dialog = new CustomDialog(hiddenFrame);
|
||||
allWindows.add(hiddenFrame);
|
||||
break;
|
||||
case NULL_FRAME:
|
||||
dialog = new CustomDialog((Frame) null);
|
||||
break;
|
||||
}
|
||||
|
||||
assertFalse(dialog == null, "error: null dialog");
|
||||
|
||||
if (setModal) {
|
||||
dialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setLocation(250, 50);
|
||||
allWindows.add(dialog);
|
||||
|
||||
if (owner == DialogOwner.DIALOG) {
|
||||
window = new TestWindow(parentDialog);
|
||||
} else {
|
||||
window = new TestWindow(frame);
|
||||
}
|
||||
|
||||
window.setLocation(50, 250);
|
||||
allWindows.add(window);
|
||||
|
||||
if (owner == DialogOwner.DIALOG) {
|
||||
dummyDialog = new TestDialog(parentDialog);
|
||||
} else {
|
||||
dummyDialog = new TestDialog(frame);
|
||||
}
|
||||
dummyDialog.setLocation(450, 450);
|
||||
allWindows.add(dummyDialog);
|
||||
|
||||
childWindow = new CustomWindow(dialog);
|
||||
childWindow.setLocation(450, 50);
|
||||
allWindows.add(childWindow);
|
||||
|
||||
childDialog = new TestDialog(dialog);
|
||||
childDialog.setLocation(450, 250);
|
||||
allWindows.add(childDialog);
|
||||
|
||||
if (owner == DialogOwner.DIALOG) {
|
||||
secondDialog = new CustomDialog(parentDialog);
|
||||
} else {
|
||||
secondDialog = new CustomDialog(frame);
|
||||
}
|
||||
if (setModal) {
|
||||
secondDialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
secondDialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
secondDialog.setLocation(50, 450);
|
||||
allWindows.add(secondDialog);
|
||||
|
||||
secondFrame = new TestFrame();
|
||||
secondFrame.setLocation(250, 450);
|
||||
allWindows.add(secondFrame);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
if (parentDialog == null) { frame.clickOpenButton(robot); }
|
||||
else { parentDialog.clickOpenButton(robot); }
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "The first button did not gain focus " +
|
||||
"when the dialog became visible");
|
||||
|
||||
assertTrue(dialog.closeButton.hasFocus(), "The first dialog button " +
|
||||
"gained focus, but lost it afterwards");
|
||||
|
||||
if (parentDialog == null) {
|
||||
frame.checkBlockedFrame(robot, modalityType + " Dialog is visible.");
|
||||
} else {
|
||||
parentDialog.checkBlockedDialog(robot, modalityType + " Dialog is visible.");
|
||||
}
|
||||
|
||||
dialog.checkUnblockedDialog(robot, "A Frame is visible.");
|
||||
|
||||
dialog.openClicked.reset();
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
assertFalse(window.focusGained.flag(), "Window gained focus on becoming " +
|
||||
"visible when Frame and Dialog are visible");
|
||||
|
||||
window.checkBlockedWindow(robot,
|
||||
"The parent of the Window is blocked by " + modalityType + " Dialog.");
|
||||
|
||||
dummyDialog.checkBlockedDialog(robot,
|
||||
"The parent of the Dialog is blocked by " + modalityType + " Dialog.");
|
||||
|
||||
childDialog.checkUnblockedDialog(robot,
|
||||
"The parent of the Dialog is " + modalityType + " Dialog");
|
||||
|
||||
childWindow.checkUnblockedWindow(robot,
|
||||
"The parent of the Window is " + modalityType + " Dialog");
|
||||
|
||||
childWindow.openClicked.reset();
|
||||
childWindow.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
secondDialog.checkUnblockedDialog(robot,
|
||||
"The dialog is " + modalityType + ", the parent of the dialog " +
|
||||
"is blocked by another " + modalityType + " dialog.");
|
||||
|
||||
secondFrame.checkBlockedFrame(robot,
|
||||
modalityType + " dialog is displayed immediately after showing " +
|
||||
"this frame. Another modal dialog is alreay visible");
|
||||
|
||||
secondDialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
childWindow.checkUnblockedWindow(robot, "A blocking dialog was closed.");
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
for (Window w: allWindows) {
|
||||
if (w != null) { w.dispose(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) { dialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Dialog dialog) {
|
||||
super(dialog);
|
||||
}
|
||||
|
||||
public CustomDialog(Frame frame) {
|
||||
super(frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) { window.setVisible(true); }
|
||||
if (dummyDialog != null) { dummyDialog.setVisible(true); }
|
||||
if (childWindow != null) { childWindow.setVisible(true); }
|
||||
if (childDialog != null) { childDialog.setVisible(true); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomWindow extends TestWindow {
|
||||
|
||||
public CustomWindow(Window parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (secondFrame != null) { secondFrame.setVisible(true); }
|
||||
if (secondDialog != null) { secondDialog.setVisible(true); }
|
||||
}
|
||||
}
|
||||
|
||||
class ParentDialog extends TestDialog {
|
||||
|
||||
public ParentDialog(Dialog d) { super(d); }
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a null Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal1Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a null Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal2Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a hidden Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal3Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a hidden Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal4Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a Frame
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal5Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal5Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.FRAME)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog created with a Dialog
|
||||
* constructor receives focus; whether its components receive focus
|
||||
* and respond to key events, when there are other windows shown.
|
||||
* Also check the correctness of blocking behavior for other windows shown.
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main BlockingWindowsToolkitModal6Test
|
||||
*/
|
||||
|
||||
public class BlockingWindowsToolkitModal6Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
BlockingWindowsTest.DialogOwner.DIALOG)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether an application modal Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogAppModalTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a document modal Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogDocModalTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modeless Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogModelessTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest(Dialog.ModalityType.MODELESS)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a non-modal Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogNonModalTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest(null)).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a modal Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogSetModalTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogSetModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest()).doTest();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
public class UnblockedDialogTest {
|
||||
|
||||
private TestDialog dialog;
|
||||
|
||||
private static final int delay = 500;
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private Dialog parentDialog;
|
||||
private Frame parentFrame;
|
||||
|
||||
private enum DialogOwner {HIDDEN_DIALOG, HIDDEN_FRAME, NULL_DIALOG, NULL_FRAME};
|
||||
|
||||
Dialog.ModalityType modalityType;
|
||||
boolean setModal;
|
||||
|
||||
private UnblockedDialogTest(Dialog.ModalityType modType,
|
||||
boolean set) throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
modalityType = modType;
|
||||
setModal = set;
|
||||
}
|
||||
|
||||
public UnblockedDialogTest(Dialog.ModalityType modType) throws Exception {
|
||||
this(modType, false);
|
||||
}
|
||||
|
||||
public UnblockedDialogTest() throws Exception { this(null, true); }
|
||||
|
||||
|
||||
private void createGUI(DialogOwner owner) {
|
||||
|
||||
switch (owner) {
|
||||
case HIDDEN_DIALOG:
|
||||
parentDialog = new Dialog((Frame) null);
|
||||
dialog = new TestDialog(parentDialog);
|
||||
break;
|
||||
case NULL_DIALOG:
|
||||
dialog = new TestDialog((Dialog) null);
|
||||
break;
|
||||
case HIDDEN_FRAME:
|
||||
parentFrame = new Frame();
|
||||
dialog = new TestDialog(parentFrame);
|
||||
break;
|
||||
case NULL_FRAME:
|
||||
dialog = new TestDialog((Frame) null);
|
||||
break;
|
||||
}
|
||||
|
||||
assertFalse(dialog == null, "error: null dialog");
|
||||
|
||||
dialog.setLocation(50, 50);
|
||||
if (setModal) {
|
||||
dialog.setModal(true);
|
||||
} else if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
for (DialogOwner owner: DialogOwner.values()) {
|
||||
|
||||
EventQueue.invokeLater(() -> { createGUI(owner); });
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.activated.waitForFlagTriggered();
|
||||
assertTrue(dialog.activated.flag(), "Dialog did not trigger " +
|
||||
"Window Activated event when it became visible");
|
||||
|
||||
dialog.closeGained.waitForFlagTriggered();
|
||||
assertTrue(dialog.closeGained.flag(), "The 1st button did not " +
|
||||
"gain focus when the dialog became visible");
|
||||
|
||||
dialog.checkUnblockedDialog(robot, "");
|
||||
robot.waitForIdle(delay);
|
||||
}
|
||||
|
||||
} finally {
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if (parentDialog != null) { parentDialog.dispose(); }
|
||||
if (parentFrame != null) { parentFrame.dispose(); }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, 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
|
||||
* @key headful
|
||||
* @bug 8049617
|
||||
* @summary Check whether a toolkit modal Dialog receives focus; check
|
||||
* if its components receive focus and respond to key events
|
||||
*
|
||||
* @library ../helpers /lib/client/
|
||||
* @library /test/lib
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @run main UnblockedDialogToolkitModalTest
|
||||
*/
|
||||
|
||||
public class UnblockedDialogToolkitModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
(new UnblockedDialogTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue