aboutsummaryrefslogtreecommitdiff
path: root/test/java/awt
diff options
context:
space:
mode:
Diffstat (limited to 'test/java/awt')
-rw-r--r--test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java79
-rw-r--r--test/java/awt/FontClass/DebugFonts.java4
-rw-r--r--test/java/awt/Mixing/HWDisappear.java49
-rw-r--r--test/java/awt/Paint/bug8024864.java6
-rw-r--r--test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java27
-rw-r--r--test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh14
6 files changed, 97 insertions, 82 deletions
diff --git a/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java b/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
index 5512e4febb..6131070e71 100644
--- a/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
+++ b/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
@@ -23,12 +23,13 @@
/*
@test
- @bug 6562853
- @summary Tests that focus transfered directy to window w/o transfering it to frame.
- @author Oleg Sukhodolsky: area=awt.focus
- @library ../../regtesthelpers
- @build Util
- @run main TranserFocusToWindow
+ @key headful
+ @bug 6562853 7035459
+ @summary Tests that focus transfered directy to window w/o transfering it to frame.
+ @author Oleg Sukhodolsky: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main TranserFocusToWindow
*/
import java.awt.Button;
@@ -44,10 +45,13 @@ import test.java.awt.regtesthelpers.Util;
public class TranserFocusToWindow
{
+ private static final int WIDTH = 300;
+ private static final int HEIGHT = 200;
+
public static void main(String[] args) {
Robot robot = Util.createRobot();
Frame owner_frame = new Frame("Owner frame");
- owner_frame.setBounds(0, 0, 200, 200);
+ owner_frame.setBounds(0, 0, WIDTH, HEIGHT);
owner_frame.setVisible(true);
Util.waitForIdle(robot);
@@ -55,7 +59,7 @@ public class TranserFocusToWindow
Button btn1 = new Button("button for focus");
window.add(btn1);
window.pack();
- window.setLocation(0, 300);
+ window.setLocation(0, HEIGHT + 100);
window.setVisible(true);
Util.waitForIdle(robot);
@@ -63,43 +67,40 @@ public class TranserFocusToWindow
Button btn2 = new Button("button in a frame");
another_frame.add(btn2);
another_frame.pack();
- another_frame.setLocation(300, 0);
+ another_frame.setLocation(WIDTH + 100, 0);
another_frame.setVisible(true);
Util.waitForIdle(robot);
- Util.clickOnTitle(owner_frame, robot);
- Util.waitForIdle(robot);
-
- setFocus(btn1, robot);
-
- setFocus(btn2, robot);
-
owner_frame.addWindowFocusListener(new WindowFocusListener() {
- public void windowLostFocus(WindowEvent we) {
- System.out.println(we);
- }
- public void windowGainedFocus(WindowEvent we) {
- System.out.println(we);
- throw new RuntimeException("owner frame must not receive WINDWO_GAINED_FOCUS");
- }
- });
+ public void windowLostFocus(WindowEvent we) {
+ System.out.println(we);
+ }
+ public void windowGainedFocus(WindowEvent we) {
+ System.out.println(we);
+ throw new RuntimeException("owner frame must not receive WINDWO_GAINED_FOCUS");
+ }
+ });
window.addWindowFocusListener(new WindowFocusListener() {
- public void windowLostFocus(WindowEvent we) {
- System.out.println(we);
- }
- public void windowGainedFocus(WindowEvent we) {
- System.out.println(we);
- }
- });
+ public void windowLostFocus(WindowEvent we) {
+ System.out.println(we);
+ }
+ public void windowGainedFocus(WindowEvent we) {
+ System.out.println(we);
+ }
+ });
another_frame.addWindowFocusListener(new WindowFocusListener() {
- public void windowLostFocus(WindowEvent we) {
- System.out.println(we);
- }
- public void windowGainedFocus(WindowEvent we) {
- System.out.println(we);
- }
- });
+ public void windowLostFocus(WindowEvent we) {
+ System.out.println(we);
+ }
+ public void windowGainedFocus(WindowEvent we) {
+ System.out.println(we);
+ }
+ });
+ Util.clickOnTitle(owner_frame, robot);
+ Util.waitForIdle(robot);
+ setFocus(btn1, robot);
+ setFocus(btn2, robot);
// we need this delay so WM can not treat two clicks on title as double click
robot.delay(500);
Util.clickOnTitle(owner_frame, robot);
@@ -120,4 +121,4 @@ public class TranserFocusToWindow
throw new RuntimeException("can not set focus on " + comp);
}
}
-}
+} \ No newline at end of file
diff --git a/test/java/awt/FontClass/DebugFonts.java b/test/java/awt/FontClass/DebugFonts.java
index ce0eb4bb35..8a040f950c 100644
--- a/test/java/awt/FontClass/DebugFonts.java
+++ b/test/java/awt/FontClass/DebugFonts.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4956241 80769790
+ * @bug 4956241 8076979 8080953
* @summary NPE debugging fonts
* @run main/othervm DebugFonts
*/
@@ -39,4 +39,4 @@ public class DebugFonts {
String s1 = font.getFamily();
String s2 = font.getFontName();
}
-}
+} \ No newline at end of file
diff --git a/test/java/awt/Mixing/HWDisappear.java b/test/java/awt/Mixing/HWDisappear.java
index f43e4c26e1..c4818b2d97 100644
--- a/test/java/awt/Mixing/HWDisappear.java
+++ b/test/java/awt/Mixing/HWDisappear.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, 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
@@ -23,6 +23,7 @@
/*
@test %W% %E%
+ @key headful
@bug 6769511
@summary AWT components are invisible for a while after frame is moved & menu items are visible
@author anthony.petrov@...: area=awt.mixing
@@ -40,6 +41,7 @@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
import test.java.awt.regtesthelpers.Util;
public class HWDisappear
@@ -52,11 +54,11 @@ public class HWDisappear
//*** Create instructions for the user here ***
String[] instructions =
- {
- "This is an AUTOMATIC test, simply wait until it is done.",
- "The result (passed or failed) will be shown in the",
- "message window below."
- };
+ {
+ "This is an AUTOMATIC test, simply wait until it is done.",
+ "The result (passed or failed) will be shown in the",
+ "message window below."
+ };
Sysout.createDialog( );
Sysout.printInstructions( instructions );
@@ -109,7 +111,7 @@ public class HWDisappear
// Click on the button.
Point bLoc = b.getLocationOnScreen();
- robot.mouseMove(bLoc.x + b.getWidth() / 2, bLoc.y + 5);
+ robot.mouseMove(bLoc.x + b.getWidth() / 2, bLoc.y + b.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
@@ -148,8 +150,9 @@ public class HWDisappear
// instantiated in the same VM. Being static (and using
// static vars), it aint gonna work. Not worrying about
// it for now.
- public static void main( String args[] ) throws InterruptedException
+ public static void main( String args[] ) throws Exception
{
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
mainThread = Thread.currentThread();
try
{
@@ -290,21 +293,21 @@ class NewClass implements anInterface
/****************************************************
Standard Test Machinery
DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
****************************************************/
/**
This is part of the standard test machinery.
It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
+ for sending text messages to the user.
To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
+ WithInstructions method. Put one line of instructions per array entry.
To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
+ with the string to be displayed.
This mimics System.out.println but works within the test harness as well
- as standalone.
+ as standalone.
*/
class Sysout
@@ -344,13 +347,13 @@ class Sysout
}// Sysout class
/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
class TestDialog extends Dialog
{
@@ -394,7 +397,7 @@ class TestDialog extends Dialog
{
//Try to chop on a word boundary
int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
+ lastIndexOf( ' ', maxStringLength - 1 );
if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
diff --git a/test/java/awt/Paint/bug8024864.java b/test/java/awt/Paint/bug8024864.java
index 42580a4c94..e24a071984 100644
--- a/test/java/awt/Paint/bug8024864.java
+++ b/test/java/awt/Paint/bug8024864.java
@@ -21,7 +21,9 @@
* questions.
*/
-/* @test
+/*
+ * @test
+ * @key headful
* @bug 8024864 8031422
* @summary [macosx] Problems with rendering of controls
* @author Petr Pchelko
@@ -81,4 +83,4 @@ public class bug8024864
}
}
}
-}
+} \ No newline at end of file
diff --git a/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java b/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
index b5e019ec77..bceb939b68 100644
--- a/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
+++ b/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2017, 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
@@ -21,9 +21,8 @@
* questions.
*/
-import sun.awt.OSInfo;
-
-import java.awt.*;
+import java.awt.Point;
+import java.awt.Window;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.lang.InterruptedException;
@@ -31,13 +30,19 @@ import java.lang.System;
import java.lang.Thread;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import javax.swing.*;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
/*
* @test
* @bug 8024185
* @summary Native Mac OS X full screen does not work after showing the splash
+ * @requires (os.family == "mac")
* @library ../
+ * @library ../../../../lib/testlibrary
+ * @modules java.desktop/sun.awt
+ * java.desktop/com.apple.eawt
* @build GenerateTestImage
* @run main GenerateTestImage
* @author Petr Pchelko area=awt.event
@@ -52,13 +57,10 @@ public class FullScreenAfterSplash {
public static void main(String[] args) throws Exception {
- if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
- System.out.println("The test is applicable only to Mac OS X. Passed");
- return;
- }
try {
//Move the mouse out, because it could interfere with the test.
Robot r = new Robot();
+ r.setAutoDelay(50);
r.mouseMove(0, 0);
sleep();
@@ -66,7 +68,10 @@ public class FullScreenAfterSplash {
sleep();
Point fullScreenButtonPos = frame.getLocation();
- fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
+ if(System.getProperty("os.version").equals("10.9"))
+ fullScreenButtonPos.translate(frame.getWidth() - 10, frame.getHeight()/2);
+ else
+ fullScreenButtonPos.translate(55,frame.getHeight()/2);
r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);
//Cant use waitForIdle for full screen transition.
@@ -137,4 +142,4 @@ public class FullScreenAfterSplash {
Thread.sleep(500);
} catch (InterruptedException ignored) { }
}
-}
+} \ No newline at end of file
diff --git a/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh b/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh
index 290029e95a..d77a34d713 100644
--- a/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh
+++ b/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2017, 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
@@ -24,9 +24,11 @@
#!/bin/ksh -p
#
# @test IOExceptionIfEncodedURLTest.sh
-# @bug 6193279 6619458
+# @bug 6193279 6619458 8137087
# @summary REGRESSION: AppletViewer throws IOException when path is encoded URL
# @author Dmitry Cherepanov: area=appletviewer
+# @modules java.base/sun.net.www
+# java.desktop
# @run compile IOExceptionIfEncodedURLTest.java
# @run main IOExceptionIfEncodedURLTest
# @run shell IOExceptionIfEncodedURLTest.sh
@@ -54,7 +56,7 @@ pass()
#Call this to run the test with a file name
test()
{
- ${TESTJAVA}${FILESEP}bin${FILESEP}appletviewer -Xnosecurity ${URL} > err 2>&1 &
+ "${TESTJAVA}"${FILESEP}bin${FILESEP}appletviewer -Xnosecurity ${URL} > err 2>&1 &
APPLET_ID=$!
sleep 15
kill -9 $APPLET_ID
@@ -132,7 +134,9 @@ case "$OS" in
DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0"
FILESEP="/"
PATHSEP=";"
- TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}`
+ TMP=`cd "${SYSTEMROOT}/Temp"; echo ${PWD}`
+ x="cygpath -m $PWD"
+ PWD=$(eval $x)
;;
AIX )
@@ -256,4 +260,4 @@ URL="file:"${UNENCODED}
test
# pick up our toys from the scratch directory
-rm ${UNENCODED}
+rm ${UNENCODED} \ No newline at end of file