8280988: [XWayland] Click on title to request focus test failures
Reviewed-by: honkar, serb
This commit is contained in:
parent
99654ec3fb
commit
f6cdcc6f65
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,8 +27,8 @@
|
|||||||
* @bug 6981400
|
* @bug 6981400
|
||||||
* @summary Tabbing between textfiled do not work properly when ALT+TAB
|
* @summary Tabbing between textfiled do not work properly when ALT+TAB
|
||||||
* @author anton.tarasov
|
* @author anton.tarasov
|
||||||
* @library ../../regtesthelpers
|
* @library /java/awt/regtesthelpers /test/lib
|
||||||
* @build Util
|
* @build Util jdk.test.lib.Platform
|
||||||
* @run main Test1
|
* @run main Test1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -41,12 +41,28 @@
|
|||||||
// The FOCUS_LOST/FOCUS_GAINED events order in the original frame is tracked and should be:
|
// The FOCUS_LOST/FOCUS_GAINED events order in the original frame is tracked and should be:
|
||||||
// b0 -> b1 -> b2 -> b3.
|
// b0 -> b1 -> b2 -> b3.
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.event.*;
|
import java.awt.AWTException;
|
||||||
|
import java.awt.Button;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.event.AWTEventListener;
|
||||||
|
import java.awt.event.FocusAdapter;
|
||||||
|
import java.awt.event.FocusEvent;
|
||||||
|
import java.awt.event.FocusListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.*;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
import test.java.awt.regtesthelpers.Util;
|
import test.java.awt.regtesthelpers.Util;
|
||||||
|
|
||||||
public class Test1 {
|
public class Test1 {
|
||||||
@ -72,7 +88,7 @@ public class Test1 {
|
|||||||
|
|
||||||
static boolean tracking;
|
static boolean tracking;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws Exception {
|
||||||
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
|
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
|
||||||
public void eventDispatched(AWTEvent e) {
|
public void eventDispatched(AWTEvent e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
@ -81,6 +97,7 @@ public class Test1 {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
robot = new Robot();
|
robot = new Robot();
|
||||||
|
robot.setAutoDelay(50);
|
||||||
} catch (AWTException ex) {
|
} catch (AWTException ex) {
|
||||||
throw new RuntimeException("Error: can't create Robot");
|
throw new RuntimeException("Error: can't create Robot");
|
||||||
}
|
}
|
||||||
@ -90,13 +107,13 @@ public class Test1 {
|
|||||||
f0.add(f0b2);
|
f0.add(f0b2);
|
||||||
f0.add(f0b3);
|
f0.add(f0b3);
|
||||||
f0.setLayout(new FlowLayout());
|
f0.setLayout(new FlowLayout());
|
||||||
f0.setBounds(0, 100, 400, 200);
|
f0.setBounds(100, 100, 400, 200);
|
||||||
|
|
||||||
f1.add(f1b0);
|
f1.add(f1b0);
|
||||||
f1.setBounds(0, 400, 400, 200);
|
f1.setBounds(100, 400, 400, 200);
|
||||||
|
|
||||||
f2.add(f2b0);
|
f2.add(f2b0);
|
||||||
f2.setBounds(0, 400, 400, 200);
|
f2.setBounds(100, 400, 400, 200);
|
||||||
|
|
||||||
f0b0.addFocusListener(new FocusAdapter() {
|
f0b0.addFocusListener(new FocusAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@ -115,6 +132,7 @@ public class Test1 {
|
|||||||
f0.setVisible(true);
|
f0.setVisible(true);
|
||||||
|
|
||||||
Util.waitForIdle(robot);
|
Util.waitForIdle(robot);
|
||||||
|
robot.delay(500);
|
||||||
|
|
||||||
if (!f0b0.isFocusOwner()) {
|
if (!f0b0.isFocusOwner()) {
|
||||||
Util.clickOnComp(f0b0, robot);
|
Util.clickOnComp(f0b0, robot);
|
||||||
@ -152,28 +170,29 @@ public class Test1 {
|
|||||||
System.out.println("\nTest passed.");
|
System.out.println("\nTest passed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test(Component compToClick) {
|
public static void test(Component compToClick) throws Exception {
|
||||||
tracking = true;
|
tracking = true;
|
||||||
|
|
||||||
robot.keyPress(KeyEvent.VK_TAB);
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
robot.delay(50);
|
|
||||||
robot.keyRelease(KeyEvent.VK_TAB);
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
robot.delay(50);
|
robot.waitForIdle();
|
||||||
|
|
||||||
robot.keyPress(KeyEvent.VK_TAB);
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
robot.delay(50);
|
|
||||||
robot.keyRelease(KeyEvent.VK_TAB);
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
robot.delay(50);
|
robot.waitForIdle();
|
||||||
|
|
||||||
robot.keyPress(KeyEvent.VK_TAB);
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
robot.delay(50);
|
|
||||||
robot.keyRelease(KeyEvent.VK_TAB);
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
robot.delay(50);
|
|
||||||
Util.clickOnComp(compToClick, robot);
|
Util.clickOnComp(compToClick, robot);
|
||||||
|
|
||||||
robot.delay(50);
|
robot.waitForIdle();
|
||||||
Util.clickOnTitle(f0, robot);
|
SwingUtilities.invokeAndWait(f0::toFront);
|
||||||
|
|
||||||
|
if (!Platform.isOnWayland()) {
|
||||||
|
Util.clickOnTitle(f0, robot);
|
||||||
|
}
|
||||||
|
|
||||||
Util.waitForIdle(robot);
|
Util.waitForIdle(robot);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,13 +26,27 @@
|
|||||||
@key headful
|
@key headful
|
||||||
@bug 6314575
|
@bug 6314575
|
||||||
@summary Tests that previosly focused owned window doesn't steal focus when an owner's component requests focus.
|
@summary Tests that previosly focused owned window doesn't steal focus when an owner's component requests focus.
|
||||||
@library ../../regtesthelpers
|
@library /java/awt/regtesthelpers /test/lib
|
||||||
@build Util
|
@build Util jdk.test.lib.Platform
|
||||||
@run main ActualFocusedWindowBlockingTest
|
@run main ActualFocusedWindowBlockingTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.event.*;
|
import java.awt.Button;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.KeyboardFocusManager;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.Window;
|
||||||
|
import java.awt.event.AWTEventListener;
|
||||||
|
import java.awt.event.FocusEvent;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
import test.java.awt.regtesthelpers.Util;
|
import test.java.awt.regtesthelpers.Util;
|
||||||
|
|
||||||
public class ActualFocusedWindowBlockingTest {
|
public class ActualFocusedWindowBlockingTest {
|
||||||
@ -44,7 +58,7 @@ public class ActualFocusedWindowBlockingTest {
|
|||||||
Button wButton = new Button("window button") {public String toString() {return "Window_Button";}};
|
Button wButton = new Button("window button") {public String toString() {return "Window_Button";}};
|
||||||
Button aButton = new Button("auxiliary button") {public String toString() {return "Auxiliary_Button";}};
|
Button aButton = new Button("auxiliary button") {public String toString() {return "Auxiliary_Button";}};
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws Exception {
|
||||||
ActualFocusedWindowBlockingTest app = new ActualFocusedWindowBlockingTest();
|
ActualFocusedWindowBlockingTest app = new ActualFocusedWindowBlockingTest();
|
||||||
app.init();
|
app.init();
|
||||||
app.start();
|
app.start();
|
||||||
@ -68,7 +82,7 @@ public class ActualFocusedWindowBlockingTest {
|
|||||||
tuneAndShowWindows(new Window[] {owner, win, frame});
|
tuneAndShowWindows(new Window[] {owner, win, frame});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() throws Exception {
|
||||||
System.out.println("\nTest started:\n");
|
System.out.println("\nTest started:\n");
|
||||||
|
|
||||||
// Test 1.
|
// Test 1.
|
||||||
@ -99,7 +113,12 @@ public class ActualFocusedWindowBlockingTest {
|
|||||||
clickOnCheckFocus(fButton);
|
clickOnCheckFocus(fButton);
|
||||||
clickOnCheckFocus(aButton);
|
clickOnCheckFocus(aButton);
|
||||||
|
|
||||||
Util.clickOnTitle(owner, robot);
|
EventQueue.invokeAndWait(owner::toFront);
|
||||||
|
|
||||||
|
if (!Platform.isOnWayland()) {
|
||||||
|
Util.clickOnTitle(owner, robot);
|
||||||
|
}
|
||||||
|
|
||||||
if (!testFocused(fButton)) {
|
if (!testFocused(fButton)) {
|
||||||
throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused as the most recent focus owner");
|
throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused as the most recent focus owner");
|
||||||
}
|
}
|
||||||
@ -117,11 +136,15 @@ public class ActualFocusedWindowBlockingTest {
|
|||||||
y += 200;
|
y += 200;
|
||||||
Util.waitForIdle(robot);
|
Util.waitForIdle(robot);
|
||||||
}
|
}
|
||||||
|
robot.delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clickOnCheckFocus(Component c) {
|
void clickOnCheckFocus(Component c) throws Exception {
|
||||||
if (c instanceof Frame) {
|
if (c instanceof Frame) {
|
||||||
Util.clickOnTitle((Frame)c, robot);
|
EventQueue.invokeAndWait(() -> ((Frame) c).toFront());
|
||||||
|
if (!Platform.isOnWayland()) {
|
||||||
|
Util.clickOnTitle((Frame) c, robot);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Util.clickOnComp(c, robot);
|
Util.clickOnComp(c, robot);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,11 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
test
|
@test
|
||||||
|
@key headful
|
||||||
@bug 4531693 4636269 4681908 4688142 4691646 4721470
|
@bug 4531693 4636269 4681908 4688142 4691646 4721470
|
||||||
@summary Showing modal dialog during dispatching SequencedEvent
|
@summary Showing modal dialog during dispatching SequencedEvent
|
||||||
@key headful
|
@run main ModalDialogInFocusEventTest
|
||||||
@run main AutomaticAppletTest
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.AWTEvent;
|
import java.awt.AWTEvent;
|
||||||
@ -68,6 +68,8 @@ public class ModalDialogInFocusEventTest
|
|||||||
static final int MAX_STAGE_NUM = stages.length;
|
static final int MAX_STAGE_NUM = stages.length;
|
||||||
static final Object stageMonitor = new Object();
|
static final Object stageMonitor = new Object();
|
||||||
|
|
||||||
|
static boolean isOnWayland;
|
||||||
|
|
||||||
Robot robot = null;
|
Robot robot = null;
|
||||||
Frame frame;
|
Frame frame;
|
||||||
Frame oppositeFrame;
|
Frame oppositeFrame;
|
||||||
@ -209,18 +211,21 @@ public class ModalDialogInFocusEventTest
|
|||||||
|
|
||||||
void clickOnFrameTitle(Frame frame) throws InterruptedException,
|
void clickOnFrameTitle(Frame frame) throws InterruptedException,
|
||||||
InvocationTargetException {
|
InvocationTargetException {
|
||||||
System.out.println("click on title of " + frame.getName());
|
EventQueue.invokeAndWait(frame::toFront);
|
||||||
int[] point = new int[2];
|
if (!isOnWayland) {
|
||||||
EventQueue.invokeAndWait(() -> {
|
System.out.println("click on title of " + frame.getName());
|
||||||
Point location = frame.getLocationOnScreen();
|
int[] point = new int[2];
|
||||||
Insets insets = frame.getInsets();
|
EventQueue.invokeAndWait(() -> {
|
||||||
int width = frame.getWidth();
|
Point location = frame.getLocationOnScreen();
|
||||||
point[0] = location.x + width / 2;
|
Insets insets = frame.getInsets();
|
||||||
point[1] = location.y + insets.top / 2;
|
int width = frame.getWidth();
|
||||||
});
|
point[0] = location.x + width / 2;
|
||||||
robot.mouseMove(point[0], point[1]);
|
point[1] = location.y + insets.top / 2;
|
||||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
});
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
robot.mouseMove(point[0], point[1]);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
}
|
||||||
EventQueue.invokeAndWait(frame::requestFocusInWindow);
|
EventQueue.invokeAndWait(frame::requestFocusInWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,6 +349,7 @@ public class ModalDialogInFocusEventTest
|
|||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException,
|
public static void main(String[] args) throws InterruptedException,
|
||||||
InvocationTargetException {
|
InvocationTargetException {
|
||||||
|
isOnWayland = System.getenv("WAYLAND_DISPLAY") != null;
|
||||||
ModalDialogInFocusEventTest test = new ModalDialogInFocusEventTest();
|
ModalDialogInFocusEventTest test = new ModalDialogInFocusEventTest();
|
||||||
test.start();
|
test.start();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,12 +21,33 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.awt.Button;
|
||||||
import java.awt.*;
|
import java.awt.Checkbox;
|
||||||
import java.awt.event.*;
|
import java.awt.Choice;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Label;
|
||||||
|
import java.awt.List;
|
||||||
|
import java.awt.Panel;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.Scrollbar;
|
||||||
|
import java.awt.TextArea;
|
||||||
|
import java.awt.TextField;
|
||||||
|
import java.awt.event.HierarchyBoundsListener;
|
||||||
|
import java.awt.event.HierarchyEvent;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import java.io.*;
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AWT Mixing test for HierarchyBoundsListener ancestors.
|
* AWT Mixing test for HierarchyBoundsListener ancestors.
|
||||||
@ -37,7 +58,8 @@ import java.io.*;
|
|||||||
* @key headful
|
* @key headful
|
||||||
* @bug 6768230 8221823
|
* @bug 6768230 8221823
|
||||||
* @summary Mixing test for HierarchyBoundsListener ancestors
|
* @summary Mixing test for HierarchyBoundsListener ancestors
|
||||||
* @build FrameBorderCounter
|
* @library /test/lib
|
||||||
|
* @build FrameBorderCounter jdk.test.lib.Platform
|
||||||
* @run main HierarchyBoundsListenerMixingTest
|
* @run main HierarchyBoundsListenerMixingTest
|
||||||
*/
|
*/
|
||||||
public class HierarchyBoundsListenerMixingTest {
|
public class HierarchyBoundsListenerMixingTest {
|
||||||
@ -137,9 +159,9 @@ public class HierarchyBoundsListenerMixingTest {
|
|||||||
robot.mouseMove((int) components[0].getLocationOnScreen().x + components[0].getSize().width / 2,
|
robot.mouseMove((int) components[0].getLocationOnScreen().x + components[0].getSize().width / 2,
|
||||||
(int) components[0].getLocationOnScreen().y + components[0].getSize().height / 2);
|
(int) components[0].getLocationOnScreen().y + components[0].getSize().height / 2);
|
||||||
robot.delay(delay);
|
robot.delay(delay);
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
robot.delay(delay);
|
robot.delay(delay);
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
robot.delay(delay);
|
robot.delay(delay);
|
||||||
|
|
||||||
resetValues();
|
resetValues();
|
||||||
@ -177,45 +199,54 @@ public class HierarchyBoundsListenerMixingTest {
|
|||||||
robot.delay(delay * 5);
|
robot.delay(delay * 5);
|
||||||
|
|
||||||
resetValues();
|
resetValues();
|
||||||
int x = (int) frame.getLocationOnScreen().x;
|
|
||||||
int y = (int) frame.getLocationOnScreen().y;
|
|
||||||
int w = frame.getSize().width;
|
|
||||||
int h = frame.getSize().height;
|
|
||||||
|
|
||||||
robot.mouseMove(x + w + BORDER_SHIFT, y + h / 2);
|
int x;
|
||||||
robot.delay(delay);
|
int y;
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
int w;
|
||||||
robot.delay(delay);
|
int h;
|
||||||
for (int i = 0; i < 20; i++) {
|
|
||||||
robot.mouseMove(x + w + i + BORDER_SHIFT, y + h / 2);
|
|
||||||
robot.delay(50);
|
|
||||||
}
|
|
||||||
robot.delay(delay);
|
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
|
||||||
|
|
||||||
if (! resizeTriggered) {
|
if (!Platform.isOnWayland()) {
|
||||||
synchronized (resizeLock) {
|
x = frame.getLocationOnScreen().x;
|
||||||
try {
|
y = frame.getLocationOnScreen().y;
|
||||||
resizeLock.wait(delay * 10);
|
w = frame.getSize().width;
|
||||||
} catch (Exception e) {
|
h = frame.getSize().height;
|
||||||
|
|
||||||
|
robot.mouseMove(x + w + BORDER_SHIFT, y + h / 2);
|
||||||
|
robot.delay(delay);
|
||||||
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
robot.delay(delay);
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
robot.mouseMove(x + w + i + BORDER_SHIFT, y + h / 2);
|
||||||
|
robot.delay(50);
|
||||||
|
}
|
||||||
|
robot.delay(delay);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
|
||||||
|
if (!resizeTriggered) {
|
||||||
|
synchronized (resizeLock) {
|
||||||
|
try {
|
||||||
|
resizeLock.wait(delay * 10);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < components.length; i++) {
|
for (int i = 0; i < components.length; i++) {
|
||||||
if (! ancestorResized[i]) {
|
if (!ancestorResized[i]) {
|
||||||
System.err.println("FAIL: Frame resized using mouse action. " +
|
System.err.println("FAIL: Frame resized using mouse action. " +
|
||||||
"Ancestor resized event did not occur for " +
|
"Ancestor resized event did not occur for " +
|
||||||
components[i].getClass());
|
components[i].getClass());
|
||||||
|
passed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (moveCount > 0) {
|
||||||
|
System.err.println("FAIL: Ancestor moved event occurred when Frame resized using mouse");
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (moveCount > 0) {
|
resetValues();
|
||||||
System.err.println("FAIL: Ancestor moved event occured when Frame resized using mouse");
|
|
||||||
passed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetValues();
|
|
||||||
try {
|
try {
|
||||||
EventQueue.invokeAndWait(new Runnable() {
|
EventQueue.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -250,52 +281,55 @@ public class HierarchyBoundsListenerMixingTest {
|
|||||||
robot.delay(delay * 10);
|
robot.delay(delay * 10);
|
||||||
|
|
||||||
resetValues();
|
resetValues();
|
||||||
x = (int) frame.getLocationOnScreen().x;
|
|
||||||
y = (int) frame.getLocationOnScreen().y;
|
|
||||||
w = frame.getSize().width;
|
|
||||||
h = frame.getSize().height;
|
|
||||||
|
|
||||||
//Click on the dummy frame so that the test frame loses focus. This is to workaround
|
if (!Platform.isOnWayland()) {
|
||||||
//a bug in Linux AS.
|
x = frame.getLocationOnScreen().x;
|
||||||
robot.mouseMove((int) dummy.getLocationOnScreen().x + dummy.getSize().width / 2,
|
y = frame.getLocationOnScreen().y;
|
||||||
(int) dummy.getLocationOnScreen().y + dummy.getSize().height / 2);
|
w = frame.getSize().width;
|
||||||
robot.delay(delay);
|
h = frame.getSize().height;
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
|
||||||
robot.delay(delay);
|
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
|
||||||
robot.delay(delay);
|
|
||||||
|
|
||||||
robot.mouseMove(x + w / 2, y + 10);
|
//Click on the dummy frame so that the test frame loses focus. This is to workaround
|
||||||
robot.delay(delay);
|
//a bug in Linux AS.
|
||||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
robot.mouseMove((int) dummy.getLocationOnScreen().x + dummy.getSize().width / 2,
|
||||||
robot.delay(delay);
|
(int) dummy.getLocationOnScreen().y + dummy.getSize().height / 2);
|
||||||
for (int i = 1; i <= 20; i++) {
|
robot.delay(delay);
|
||||||
robot.mouseMove(x + w / 2 + i, y + 10);
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
robot.delay(50);
|
robot.delay(delay);
|
||||||
}
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
robot.delay(delay);
|
robot.delay(delay);
|
||||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
|
||||||
|
|
||||||
if (! moveTriggered) {
|
robot.mouseMove(x + w / 2, y + 10);
|
||||||
synchronized (moveLock) {
|
robot.delay(delay);
|
||||||
try {
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
moveLock.wait(delay * 10);
|
robot.delay(delay);
|
||||||
} catch (Exception e) {
|
for (int i = 1; i <= 20; i++) {
|
||||||
|
robot.mouseMove(x + w / 2 + i, y + 10);
|
||||||
|
robot.delay(50);
|
||||||
|
}
|
||||||
|
robot.delay(delay);
|
||||||
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||||
|
|
||||||
|
if (! moveTriggered) {
|
||||||
|
synchronized (moveLock) {
|
||||||
|
try {
|
||||||
|
moveLock.wait(delay * 10);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < components.length; i++) {
|
for (int i = 0; i < components.length; i++) {
|
||||||
if (! ancestorMoved[i]) {
|
if (! ancestorMoved[i]) {
|
||||||
System.err.println("FAIL: Frame moved using mouse action. " +
|
System.err.println("FAIL: Frame moved using mouse action. " +
|
||||||
"Ancestor moved event did not occur for " + components[i].getClass());
|
"Ancestor moved event did not occur for " + components[i].getClass());
|
||||||
|
passed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resizeCount > 0) {
|
||||||
|
System.err.println("FAIL: Ancestor resized event occured when Frame moved using mouse");
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resizeCount > 0) {
|
|
||||||
System.err.println("FAIL: Ancestor resized event occured when Frame moved using mouse");
|
|
||||||
passed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
@ -450,7 +484,7 @@ public class HierarchyBoundsListenerMixingTest {
|
|||||||
// instantiated in the same VM. Being static (and using
|
// instantiated in the same VM. Being static (and using
|
||||||
// static vars), it aint gonna work. Not worrying about
|
// static vars), it aint gonna work. Not worrying about
|
||||||
// it for now.
|
// it for now.
|
||||||
public static void main(String args[]) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
mainThread = Thread.currentThread();
|
mainThread = Thread.currentThread();
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -473,4 +473,13 @@ public class Platform {
|
|||||||
public static boolean areCustomLoadersSupportedForCDS() {
|
public static boolean areCustomLoadersSupportedForCDS() {
|
||||||
return (is64bit() && (isLinux() || isOSX() || isWindows()));
|
return (is64bit() && (isLinux() || isOSX() || isWindows()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current system is running on Wayland display server on Linux.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the system is running on Wayland display server
|
||||||
|
*/
|
||||||
|
public static boolean isOnWayland() {
|
||||||
|
return System.getenv("WAYLAND_DISPLAY") != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user