8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
Reviewed-by: pchelko, serb
This commit is contained in:
parent
e8c7cc1187
commit
043868fac7
@ -33,15 +33,12 @@ import java.awt.*;
|
|||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
import com.sun.awt.AWTUtilities;
|
import com.sun.awt.AWTUtilities;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class WindowOpacity
|
public class WindowOpacity
|
||||||
{
|
{
|
||||||
//*** test-writer defined static variables go here ***
|
//*** test-writer defined static variables go here ***
|
||||||
|
|
||||||
private static void realSync() {
|
private static Robot robot;
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void init()
|
private static void init()
|
||||||
@ -60,6 +57,12 @@ public class WindowOpacity
|
|||||||
System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level.");
|
System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level.");
|
||||||
pass();
|
pass();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException ("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
boolean passed;
|
boolean passed;
|
||||||
|
|
||||||
@ -137,7 +140,7 @@ public class WindowOpacity
|
|||||||
f.setBounds(100, 100, 300, 200);
|
f.setBounds(100, 100, 300, 200);
|
||||||
f.setVisible(true);
|
f.setVisible(true);
|
||||||
|
|
||||||
realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
curOpacity = AWTUtilities.getWindowOpacity(f);
|
curOpacity = AWTUtilities.getWindowOpacity(f);
|
||||||
if (curOpacity < 0.75f || curOpacity > 0.75f) {
|
if (curOpacity < 0.75f || curOpacity > 0.75f) {
|
||||||
@ -147,7 +150,7 @@ public class WindowOpacity
|
|||||||
|
|
||||||
|
|
||||||
AWTUtilities.setWindowOpacity(f, 0.5f);
|
AWTUtilities.setWindowOpacity(f, 0.5f);
|
||||||
realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
curOpacity = AWTUtilities.getWindowOpacity(f);
|
curOpacity = AWTUtilities.getWindowOpacity(f);
|
||||||
if (curOpacity < 0.5f || curOpacity > 0.5f) {
|
if (curOpacity < 0.5f || curOpacity > 0.5f) {
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class NoUpdateUponShow
|
public class NoUpdateUponShow
|
||||||
{
|
{
|
||||||
@ -70,7 +69,13 @@ public class NoUpdateUponShow
|
|||||||
});
|
});
|
||||||
f.setVisible(true);
|
f.setVisible(true);
|
||||||
|
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
if (wasUpdate) {
|
if (wasUpdate) {
|
||||||
fail(" Unexpected update. ");
|
fail(" Unexpected update. ");
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.Button;
|
import java.awt.Button;
|
||||||
import java.awt.Canvas;
|
import java.awt.Canvas;
|
||||||
import java.awt.Checkbox;
|
import java.awt.Checkbox;
|
||||||
@ -48,6 +46,8 @@ import java.awt.image.BufferedImage;
|
|||||||
@bug 6596915
|
@bug 6596915
|
||||||
@summary Test Component.paintAll() method
|
@summary Test Component.paintAll() method
|
||||||
@author sergey.bylokhov@oracle.com: area=awt.component
|
@author sergey.bylokhov@oracle.com: area=awt.component
|
||||||
|
@library ../../../../lib/testlibrary/
|
||||||
|
@build ExtendedRobot
|
||||||
@run main PaintAll
|
@run main PaintAll
|
||||||
*/
|
*/
|
||||||
public class PaintAll {
|
public class PaintAll {
|
||||||
@ -66,6 +66,7 @@ public class PaintAll {
|
|||||||
private static volatile boolean scrollPanePainted;
|
private static volatile boolean scrollPanePainted;
|
||||||
private static volatile boolean textAreaPainted;
|
private static volatile boolean textAreaPainted;
|
||||||
private static volatile boolean textFieldPainted;
|
private static volatile boolean textFieldPainted;
|
||||||
|
private static ExtendedRobot robot = null;
|
||||||
|
|
||||||
private static final Button buttonStub = new Button() {
|
private static final Button buttonStub = new Button() {
|
||||||
@Override
|
@Override
|
||||||
@ -283,11 +284,15 @@ public class PaintAll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
if(robot == null) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500L);
|
robot = new ExtendedRobot();
|
||||||
} catch (InterruptedException ignored) {
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
robot.waitForIdle(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fail(final String message) {
|
private static void fail(final String message) {
|
||||||
|
@ -34,11 +34,9 @@ import java.awt.event.*;
|
|||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
import test.java.awt.regtesthelpers.Util;
|
import test.java.awt.regtesthelpers.Util;
|
||||||
|
|
||||||
public class ModalBlockedStealsFocusTest extends Applet {
|
public class ModalBlockedStealsFocusTest extends Applet {
|
||||||
SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
|
|
||||||
Frame frame = new Frame("Blocked Frame");
|
Frame frame = new Frame("Blocked Frame");
|
||||||
Dialog dialog = new Dialog(frame, "Modal Dialog", Dialog.ModalityType.TOOLKIT_MODAL);
|
Dialog dialog = new Dialog(frame, "Modal Dialog", Dialog.ModalityType.TOOLKIT_MODAL);
|
||||||
AtomicBoolean lostFocus = new AtomicBoolean(false);
|
AtomicBoolean lostFocus = new AtomicBoolean(false);
|
||||||
@ -85,7 +83,13 @@ public class ModalBlockedStealsFocusTest extends Applet {
|
|||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
Util.waitTillShown(dialog);
|
Util.waitTillShown(dialog);
|
||||||
toolkit.realSync();
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
// Test 1. Show a modal blocked frame, check that it doesn't steal focus.
|
// Test 1. Show a modal blocked frame, check that it doesn't steal focus.
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ import java.awt.*;
|
|||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
import test.java.awt.regtesthelpers.Util;
|
import test.java.awt.regtesthelpers.Util;
|
||||||
|
|
||||||
public class WindowInitialFocusTest extends Applet {
|
public class WindowInitialFocusTest extends Applet {
|
||||||
@ -41,7 +40,7 @@ public class WindowInitialFocusTest extends Applet {
|
|||||||
Window window = new Window(frame);
|
Window window = new Window(frame);
|
||||||
Button button = new Button("button");
|
Button button = new Button("button");
|
||||||
AtomicBoolean focused = new AtomicBoolean(false);
|
AtomicBoolean focused = new AtomicBoolean(false);
|
||||||
SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
|
Robot robot;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
WindowInitialFocusTest app = new WindowInitialFocusTest();
|
WindowInitialFocusTest app = new WindowInitialFocusTest();
|
||||||
@ -75,12 +74,18 @@ public class WindowInitialFocusTest extends Applet {
|
|||||||
}});
|
}});
|
||||||
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
toolkit.realSync();
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
// Test 1. Show the window, check that it become focused.
|
// Test 1. Show the window, check that it become focused.
|
||||||
|
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (!Util.waitForCondition(focused, 2000L)) {
|
if (!Util.waitForCondition(focused, 2000L)) {
|
||||||
throw new TestFailedException("the window didn't get focused on its showing!");
|
throw new TestFailedException("the window didn't get focused on its showing!");
|
||||||
@ -89,13 +94,13 @@ public class WindowInitialFocusTest extends Applet {
|
|||||||
// Test 2. Show unfocusable window, check that it doesn't become focused.
|
// Test 2. Show unfocusable window, check that it doesn't become focused.
|
||||||
|
|
||||||
window.setVisible(false);
|
window.setVisible(false);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
window.setFocusableWindowState(false);
|
window.setFocusableWindowState(false);
|
||||||
focused.set(false);
|
focused.set(false);
|
||||||
|
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (Util.waitForCondition(focused, 2000L)) {
|
if (Util.waitForCondition(focused, 2000L)) {
|
||||||
throw new TestFailedException("the unfocusable window got focused on its showing!");
|
throw new TestFailedException("the unfocusable window got focused on its showing!");
|
||||||
|
@ -30,11 +30,8 @@
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class ExceptionOnSetExtendedStateTest {
|
public class ExceptionOnSetExtendedStateTest {
|
||||||
private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
|
private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
|
||||||
private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
|
|
||||||
|
|
||||||
private static boolean validatePlatform() {
|
private static boolean validatePlatform() {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
@ -53,7 +50,13 @@ public class ExceptionOnSetExtendedStateTest {
|
|||||||
frame.setSize(200, 200);
|
frame.setSize(200, 200);
|
||||||
frame.setUndecorated(!decoratedFrame);
|
frame.setUndecorated(!decoratedFrame);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
toolkit.realSync();
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
frame.setExtendedState(oldState);
|
frame.setExtendedState(oldState);
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
|
@ -77,7 +77,13 @@ public class TestFrameSize {
|
|||||||
|
|
||||||
mainWindow.setVisible(true);
|
mainWindow.setVisible(true);
|
||||||
|
|
||||||
((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure.");
|
||||||
|
}
|
||||||
|
|
||||||
Dimension clientSize2 = getClientSize(mainWindow);
|
Dimension clientSize2 = getClientSize(mainWindow);
|
||||||
System.out.println("Client size after showing: " + clientSize2);
|
System.out.println("Client size after showing: " + clientSize2);
|
||||||
|
@ -25,11 +25,12 @@
|
|||||||
* @bug 8026143
|
* @bug 8026143
|
||||||
* @summary [macosx] Maximized state could be inconsistent between peer and frame
|
* @summary [macosx] Maximized state could be inconsistent between peer and frame
|
||||||
* @author Petr Pchelko
|
* @author Petr Pchelko
|
||||||
|
* @library ../../../../lib/testlibrary
|
||||||
|
* @build jdk.testlibrary.OSInfo
|
||||||
* @run main MaximizedByPlatform
|
* @run main MaximizedByPlatform
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.OSInfo;
|
import jdk.testlibrary.OSInfo;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
@ -43,6 +44,13 @@ public class MaximizedByPlatform {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
availableScreenBounds = getAvailableScreenBounds();
|
availableScreenBounds = getAvailableScreenBounds();
|
||||||
|
|
||||||
// Test 1. The maximized state is set in setBounds
|
// Test 1. The maximized state is set in setBounds
|
||||||
@ -51,12 +59,12 @@ public class MaximizedByPlatform {
|
|||||||
frame.setBounds(100, 100, 100, 100);
|
frame.setBounds(100, 100, 100, 100);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
|
frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
|
||||||
availableScreenBounds.width, availableScreenBounds.height);
|
availableScreenBounds.width, availableScreenBounds.height);
|
||||||
|
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
|
if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
|
||||||
throw new RuntimeException("Maximized state was not set for frame in setBounds");
|
throw new RuntimeException("Maximized state was not set for frame in setBounds");
|
||||||
@ -73,7 +81,7 @@ public class MaximizedByPlatform {
|
|||||||
availableScreenBounds.width + 100, availableScreenBounds.height);
|
availableScreenBounds.width + 100, availableScreenBounds.height);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
|
if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
|
||||||
throw new RuntimeException("Maximized state was not set for frame in setVisible");
|
throw new RuntimeException("Maximized state was not set for frame in setVisible");
|
||||||
|
@ -28,7 +28,7 @@ import java.awt.GraphicsEnvironment;
|
|||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import sun.awt.SunToolkit;
|
import java.awt.Robot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
@ -65,7 +65,8 @@ public class MaximizedToMaximized {
|
|||||||
|
|
||||||
Rectangle frameBounds = frame.getBounds();
|
Rectangle frameBounds = frame.getBounds();
|
||||||
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
|
||||||
((SunToolkit) toolkit).realSync();
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
Rectangle maximizedFrameBounds = frame.getBounds();
|
Rectangle maximizedFrameBounds = frame.getBounds();
|
||||||
if (maximizedFrameBounds.width < frameBounds.width
|
if (maximizedFrameBounds.width < frameBounds.width
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@ -62,8 +60,9 @@ public class SlideNotResizableTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sync() throws InterruptedException {
|
private static void sync() throws Exception {
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,17 @@ import java.awt.geom.*;
|
|||||||
|
|
||||||
import static java.awt.GraphicsDevice.WindowTranslucency.*;
|
import static java.awt.GraphicsDevice.WindowTranslucency.*;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class TranslucentWindow {
|
public class TranslucentWindow {
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
GraphicsDevice gd = ge.getDefaultScreenDevice();
|
GraphicsDevice gd = ge.getDefaultScreenDevice();
|
||||||
|
|
||||||
@ -47,10 +54,10 @@ public class TranslucentWindow {
|
|||||||
|
|
||||||
// First, check it can be made fullscreen window without any effects applied
|
// First, check it can be made fullscreen window without any effects applied
|
||||||
gd.setFullScreenWindow(f);
|
gd.setFullScreenWindow(f);
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
gd.setFullScreenWindow(null);
|
gd.setFullScreenWindow(null);
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
// Second, check if it applying any effects doesn't prevent the window
|
// Second, check if it applying any effects doesn't prevent the window
|
||||||
// from going into the fullscreen mode
|
// from going into the fullscreen mode
|
||||||
@ -64,7 +71,7 @@ public class TranslucentWindow {
|
|||||||
f.setBackground(new Color(0, 0, 0, 128));
|
f.setBackground(new Color(0, 0, 0, 128));
|
||||||
}
|
}
|
||||||
gd.setFullScreenWindow(f);
|
gd.setFullScreenWindow(f);
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
// Third, make sure all the effects are unset when entering the fullscreen mode
|
// Third, make sure all the effects are unset when entering the fullscreen mode
|
||||||
if (f.getShape() != null) {
|
if (f.getShape() != null) {
|
||||||
|
@ -27,16 +27,17 @@ import java.awt.DisplayMode;
|
|||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.GraphicsDevice;
|
import java.awt.GraphicsDevice;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.Toolkit;
|
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8019587
|
* @bug 8019587
|
||||||
* @author Sergey Bylokhov
|
* @author Sergey Bylokhov
|
||||||
|
* @library ../../../lib/testlibrary/
|
||||||
|
* @build ExtendedRobot
|
||||||
|
* @run main IncorrectDisplayModeExitFullscreen
|
||||||
*/
|
*/
|
||||||
public class IncorrectDisplayModeExitFullscreen {
|
public class IncorrectDisplayModeExitFullscreen {
|
||||||
|
static ExtendedRobot robot;
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
|
|
||||||
@ -64,6 +65,13 @@ public class IncorrectDisplayModeExitFullscreen {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
robot = new ExtendedRobot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
final Frame frame = new Frame();
|
final Frame frame = new Frame();
|
||||||
frame.setBackground(Color.GREEN);
|
frame.setBackground(Color.GREEN);
|
||||||
frame.setUndecorated(true);
|
frame.setUndecorated(true);
|
||||||
@ -85,10 +93,6 @@ public class IncorrectDisplayModeExitFullscreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle(1500);
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,14 @@ public class GridBagLayoutIpadXYTest extends Applet
|
|||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
Dimension minSize = jtf.getMinimumSize();
|
Dimension minSize = jtf.getMinimumSize();
|
||||||
if ( minSize.width + customIpadx != jtf.getSize().width ||
|
if ( minSize.width + customIpadx != jtf.getSize().width ||
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.HeadlessException;
|
import java.awt.HeadlessException;
|
||||||
import java.awt.List;
|
import java.awt.List;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
@ -57,9 +55,11 @@ public final class R2303044ListSelection {
|
|||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
try {
|
try {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (final InterruptedException ignored) {
|
} catch (final Exception ignored) {
|
||||||
|
ignored.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class SingleModeDeselect
|
public class SingleModeDeselect
|
||||||
{
|
{
|
||||||
@ -50,7 +49,13 @@ public class SingleModeDeselect
|
|||||||
list.select(0);
|
list.select(0);
|
||||||
list.deselect(1);
|
list.deselect(1);
|
||||||
|
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
if (list.getSelectedIndex() != 0){
|
if (list.getSelectedIndex() != 0){
|
||||||
throw new RuntimeException("Test failed: List.getSelectedIndex() returns "+list.getSelectedIndex());
|
throw new RuntimeException("Test failed: List.getSelectedIndex() returns "+list.getSelectedIndex());
|
||||||
|
@ -22,18 +22,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 7090424
|
* @bug 7090424
|
||||||
* @author Sergey Bylokhov
|
* @author Sergey Bylokhov
|
||||||
|
* @library ../../../lib/testlibrary/
|
||||||
|
* @build ExtendedRobot
|
||||||
* @run main ExposeOnEDT
|
* @run main ExposeOnEDT
|
||||||
*/
|
*/
|
||||||
public final class ExposeOnEDT {
|
public final class ExposeOnEDT {
|
||||||
|
|
||||||
|
private static ExtendedRobot robot = null;
|
||||||
private static final Button buttonStub = new Button() {
|
private static final Button buttonStub = new Button() {
|
||||||
@Override
|
@Override
|
||||||
public void paint(final Graphics g) {
|
public void paint(final Graphics g) {
|
||||||
@ -275,11 +276,15 @@ public final class ExposeOnEDT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
if(robot == null) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000L);
|
robot = new ExtendedRobot();
|
||||||
} catch (InterruptedException ignored) {
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
robot.waitForIdle(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fail(final String message) {
|
private static void fail(final String message) {
|
||||||
|
@ -26,12 +26,13 @@ import java.awt.Frame;
|
|||||||
import java.awt.ScrollPane;
|
import java.awt.ScrollPane;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 7124213
|
* @bug 7124213
|
||||||
* @author Sergey Bylokhov
|
* @author Sergey Bylokhov
|
||||||
|
* @library ../../../../lib/testlibrary/
|
||||||
|
* @build ExtendedRobot
|
||||||
|
* @run main ScrollPanePreferredSize
|
||||||
*/
|
*/
|
||||||
public final class ScrollPanePreferredSize {
|
public final class ScrollPanePreferredSize {
|
||||||
|
|
||||||
@ -54,10 +55,12 @@ public final class ScrollPanePreferredSize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500L);
|
ExtendedRobot robot = new ExtendedRobot();
|
||||||
} catch (InterruptedException ignored) {
|
robot.waitForIdle(500);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,12 @@
|
|||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.TextArea;
|
import java.awt.TextArea;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class TestDispose {
|
public class TestDispose {
|
||||||
|
|
||||||
public static Frame frame = null;
|
public static Frame frame = null;
|
||||||
@ -51,7 +49,14 @@ public class TestDispose {
|
|||||||
|
|
||||||
public void testDispose() throws InvocationTargetException,
|
public void testDispose() throws InvocationTargetException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -69,7 +74,7 @@ public class TestDispose {
|
|||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -77,7 +82,7 @@ public class TestDispose {
|
|||||||
frame.dispose();
|
frame.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception{
|
public static void main(String[] args) throws Exception{
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.TextArea;
|
import java.awt.TextArea;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@ -42,7 +42,6 @@ import javax.swing.JTextArea;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.text.DefaultCaret;
|
import javax.swing.text.DefaultCaret;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class bug7129742 {
|
public class bug7129742 {
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ public class bug7129742 {
|
|||||||
public static boolean fastreturn = false;
|
public static boolean fastreturn = false;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
Robot robot = new Robot();
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -88,7 +87,7 @@ public class bug7129742 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,9 +24,8 @@
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.TextArea;
|
import java.awt.TextArea;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
@ -55,10 +54,12 @@ public final class TextAreaTwicePack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
|
||||||
try {
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
Thread.sleep(500L);
|
Thread.sleep(500L);
|
||||||
} catch (InterruptedException ignored) {
|
} catch (Exception ignored) {
|
||||||
|
ignored.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,12 @@
|
|||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.TextField;
|
import java.awt.TextField;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class TestDispose {
|
public class TestDispose {
|
||||||
|
|
||||||
public static Frame frame = null;
|
public static Frame frame = null;
|
||||||
@ -51,7 +49,13 @@ public class TestDispose {
|
|||||||
|
|
||||||
public void testDispose() throws InvocationTargetException,
|
public void testDispose() throws InvocationTargetException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -69,7 +73,7 @@ public class TestDispose {
|
|||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -77,7 +81,7 @@ public class TestDispose {
|
|||||||
frame.dispose();
|
frame.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,13 @@
|
|||||||
@bug 8007220
|
@bug 8007220
|
||||||
@summary Reference to the popup leaks after the TrayIcon is removed
|
@summary Reference to the popup leaks after the TrayIcon is removed
|
||||||
@author Petr Pchelko
|
@author Petr Pchelko
|
||||||
|
@library ../../../../lib/testlibrary/
|
||||||
|
@build ExtendedRobot
|
||||||
@run main/othervm -Xmx50m PopupMenuLeakTest
|
@run main/othervm -Xmx50m PopupMenuLeakTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@ -42,8 +43,10 @@ public class PopupMenuLeakTest {
|
|||||||
|
|
||||||
static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
|
static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
|
||||||
static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
|
static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
|
||||||
|
static ExtendedRobot robot;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
robot = new ExtendedRobot();
|
||||||
SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
|
SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
|
||||||
sleep();
|
sleep();
|
||||||
// To make the test automatic we explicitly call addNotify on a popup to create the peer
|
// To make the test automatic we explicitly call addNotify on a popup to create the peer
|
||||||
@ -141,9 +144,6 @@ public class PopupMenuLeakTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sleep() {
|
private static void sleep() {
|
||||||
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle(100);
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException ignored) { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
* @run main Test8027025
|
* @run main Test8027025
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@ -49,7 +47,8 @@ public class Test8027025 {
|
|||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
AtomicReference<Point> point = new AtomicReference<>();
|
AtomicReference<Point> point = new AtomicReference<>();
|
||||||
SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
|
SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
|
||||||
|
@ -22,9 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
import java.awt.Dialog;
|
import java.awt.Dialog;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Robot;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 7081594
|
* @bug 7081594
|
||||||
@ -35,19 +34,25 @@ import sun.awt.SunToolkit;
|
|||||||
public class AlwaysOnTopFieldTest {
|
public class AlwaysOnTopFieldTest {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
Window window = new Frame("Window 1");
|
Window window = new Frame("Window 1");
|
||||||
window.setSize(200, 200);
|
window.setSize(200, 200);
|
||||||
window.setAlwaysOnTop(true);
|
window.setAlwaysOnTop(true);
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
Dialog dialog = new Dialog(window, "Owned dialog 1");
|
Dialog dialog = new Dialog(window, "Owned dialog 1");
|
||||||
dialog.setSize(200, 200);
|
dialog.setSize(200, 200);
|
||||||
dialog.setLocation(100, 100);
|
dialog.setLocation(100, 100);
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!window.isAlwaysOnTop()) {
|
if (!window.isAlwaysOnTop()) {
|
||||||
@ -64,17 +69,17 @@ public class AlwaysOnTopFieldTest {
|
|||||||
window = new Frame("Window 2");
|
window = new Frame("Window 2");
|
||||||
window.setSize(200, 200);
|
window.setSize(200, 200);
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
|
|
||||||
dialog = new Dialog(window, "Owned dialog 2");
|
dialog = new Dialog(window, "Owned dialog 2");
|
||||||
dialog.setSize(200, 200);
|
dialog.setSize(200, 200);
|
||||||
dialog.setLocation(100, 100);
|
dialog.setLocation(100, 100);
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
window.setAlwaysOnTop(true);
|
window.setAlwaysOnTop(true);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!window.isAlwaysOnTop()) {
|
if (!window.isAlwaysOnTop()) {
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -54,7 +52,8 @@ public class OwnedWindowsSerialization {
|
|||||||
subDialog = new Dialog(dialog, SUBDIALOG_LABEL);
|
subDialog = new Dialog(dialog, SUBDIALOG_LABEL);
|
||||||
});
|
});
|
||||||
|
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
Robot robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
|
||||||
if (!topFrame.isAlwaysOnTop() || !dialog.isAlwaysOnTop() || !subDialog.isAlwaysOnTop()) {
|
if (!topFrame.isAlwaysOnTop() || !dialog.isAlwaysOnTop() || !subDialog.isAlwaysOnTop()) {
|
||||||
throw new RuntimeException("TEST FAILED: AlwaysOnTop was not set properly");
|
throw new RuntimeException("TEST FAILED: AlwaysOnTop was not set properly");
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
public class TextEventSequenceTest {
|
public class TextEventSequenceTest {
|
||||||
|
|
||||||
@ -48,43 +47,50 @@ public class TextEventSequenceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void test(String test) {
|
private static void test(String test) {
|
||||||
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
|
|
||||||
|
Robot robot;
|
||||||
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Unexpected failure");
|
||||||
|
}
|
||||||
|
|
||||||
createAndShowGUI(test);
|
createAndShowGUI(test);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
|
|
||||||
initCounts();
|
initCounts();
|
||||||
t.setText("Hello ");
|
t.setText("Hello ");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
t.append("World! !");
|
t.append("World! !");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
t.insert("from Roger Pham", 13);
|
t.insert("from Roger Pham", 13);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
t.replaceRange("Java Duke", 18, 28);
|
t.replaceRange("Java Duke", 18, 28);
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
checkCounts(0, 4);
|
checkCounts(0, 4);
|
||||||
|
|
||||||
initCounts();
|
initCounts();
|
||||||
t.setText("");
|
t.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
t.setText("");
|
t.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
t.setText("");
|
t.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
checkCounts(1, 0);
|
checkCounts(1, 0);
|
||||||
|
|
||||||
initCounts();
|
initCounts();
|
||||||
tf.setText("Hello There!");
|
tf.setText("Hello There!");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
checkCounts(0, 1);
|
checkCounts(0, 1);
|
||||||
|
|
||||||
initCounts();
|
initCounts();
|
||||||
tf.setText("");
|
tf.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
tf.setText("");
|
tf.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
tf.setText("");
|
tf.setText("");
|
||||||
toolkit.realSync();
|
robot.waitForIdle();
|
||||||
checkCounts(1, 0);
|
checkCounts(1, 0);
|
||||||
|
|
||||||
f.dispose();
|
f.dispose();
|
||||||
|
@ -26,26 +26,25 @@
|
|||||||
@bug 8041490
|
@bug 8041490
|
||||||
@summary tests that the WarningWindow's surface is invalidated on dispose
|
@summary tests that the WarningWindow's surface is invalidated on dispose
|
||||||
@author Petr Pchelko
|
@author Petr Pchelko
|
||||||
@run main/othervm WarningWindowDisposeCrashTest
|
@run main/othervm/policy=policy -Djava.security.manager WarningWindowDisposeCrashTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import sun.applet.AppletSecurity;
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class WarningWindowDisposeCrashTest {
|
public class WarningWindowDisposeCrashTest {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.setSecurityManager(new AppletSecurity() {
|
|
||||||
@Override
|
|
||||||
public void checkPackageAccess (String s){
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Frame f = new Frame();
|
Frame f = new Frame();
|
||||||
f.setVisible(true);
|
f.setVisible(true);
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
Robot robot;
|
||||||
|
try{
|
||||||
|
robot = new Robot();
|
||||||
|
robot.waitForIdle();
|
||||||
|
}catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Cannot create Robot");
|
||||||
|
}
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
f.dispose();
|
f.dispose();
|
||||||
// If the bug is present VM could crash after this call
|
// If the bug is present VM could crash after this call
|
||||||
|
@ -31,12 +31,11 @@
|
|||||||
@run main WarningWindowDisposeTest
|
@run main WarningWindowDisposeTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.applet.AppletSecurity;
|
|
||||||
import sun.awt.SunToolkit;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.security.Permission;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import test.java.awt.regtesthelpers.process.ProcessCommunicator;
|
import test.java.awt.regtesthelpers.process.ProcessCommunicator;
|
||||||
import test.java.awt.regtesthelpers.process.ProcessResults;
|
import test.java.awt.regtesthelpers.process.ProcessResults;
|
||||||
@ -57,7 +56,9 @@ public class WarningWindowDisposeTest {
|
|||||||
}, "TimeoutThread").start();
|
}, "TimeoutThread").start();
|
||||||
|
|
||||||
String classpath = System.getProperty("java.class.path");
|
String classpath = System.getProperty("java.class.path");
|
||||||
ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath, new String[0]);
|
String policyPath = System.getProperty("test.src")+File.separatorChar+"policy";
|
||||||
|
System.out.println("policyPath in main: "+policyPath);
|
||||||
|
ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath+" -Djava.security.manager -Djava.security.policy="+policyPath, new String[0]);
|
||||||
passed.set(true);
|
passed.set(true);
|
||||||
if (pres.getStdErr() != null && pres.getStdErr().length() > 0) {
|
if (pres.getStdErr() != null && pres.getStdErr().length() > 0) {
|
||||||
System.err.println("========= Child VM System.err ========");
|
System.err.println("========= Child VM System.err ========");
|
||||||
@ -74,14 +75,16 @@ public class WarningWindowDisposeTest {
|
|||||||
|
|
||||||
public static class TestApplication {
|
public static class TestApplication {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.setSecurityManager(new AppletSecurity() {
|
Robot robot;
|
||||||
@Override
|
try{
|
||||||
public void checkPackageAccess (String s){
|
robot = new Robot();
|
||||||
}
|
}catch(Exception ex) {
|
||||||
});
|
ex.printStackTrace();
|
||||||
|
throw new RuntimeException("Cannot create Robot");
|
||||||
|
}
|
||||||
Frame f = new Frame("Test frame");
|
Frame f = new Frame("Test frame");
|
||||||
f.setVisible(true);
|
f.setVisible(true);
|
||||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
robot.waitForIdle();
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
f.setVisible(false);
|
f.setVisible(false);
|
||||||
f.dispose();
|
f.dispose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user