mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-18 10:50:23 +00:00
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
Reviewed-by: pchelko
This commit is contained in:
parent
b8db13175e
commit
2a84acf3dd
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following
|
||||
* happens: an application modal dialog (D) having null frame owner is shown;
|
||||
* a window having D as owner is shown; a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDWFAppModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDWFAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDWFTest test = new FocusTransferDWFTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the
|
||||
* following happens: a document modal dialog (D) having null frame owner is shown;
|
||||
* a window having D as owner is shown; a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDWFDocModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDWFDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDWFTest test = new FocusTransferDWFTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the
|
||||
* following happens: a modeless dialog (D) having null frame owner is shown;
|
||||
* a window having D as owner is shown; a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDWFModelessTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDWFModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDWFTest test = new FocusTransferDWFTest(
|
||||
Dialog.ModalityType.MODELESS);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following
|
||||
* happens: a non-modal dialog (D) having null frame owner is shown; a window having D
|
||||
* as owner is shown; a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDWFNonModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDWFNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDWFTest test = new FocusTransferDWFTest(null);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
// DWF: Dialog -> Window -> Frame
|
||||
public class FocusTransferDWFTest {
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) {
|
||||
window.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomWindow extends TestWindow {
|
||||
|
||||
public CustomWindow(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (frame != null) {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
private static final int delay = 1000;
|
||||
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private Dialog.ModalityType modalityType;
|
||||
|
||||
FocusTransferDWFTest(Dialog.ModalityType modType) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
|
||||
dialog = new CustomDialog((Frame) null);
|
||||
if (modalityType == null) {
|
||||
modalityType = Dialog.ModalityType.MODELESS;
|
||||
} else {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
dialog.setLocation(250, 50);
|
||||
|
||||
window = new CustomWindow(dialog);
|
||||
window.setLocation(450, 50);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if ( frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
try {
|
||||
|
||||
dialog.checkCloseButtonFocusGained(true);
|
||||
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkCloseButtonFocusGained(true);
|
||||
dialog.checkOpenButtonFocusLost(true);
|
||||
|
||||
window.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
switch (modalityType) {
|
||||
case APPLICATION_MODAL:
|
||||
frame.checkCloseButtonFocusGained(false, 10);
|
||||
window.checkOpenButtonFocusLost(false, 10);
|
||||
|
||||
frame.closeGained.reset();
|
||||
|
||||
dialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
assertFalse(window.isVisible(), "window shouldn't be visible");
|
||||
|
||||
break;
|
||||
|
||||
case DOCUMENT_MODAL:
|
||||
case MODELESS:
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
window.checkOpenButtonFocusLost(true);
|
||||
|
||||
window.openGained.reset();
|
||||
|
||||
frame.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkOpenButtonFocusGained(true);
|
||||
|
||||
dialog.openGained.reset();
|
||||
window.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.checkOpenButtonFocusGained(true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
// make screenshot before exit
|
||||
Rectangle rect = new Rectangle(0, 0, 650, 250);
|
||||
java.awt.image.BufferedImage img = robot.createScreenCapture(rect);
|
||||
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg"));
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: an application modal dialog (D1) having a null
|
||||
* frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog
|
||||
* with a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDialogsAppModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDialogsAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDialogsTest test = new FocusTransferDialogsTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a document modal dialog (D1) having a null
|
||||
* frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog
|
||||
* with a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDialogsDocModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDialogsDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDialogsTest test = new FocusTransferDialogsTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a modeless dialog (D1) having a null
|
||||
* frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog
|
||||
* with a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDialogsModelessTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDialogsModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDialogsTest test = new FocusTransferDialogsTest(
|
||||
Dialog.ModalityType.MODELESS);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a non-modal dialog (D1) having a null
|
||||
* frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog
|
||||
* with a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferDialogsNonModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferDialogsNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferDialogsTest test = new FocusTransferDialogsTest(null);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
public class FocusTransferDialogsTest {
|
||||
|
||||
class CustomDialog1 extends TestDialog {
|
||||
|
||||
public CustomDialog1(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog2 != null) {
|
||||
dialog2.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog2 extends TestDialog {
|
||||
|
||||
public CustomDialog2(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog3 != null) {
|
||||
dialog3.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog3 extends TestDialog {
|
||||
|
||||
public CustomDialog3(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
public CustomDialog3(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private TestDialog dialog1, dialog2, dialog3;
|
||||
private Frame parentFrame;
|
||||
|
||||
private static final int delay = 1000;
|
||||
private final ExtendedRobot robot;
|
||||
private Dialog.ModalityType modalityType;
|
||||
|
||||
FocusTransferDialogsTest(Dialog.ModalityType modType) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
dialog1 = new CustomDialog1((Frame) null);
|
||||
dialog1.setTitle("Dialog1");
|
||||
dialog1.setLocation(50, 50);
|
||||
|
||||
if (modalityType != null) {
|
||||
dialog1.setModalityType(modalityType);
|
||||
} else {
|
||||
modalityType = Dialog.ModalityType.MODELESS;
|
||||
}
|
||||
|
||||
dialog2 = new CustomDialog2(dialog1);
|
||||
dialog2.setTitle("Dialog2");
|
||||
dialog2.setLocation(250, 50);
|
||||
|
||||
parentFrame = new Frame();
|
||||
dialog3 = new CustomDialog3(parentFrame);
|
||||
dialog3.setTitle("Dialog3");
|
||||
dialog3.setLocation(450, 50);
|
||||
|
||||
dialog1.setVisible(true);
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog1 != null) { dialog1.dispose(); }
|
||||
if (dialog2 != null) { dialog2.dispose(); }
|
||||
if (dialog3 != null) { dialog3.dispose(); }
|
||||
if (parentFrame != null) { parentFrame.dispose(); }
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
try {
|
||||
|
||||
dialog1.checkCloseButtonFocusGained(true);
|
||||
|
||||
dialog1.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog2.checkCloseButtonFocusGained(true);
|
||||
dialog1.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog1.openGained.reset();
|
||||
dialog2.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
switch (modalityType) {
|
||||
case APPLICATION_MODAL:
|
||||
|
||||
dialog3.checkCloseButtonFocusGained(false, 10);
|
||||
dialog2.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog1.checkCloseButtonFocusGained(true);
|
||||
dialog3.closeGained.reset();
|
||||
|
||||
dialog1.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog3.checkCloseButtonFocusGained(true);
|
||||
|
||||
break;
|
||||
|
||||
case DOCUMENT_MODAL:
|
||||
case MODELESS:
|
||||
|
||||
dialog3.checkCloseButtonFocusGained(true);
|
||||
dialog2.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog1.openGained.reset();
|
||||
|
||||
dialog2.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog1.checkOpenButtonFocusGained(true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
// make screenshot before exit
|
||||
Rectangle rect = new Rectangle(0, 0, 650, 250);
|
||||
java.awt.image.BufferedImage img = robot.createScreenCapture(rect);
|
||||
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg"));
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a frame is shown; an application modal dialog (D)
|
||||
* having a null frame owner is shown; a window having D as owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFDWAppModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferFDWAppModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFDWTest test = new FocusTransferFDWTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a frame is shown; a document modal dialog (D)
|
||||
* having a null frame owner is shown; a window having D as owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFDWDocModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferFDWDocModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFDWTest test = new FocusTransferFDWTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a frame is shown; a modeless dialog (D)
|
||||
* having a null frame owner is shown; a window having D as owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFDWModelessTest
|
||||
*/
|
||||
|
||||
public class FocusTransferFDWModelessTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFDWTest test = new FocusTransferFDWTest(
|
||||
Dialog.ModalityType.MODELESS);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a frame is shown; a non-modal dialog (D)
|
||||
* having a null frame owner is shown; a window having D as owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFDWNonModalTest
|
||||
*/
|
||||
|
||||
public class FocusTransferFDWNonModalTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFDWTest test = new FocusTransferFDWTest(null);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
// FDW: Frame -> Dialog -> Window
|
||||
public class FocusTransferFDWTest {
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustomWindow extends TestWindow {
|
||||
|
||||
public CustomWindow(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) {
|
||||
window.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
private static final int delay = 1000;
|
||||
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private final Dialog.ModalityType modalityType;
|
||||
|
||||
FocusTransferFDWTest(Dialog.ModalityType modType) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
dialog = new CustomDialog((Frame) null);
|
||||
if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
dialog.setLocation(250, 50);
|
||||
window = new CustomWindow(dialog);
|
||||
window.setLocation(450, 50);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if ( frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
try {
|
||||
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
|
||||
frame.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.checkCloseButtonFocusGained(true);
|
||||
|
||||
frame.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkCloseButtonFocusGained(true);
|
||||
dialog.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog.openGained.reset();
|
||||
window.clickCloseButton(robot);
|
||||
|
||||
dialog.checkOpenButtonFocusGained(true);
|
||||
|
||||
frame.openGained.reset();
|
||||
dialog.clickCloseButton(robot);
|
||||
|
||||
frame.checkOpenButtonFocusGained(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
// make screenshot before exit
|
||||
Rectangle rect = new Rectangle(0, 0, 650, 250);
|
||||
java.awt.image.BufferedImage img = robot.createScreenCapture(rect);
|
||||
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg"));
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
|
||||
* a hidden dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDAppModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDAppModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
|
||||
* a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDAppModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDAppModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
|
||||
* a null dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDAppModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDAppModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.NULL_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; an application modal dialog having
|
||||
* a null frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDAppModal4Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDAppModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.NULL_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
|
||||
* a hidden dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDDocModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDDocModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
|
||||
* a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDDocModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDDocModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
|
||||
* a null dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDDocModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDDocModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.NULL_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a document modal dialog having
|
||||
* a null frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDDocModal4Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDDocModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferFWDTest.DialogParent.NULL_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
|
||||
* a hidden dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDModeless1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDModeless1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
|
||||
* a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDModeless2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDModeless2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferFWDTest.DialogParent.HIDDEN_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
|
||||
* a null dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDModeless3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDModeless3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferFWDTest.DialogParent.NULL_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a modeless dialog having
|
||||
* a null frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDModeless4Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDModeless4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferFWDTest.DialogParent.NULL_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
|
||||
* a hidden dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDNonModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDNonModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
null, FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
|
||||
* a hidden frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDNonModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDNonModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
null, FocusTransferFWDTest.DialogParent.HIDDEN_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
|
||||
* a null dialog owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDNonModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDNonModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
null, FocusTransferFWDTest.DialogParent.NULL_DIALOG);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8049339
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when the following happens:
|
||||
* a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having
|
||||
* a null frame owner is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferFWDNonModal4Test
|
||||
*/
|
||||
|
||||
public class FocusTransferFWDNonModal4Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferFWDTest test = new FocusTransferFWDTest(
|
||||
null, FocusTransferFWDTest.DialogParent.NULL_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
|
||||
// FWD: Frame -> Window -> Dialog
|
||||
public class FocusTransferFWDTest {
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (window != null) {
|
||||
window.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomWindow extends TestWindow {
|
||||
|
||||
public CustomWindow(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
public CustomDialog(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
private Frame parentFrame;
|
||||
private Dialog parentDialog;
|
||||
|
||||
private static final int delay = 1000;
|
||||
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private final Dialog.ModalityType modalityType;
|
||||
|
||||
public enum DialogParent {NULL_DIALOG, NULL_FRAME, HIDDEN_DIALOG, HIDDEN_FRAME};
|
||||
private DialogParent dialogParent;
|
||||
|
||||
FocusTransferFWDTest(Dialog.ModalityType modType,
|
||||
DialogParent dlgParent) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
dialogParent = dlgParent;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
|
||||
switch (dialogParent) {
|
||||
case NULL_DIALOG:
|
||||
dialog = new CustomDialog((Dialog) null);
|
||||
break;
|
||||
case NULL_FRAME:
|
||||
dialog = new CustomDialog((Frame) null);
|
||||
break;
|
||||
case HIDDEN_DIALOG:
|
||||
parentDialog = new Dialog((Frame) null);
|
||||
dialog = new CustomDialog(parentDialog);
|
||||
break;
|
||||
case HIDDEN_FRAME:
|
||||
parentFrame = new Frame();
|
||||
dialog = new CustomDialog(parentFrame);
|
||||
break;
|
||||
}
|
||||
|
||||
assertTrue(dialog != null, "error: null dialog");
|
||||
|
||||
if (modalityType != null) {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setLocation(250, 50);
|
||||
window = new CustomWindow(frame);
|
||||
window.setLocation(450, 50);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
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(); }
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
try {
|
||||
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
|
||||
frame.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkCloseButtonFocusGained(true);
|
||||
frame.checkOpenButtonFocusLost(true);
|
||||
|
||||
window.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.checkCloseButtonFocusGained(true);
|
||||
window.checkOpenButtonFocusLost(true);
|
||||
|
||||
window.openGained.reset();
|
||||
|
||||
dialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkOpenButtonFocusGained(true);
|
||||
|
||||
frame.openGained.reset();
|
||||
|
||||
window.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.checkOpenButtonFocusGained(true);
|
||||
|
||||
frame.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
// make screenshot before exit
|
||||
Rectangle rect = new Rectangle(0, 0, 650, 250);
|
||||
java.awt.image.BufferedImage img = robot.createScreenCapture(rect);
|
||||
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg"));
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* an application modal dialog having a frame (F) owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFAppModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFAppModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367 8048263
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* an application modal dialog having a null dialog owner is shown;
|
||||
* a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFAppModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFAppModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.NULL_DIALOG,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a frame (F) owner is shown;
|
||||
* an application modal dialog having F owner is shown; F is shown.
|
||||
*
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFAppModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFAppModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.APPLICATION_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a document modal dialog with a frame (F) owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFDocModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFDocModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a document modal dialog having a null dialog owner is shown;
|
||||
* a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFDocModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFDocModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.NULL_DIALOG,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a frame (F) owner is shown;
|
||||
* a document modal dialog having F owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFDocModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFDocModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.DOCUMENT_MODAL,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a modeless dialog having a frame (F) owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFModeless1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFModeless1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a modeless dialog having a null dialog owner is shown;
|
||||
* a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFModeless2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFModeless2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a frame (F) owner is shown;
|
||||
* a modeless dialog having F owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFModeless3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFModeless3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
Dialog.ModalityType.MODELESS,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a non-modal dialog having a frame (F) owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFNonModal1Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFNonModal1Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
null,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a hidden frame owner is shown;
|
||||
* a non-modal dialog having a null dialog owner is shown;
|
||||
* a frame is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFNonModal2Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFNonModal2Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
null,
|
||||
FocusTransferWDFTest.DialogParent.NULL_DIALOG,
|
||||
FocusTransferWDFTest.WindowParent.NEW_FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether the focus transfer between windows occurs correctly when
|
||||
* the following happens: a window having a frame (F) owner is shown;
|
||||
* a non-modal dialog having F owner is shown; F is shown.
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main FocusTransferWDFNonModal3Test
|
||||
*/
|
||||
|
||||
public class FocusTransferWDFNonModal3Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FocusTransferWDFTest test = new FocusTransferWDFTest(
|
||||
null,
|
||||
FocusTransferWDFTest.DialogParent.FRAME,
|
||||
FocusTransferWDFTest.WindowParent.FRAME);
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
// WDF: Window -> Dialog -> Frame
|
||||
public class FocusTransferWDFTest {
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
|
||||
public CustomDialog(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
public CustomDialog(Dialog d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (frame != null) {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
|
||||
@Override
|
||||
public void doCloseAction() {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class CustomWindow extends TestWindow {
|
||||
|
||||
public CustomWindow(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
private Frame parentFrame;
|
||||
|
||||
private static final int delay = 1000;
|
||||
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
private Dialog.ModalityType modalityType;
|
||||
|
||||
public enum DialogParent {FRAME, NULL_DIALOG};
|
||||
private DialogParent dialogParent;
|
||||
|
||||
public enum WindowParent {FRAME, NEW_FRAME};
|
||||
private WindowParent windowParent;
|
||||
|
||||
|
||||
FocusTransferWDFTest(Dialog.ModalityType modType,
|
||||
DialogParent dlgParent,
|
||||
WindowParent winParent) throws Exception {
|
||||
|
||||
modalityType = modType;
|
||||
dialogParent = dlgParent;
|
||||
windowParent = winParent;
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater( this::createGUI );
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
frame = new CustomFrame();
|
||||
frame.setLocation(50, 50);
|
||||
|
||||
switch (dialogParent) {
|
||||
case FRAME:
|
||||
dialog = new CustomDialog(frame);
|
||||
break;
|
||||
case NULL_DIALOG:
|
||||
dialog = new CustomDialog((Dialog) null);
|
||||
break;
|
||||
}
|
||||
assertTrue(dialog != null, "error: null dialog");
|
||||
|
||||
if (modalityType == null) {
|
||||
modalityType = Dialog.ModalityType.MODELESS;
|
||||
} else {
|
||||
dialog.setModalityType(modalityType);
|
||||
}
|
||||
|
||||
dialog.setLocation(250, 50);
|
||||
|
||||
switch (windowParent) {
|
||||
case FRAME:
|
||||
window = new CustomWindow(frame);
|
||||
break;
|
||||
case NEW_FRAME:
|
||||
parentFrame = new Frame();
|
||||
window = new CustomWindow(parentFrame);
|
||||
break;
|
||||
}
|
||||
assertTrue(window != null, "error: null window");
|
||||
|
||||
window.setLocation(450, 50);
|
||||
window.setVisible(true);
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if ( frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
|
||||
if (parentFrame != null) { parentFrame.dispose(); }
|
||||
}
|
||||
|
||||
private void ModalTest() throws Exception {
|
||||
frame.checkCloseButtonFocusGained(false, 10);
|
||||
dialog.checkOpenButtonFocusLost(false, 10);
|
||||
|
||||
dialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
|
||||
window.openGained.reset();
|
||||
|
||||
frame.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
try {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkCloseButtonFocusGained(false, 10);
|
||||
|
||||
window.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.checkCloseButtonFocusGained(true);
|
||||
window.checkOpenButtonFocusLost(false, 10);
|
||||
|
||||
dialog.clickOpenButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
switch (modalityType) {
|
||||
case APPLICATION_MODAL:
|
||||
ModalTest();
|
||||
if (windowParent == WindowParent.FRAME) {
|
||||
assertFalse(window.isVisible(),
|
||||
"window shouldn't be visible");
|
||||
} else { // WindowParent.NEW_FRAME
|
||||
window.checkOpenButtonFocusGained(false, 10);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DOCUMENT_MODAL:
|
||||
if (dialogParent == DialogParent.FRAME) {
|
||||
ModalTest();
|
||||
if (windowParent == WindowParent.FRAME) { // 10
|
||||
assertFalse(window.isVisible(),
|
||||
"window shouldn't be visible");
|
||||
} else { // WindowParent.NEW_FRAME
|
||||
window.checkOpenButtonFocusGained(false, 10);
|
||||
}
|
||||
} else { // DialogParent.NULL_DIALOG
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
dialog.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog.openGained.reset();
|
||||
|
||||
frame.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
dialog.checkOpenButtonFocusGained(true);
|
||||
|
||||
window.openGained.reset();
|
||||
|
||||
dialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkOpenButtonFocusGained(false, 10);
|
||||
}
|
||||
break;
|
||||
|
||||
case MODELESS:
|
||||
|
||||
frame.checkCloseButtonFocusGained(true);
|
||||
dialog.checkOpenButtonFocusLost(true);
|
||||
|
||||
dialog.openGained.reset();
|
||||
|
||||
frame.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
if (dialogParent == DialogParent.NULL_DIALOG) {
|
||||
dialog.checkOpenButtonFocusGained(true);
|
||||
|
||||
window.openGained.reset();
|
||||
|
||||
dialog.clickCloseButton(robot);
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
window.checkOpenButtonFocusGained(false, 10);
|
||||
} else {
|
||||
assertFalse(dialog.isVisible(),
|
||||
"dialog shouldn't be visible");
|
||||
|
||||
if (windowParent == WindowParent.FRAME) {
|
||||
assertFalse(window.isVisible(),
|
||||
"window shouldn't be visible");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
// make screenshot before exit
|
||||
Rectangle rect = new Rectangle(0, 0, 650, 250);
|
||||
java.awt.image.BufferedImage img = robot.createScreenCapture(rect);
|
||||
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg"));
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check modality settings for Window and Dialog.
|
||||
*
|
||||
* @library ../../../../lib/testlibrary/
|
||||
* @run main ModalitySettingsTest
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class ModalitySettingsTest {
|
||||
|
||||
private void doTest() throws Exception {
|
||||
|
||||
Window w = new Window(new Frame());
|
||||
|
||||
boolean unexpectedExc = false;
|
||||
|
||||
try {
|
||||
Dialog d = new Dialog(w);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (Exception e) {
|
||||
unexpectedExc = true;
|
||||
}
|
||||
|
||||
assertFalse(unexpectedExc, "unexpected exception occured when a " +
|
||||
"Window instance was passed to Dialog constructor");
|
||||
|
||||
Dialog d = new Dialog((Frame) null);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS,
|
||||
"the default modality type returned by Dialog " +
|
||||
"differs from Dialog.ModalityType.MODELESS");
|
||||
|
||||
Frame f = new Frame();
|
||||
assertTrue(f.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE,
|
||||
"the default modality exclusion type returned by Frame" +
|
||||
"differs from Dialog.ModalExclusionType.NO_EXCLUDE");
|
||||
|
||||
w = new Window((Frame) null);
|
||||
assertTrue(w.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE,
|
||||
"the default modality exclusion type returned by Window " +
|
||||
"differs from Dialog.ModalExclusionType.NO_EXCLUDE");
|
||||
|
||||
d = new Dialog((Frame) null);
|
||||
assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE,
|
||||
"the default modality exclusion type returned by Dialog " +
|
||||
"differs from Dialog.ModalExclusionType.NO_EXCLUDE");
|
||||
|
||||
d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL,
|
||||
"the modality type returned by Dialog " +
|
||||
"differs from Dialog.ModalityType.TOOLKIT_MODAL " +
|
||||
"after setting the modality type to that value");
|
||||
|
||||
d.setModal(false);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS,
|
||||
"the modality type returned by Dialog differs from " +
|
||||
"Dialog.ModalityType.MODELESS after calling setModal(false)");
|
||||
|
||||
d.setModal(true);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL,
|
||||
"the modality type returned by Dialog differs from "
|
||||
+ "Dialog.ModalityType.APPLICATION_MODAL after calling setModal(true)");
|
||||
|
||||
w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
|
||||
assertTrue(w.getModalExclusionType() ==
|
||||
Dialog.ModalExclusionType.APPLICATION_EXCLUDE,
|
||||
"getModalExclusionType method for Window did not return " +
|
||||
"Dialog.ModalExclusionType.APPLICATION_EXCLUDE after " +
|
||||
"setting it to that value");
|
||||
|
||||
d = new Dialog((Frame) null);
|
||||
d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
|
||||
assertTrue(d.isModal(), "method isModal for Dialog " +
|
||||
"returned false when the Dialog is toolkit modal");
|
||||
|
||||
d.setModalityType(Dialog.ModalityType.MODELESS);
|
||||
assertFalse(d.isModal(), "method isModal for Dialog " +
|
||||
"returned true when the Dialog is MODELESS");
|
||||
|
||||
d = new Dialog((Frame) null, (Dialog.ModalityType) null);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS,
|
||||
"The modality type returned for a Dialog constructed " +
|
||||
"with null modality type differs from MODELESS");
|
||||
|
||||
d = new Dialog((Frame) null);
|
||||
d.setModalityType(null);
|
||||
assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS,
|
||||
"the modality type returned for a Dialog set with null " +
|
||||
"modality type differs from MODELESS");
|
||||
|
||||
d.setModalExclusionType(null);
|
||||
assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE,
|
||||
"The exlcusion type returned for a Dialog set with null " +
|
||||
"exclusion type differs from NO_EXCLUDE");
|
||||
|
||||
try {
|
||||
Dialog.ModalityType.valueOf("invalid");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (Exception e) {
|
||||
unexpectedExc = true;
|
||||
}
|
||||
|
||||
assertFalse(unexpectedExc, "unexpected exception occured when an " +
|
||||
"invalid value was passed to ModalityType.valueOf method");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ModalitySettingsTest test = new ModalitySettingsTest();
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import static jdk.testlibrary.Asserts.*;
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8047367
|
||||
* @summary Check whether a Dialog set with null modality type
|
||||
* behaves like a modeless dialog
|
||||
*
|
||||
* @library ../helpers ../../../../lib/testlibrary/
|
||||
* @build ExtendedRobot
|
||||
* @build Flag
|
||||
* @build TestDialog
|
||||
* @build TestFrame
|
||||
* @build TestWindow
|
||||
* @run main NullModalityDialogTest
|
||||
*/
|
||||
|
||||
|
||||
public class NullModalityDialogTest {
|
||||
|
||||
class CustomDialog extends TestDialog {
|
||||
public CustomDialog(Frame f) {
|
||||
super(f);
|
||||
}
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (frame != null) {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
if (window != null) {
|
||||
window.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustomFrame extends TestFrame {
|
||||
@Override
|
||||
public void doOpenAction() {
|
||||
if (dialog != null) {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TestFrame parent;
|
||||
private TestDialog dialog;
|
||||
private TestFrame frame;
|
||||
private TestWindow window;
|
||||
|
||||
private static final int delay = 1000;
|
||||
|
||||
private final ExtendedRobot robot;
|
||||
|
||||
NullModalityDialogTest() throws Exception {
|
||||
|
||||
robot = new ExtendedRobot();
|
||||
EventQueue.invokeLater(this::createGUI);
|
||||
}
|
||||
|
||||
private void createGUI() {
|
||||
|
||||
parent = new CustomFrame();
|
||||
parent.setTitle("Parent");
|
||||
parent.setLocation(50, 50);
|
||||
|
||||
dialog = new CustomDialog(parent);
|
||||
dialog.setTitle("Dialog");
|
||||
dialog.setModalityType((Dialog.ModalityType) null);
|
||||
dialog.setLocation(250, 50);
|
||||
|
||||
frame = new TestFrame();
|
||||
frame.setTitle("Frame");
|
||||
frame.setLocation(50, 250);
|
||||
|
||||
window = new TestWindow(frame);
|
||||
window.setLocation(250, 250);
|
||||
|
||||
parent.setVisible(true);
|
||||
}
|
||||
|
||||
private void closeAll() {
|
||||
if (parent != null) { parent.dispose(); }
|
||||
if (dialog != null) { dialog.dispose(); }
|
||||
if (frame != null) { frame.dispose(); }
|
||||
if (window != null) { window.dispose(); }
|
||||
}
|
||||
|
||||
public void doTest() throws Exception {
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
parent.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 button in the Dialog " +
|
||||
"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);
|
||||
|
||||
frame.activated.waitForFlagTriggered();
|
||||
assertTrue(frame.activated.flag(), "Frame did not trigger activated when " +
|
||||
"made visible. Dialog and its parent frame are visible");
|
||||
|
||||
frame.checkUnblockedFrame(robot, "Frame is the parent of a visible Dialog.");
|
||||
window.checkUnblockedWindow(robot, "Frame and its child Dialog are visible.");
|
||||
|
||||
robot.waitForIdle(delay);
|
||||
|
||||
EventQueue.invokeAndWait(this::closeAll);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
NullModalityDialogTest test = new NullModalityDialogTest();
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
@ -332,35 +332,47 @@ public class TestDialog extends Dialog implements ActionListener,
|
||||
"button did not gain focus. " + message);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained() {
|
||||
checkCloseButtonFocusGained(Flag.ATTEMPTS);
|
||||
public void checkCloseButtonFocusGained(boolean refState) {
|
||||
checkCloseButtonFocusGained(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained(int attempts) {
|
||||
public void checkCloseButtonFocusGained(boolean refState, int attempts) {
|
||||
try {
|
||||
closeGained.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(closeGained.flag(),
|
||||
"dialog Close button did not gain focus");
|
||||
|
||||
String msg = "dialog Close button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(closeGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusGained() {
|
||||
public void checkOpenButtonFocusGained(boolean refState) {
|
||||
try {
|
||||
openGained.waitForFlagTriggered();
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(openGained.flag(),
|
||||
"dialog Open button did not gain focus");
|
||||
|
||||
String msg = "dialog Open button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(openGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost() {
|
||||
checkOpenButtonFocusLost(Flag.ATTEMPTS);
|
||||
public void checkOpenButtonFocusLost(boolean refState) {
|
||||
checkOpenButtonFocusLost(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost(int attempts) {
|
||||
public void checkOpenButtonFocusLost(boolean refState, int attempts) {
|
||||
try {
|
||||
openLost.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(openLost.flag(),
|
||||
"dialog Open button did not lose focus");
|
||||
|
||||
String msg = "dialog Open button ";
|
||||
msg += (refState ? "did not lose focus" :
|
||||
"lost focus when it should not");
|
||||
|
||||
assertTrue(openLost.flag() == refState, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,46 +324,50 @@ public class TestFrame extends Frame implements ActionListener,
|
||||
"button did not gain focus on tab press. " + message);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained() {
|
||||
checkCloseButtonFocusGained(Flag.ATTEMPTS);
|
||||
public void checkCloseButtonFocusGained(boolean refState) {
|
||||
checkCloseButtonFocusGained(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained(int attempts) {
|
||||
|
||||
public void checkCloseButtonFocusGained(boolean refState, int attempts) {
|
||||
try {
|
||||
closeGained.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
if (closeGained.flag()) {
|
||||
Component focusOwner =
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
assertTrue(closeButton.equals(focusOwner),
|
||||
"close button gained focus, but it is not the current focus owner");
|
||||
} else {
|
||||
assertTrue(false, "frame Close button did not gain focus");
|
||||
}
|
||||
String msg = "frame Close button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(closeGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusGained() {
|
||||
try {
|
||||
openGained.waitForFlagTriggered();
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
if (openGained.flag()) {
|
||||
Component focusOwner =
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
assertTrue(openButton.equals(focusOwner),
|
||||
"open button gained focus, but it is not the current focus owner");
|
||||
} else {
|
||||
assertTrue(false, "frame Open button did not gain focus");
|
||||
}
|
||||
public void checkOpenButtonFocusGained(boolean refState) {
|
||||
checkOpenButtonFocusGained(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost() {
|
||||
public void checkOpenButtonFocusGained(boolean refState, int attempts) {
|
||||
try {
|
||||
openLost.waitForFlagTriggered();
|
||||
openGained.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
assertTrue(openLost.flag(), "frame Open button did not lose focus");
|
||||
String msg = "frame Open button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(openGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost(boolean refState) {
|
||||
checkOpenButtonFocusLost(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost(boolean refState, int attempts) {
|
||||
try {
|
||||
openLost.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
|
||||
String msg = "frame Open button ";
|
||||
msg += (refState ? "did not lose focus" :
|
||||
"lost focus when it should not");
|
||||
assertTrue(openLost.flag()== refState, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,39 +295,51 @@ public class TestWindow extends Window implements ActionListener,
|
||||
"button did not gain focus on tab press. " + message);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained() {
|
||||
checkCloseButtonFocusGained(Flag.ATTEMPTS);
|
||||
public void checkCloseButtonFocusGained(boolean refState) {
|
||||
checkCloseButtonFocusGained(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkCloseButtonFocusGained(int attempts) {
|
||||
public void checkCloseButtonFocusGained(boolean refState, int attempts) {
|
||||
try {
|
||||
closeGained.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(closeGained.flag(),
|
||||
"window Close button did not gain focus");
|
||||
|
||||
String msg = "window Close button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(closeGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusGained() {
|
||||
checkOpenButtonFocusGained(Flag.ATTEMPTS);
|
||||
|
||||
public void checkOpenButtonFocusGained(boolean refState) {
|
||||
checkOpenButtonFocusGained(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusGained(int attempts) {
|
||||
public void checkOpenButtonFocusGained(boolean refState, int attempts) {
|
||||
try {
|
||||
openGained.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(openGained.flag(),
|
||||
"window Open button did not gain focus");
|
||||
|
||||
String msg = "window Open button ";
|
||||
msg += (refState ? "did not gain focus" :
|
||||
"gained focus when it should not");
|
||||
|
||||
assertTrue(openGained.flag() == refState, msg);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost() {
|
||||
checkOpenButtonFocusLost(Flag.ATTEMPTS);
|
||||
public void checkOpenButtonFocusLost(boolean refState) {
|
||||
checkOpenButtonFocusLost(refState, Flag.ATTEMPTS);
|
||||
}
|
||||
|
||||
public void checkOpenButtonFocusLost(int attempts) {
|
||||
public void checkOpenButtonFocusLost(boolean refState, int attempts) {
|
||||
try {
|
||||
openLost.waitForFlagTriggered(attempts);
|
||||
} catch (InterruptedException e) {}
|
||||
assertTrue(openLost.flag(),
|
||||
"window Open button did not lose focus");
|
||||
|
||||
String msg = "window Open button ";
|
||||
msg += (refState ? "did not lose focus" :
|
||||
"lost focus when it should not");
|
||||
assertTrue(openLost.flag()== refState, msg);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user