undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @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/client/
|
||||
* @library /test/lib
|
||||
* @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, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
// 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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,50 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,52 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,51 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
|
||||
// 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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,54 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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,53 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 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/client/
|
||||
* @library /test/lib
|
||||
* @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, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
import java.awt.*;
|
||||
import static jdk.test.lib.Asserts.*;
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue