/hg/icedtea6: patches/icedtea-6616792-fix.patch: fixed AWT focus...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon May 3 09:36:56 PDT 2010
changeset 26b11cdd7394 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=26b11cdd7394
author: ptisnovs
date: Mon May 03 18:36:41 2010 +0200
patches/icedtea-6616792-fix.patch: fixed AWT focus regression tests
diffstat:
3 files changed, 1124 insertions(+), 1 deletion(-)
ChangeLog | 5
Makefile.am | 3
patches/icedtea-6616792-fix.patch | 1117 +++++++++++++++++++++++++++++++++++++
diffs (truncated from 1146 to 500 lines):
diff -r d1be9b22e65a -r 26b11cdd7394 ChangeLog
--- a/ChangeLog Fri Apr 30 10:24:39 2010 +0100
+++ b/ChangeLog Mon May 03 18:36:41 2010 +0200
@@ -1,3 +1,8 @@ 2010-04-30 Gary Benson <gbenson at redhat
+2010-05-03 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * patches/icedtea-6616792-fix.patch:
+ fixed AWT focus regression tests
+
2010-04-30 Gary Benson <gbenson at redhat.com>
PR icedtea/324
diff -r d1be9b22e65a -r 26b11cdd7394 Makefile.am
--- a/Makefile.am Fri Apr 30 10:24:39 2010 +0100
+++ b/Makefile.am Mon May 03 18:36:41 2010 +0200
@@ -300,7 +300,8 @@ ICEDTEA_PATCHES = \
patches/extensions/netx-dist.patch \
patches/extensions/netx-umask.patch \
patches/icedtea-jtreg-httpTest.patch \
- patches/nss-debug.patch
+ patches/nss-debug.patch \
+ patches/icedtea-6616792-fix.patch
if WITH_ALT_HSBUILD
ICEDTEA_PATCHES += \
diff -r d1be9b22e65a -r 26b11cdd7394 patches/icedtea-6616792-fix.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6616792-fix.patch Mon May 03 18:36:41 2010 +0200
@@ -0,0 +1,1117 @@
+--- openjdk.orig/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 2010-04-15 09:35:54.000000000 +0200
++++ openjdk/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java 2010-05-03 11:34:34.000000000 +0200
+@@ -25,8 +25,10 @@
+ @test
+ @bug 6314575
+ @summary Tests that previosly focused owned window doesn't steal focus when an owner's component requests focus.
+- @author Anton Tarasov: area=awt-focus
+- @run applet ActualFocusedWindowBlockingTest.html
++ @author Anton.Tarasov: area=awt.focus
++ @library ../../regtesthelpers
++ @build Util
++ @run main ActualFocusedWindowBlockingTest
+ */
+
+ import java.awt.*;
+@@ -35,9 +37,10 @@
+ import java.util.concurrent.atomic.AtomicBoolean;
+ import java.lang.reflect.InvocationTargetException;
+ import sun.awt.SunToolkit;
++import test.java.awt.regtesthelpers.Util;
+
+ public class ActualFocusedWindowBlockingTest extends Applet {
+- Robot robot;
++ Robot robot = Util.createRobot();
+ Frame owner = new Frame("Owner Frame");
+ Window win = new Window(owner);
+ Frame frame = new Frame("Auxiliary Frame");
+@@ -52,28 +55,12 @@
+ }
+
+ public void init() {
+- // Create instructions for the user here, as well as set up
+- // the environment -- set the layout manager, add buttons,
+- // etc.
+- this.setLayout (new BorderLayout ());
+- Sysout.createDialogWithInstructions(new String[]
+- {"Automatic test. Simply wait until it's done."});
+-
+- if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+- return;
+- }
+-
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+- Sysout.println("--> " + e);
++ System.out.println("--> " + e);
+ }
+ }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
+
+- try {
+- robot = new Robot();
+- } catch (AWTException e) {
+- throw new RuntimeException("Error: unable to create robot", e);
+- }
+ owner.add(fButton);
+ win.add(wButton);
+ frame.add(aButton);
+@@ -87,19 +74,18 @@
+
+ public void start() {
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+- Sysout.println("No testing on Motif. Test passed.");
++ System.out.println("No testing on Motif. Test passed.");
+ return;
+ }
+
+- Sysout.println("\nTest started:\n");
++ System.out.println("\nTest started:\n");
+
+ // Test 1.
+
+ clickOnCheckFocus(wButton);
+-
+ clickOnCheckFocus(aButton);
+
+- clickOn(fButton);
++ Util.clickOnComp(fButton, robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by click");
+ }
+@@ -107,11 +93,10 @@
+ // Test 2.
+
+ clickOnCheckFocus(wButton);
+-
+ clickOnCheckFocus(aButton);
+
+ fButton.requestFocus();
+- realSync();
++ Util.waitForIdle(robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by request");
+ }
+@@ -119,19 +104,16 @@
+ // Test 3.
+
+ clickOnCheckFocus(wButton);
+-
+ clickOnCheckFocus(aButton);
+-
+ clickOnCheckFocus(fButton);
+-
+ clickOnCheckFocus(aButton);
+
+- clickOn(owner);
++ Util.clickOnTitle(owner, robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused as the most recent focus owner");
+ }
+
+- Sysout.println("Test passed.");
++ System.out.println("Test passed.");
+ }
+
+ void tuneAndShowWindows(Window[] arr) {
+@@ -142,33 +124,18 @@
+ w.setBackground(Color.blue);
+ w.setVisible(true);
+ y += 200;
+- realSync();
++ Util.waitForIdle(robot);
+ }
+ }
+
+- void clickOn(Component c) {
+- Sysout.println("Test: clicking " + c);
+-
+- Point p = c.getLocationOnScreen();
+- Dimension d = c.getSize();
+-
++ void clickOnCheckFocus(Component c) {
+ if (c instanceof Frame) {
+- robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+- Sysout.println((p.x + (int)(d.getWidth()/2)) + " " + (p.y + ((Frame)c).getInsets().top/2));
++ Util.clickOnTitle((Frame)c, robot);
+ } else {
+- robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
++ Util.clickOnComp(c, robot);
+ }
+- robot.mousePress(InputEvent.BUTTON1_MASK);
+- robot.delay(100);
+- robot.mouseRelease(InputEvent.BUTTON1_MASK);
+-
+- realSync();
+- }
+-
+- void clickOnCheckFocus(Component c) {
+- clickOn(c);
+ if (!testFocused(c)) {
+- throw new RuntimeException("Error: [" + c + "] couldn't get focus by click.");
++ throw new TestErrorException(c + "couldn't get focus by click.");
+ }
+ }
+
+@@ -177,157 +144,22 @@
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == c) {
+ return true;
+ }
+- realSync();
++ Util.waitForIdle(robot);
+ }
+ return false;
+ }
+
+- void realSync() {
+- ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+- }
+-
++ // Thrown when the behavior being verified is found wrong.
+ class TestFailedException extends RuntimeException {
+- public TestFailedException(String cause) {
+- super("Test failed. " + cause);
+- Sysout.println(cause);
++ TestFailedException(String msg) {
++ super("Test failed: " + msg);
+ }
+ }
+-}
+-
+-/****************************************************
+- 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.
+- ****************************************************/
+-
+-/**
+- 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.
+- To print the instructions, send an array of strings to Sysout.createDialog
+- 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.
+- This mimics System.out.println but works within the test harness as well
+- as standalone.
+- */
+-
+-class Sysout
+-{
+- static TestDialog dialog;
+-
+- public static void createDialogWithInstructions( String[] instructions )
+- {
+- dialog = new TestDialog( new Frame(), "Instructions" );
+- dialog.printInstructions( instructions );
+- dialog.setLocation(500,0);
+- dialog.setVisible(true);
+- println( "Any messages for the tester will display here." );
+- }
+-
+- public static void createDialog( )
+- {
+- dialog = new TestDialog( new Frame(), "Instructions" );
+- String[] defInstr = { "Instructions will appear here. ", "" } ;
+- dialog.printInstructions( defInstr );
+- dialog.setVisible(true);
+- println( "Any messages for the tester will display here." );
+- }
+-
+-
+- public static void printInstructions( String[] instructions )
+- {
+- dialog.printInstructions( instructions );
+- }
+-
+-
+- public static void println( String messageIn )
+- {
+- dialog.displayMessage( messageIn );
+- }
+-
+-}// 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.
+- */
+-class TestDialog extends Dialog
+-{
+-
+- TextArea instructionsText;
+- TextArea messageText;
+- int maxStringLength = 80;
+-
+- //DO NOT call this directly, go through Sysout
+- public TestDialog( Frame frame, String name )
+- {
+- super( frame, name );
+- int scrollBoth = TextArea.SCROLLBARS_BOTH;
+- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+- add( "North", instructionsText );
+-
+- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+- add("Center", messageText);
+-
+- pack();
+-
+- setVisible(true);
+- }// TestDialog()
+-
+- //DO NOT call this directly, go through Sysout
+- public void printInstructions( String[] instructions )
+- {
+- //Clear out any current instructions
+- instructionsText.setText( "" );
+-
+- //Go down array of instruction strings
+-
+- String printStr, remainingStr;
+- for( int i=0; i < instructions.length; i++ )
+- {
+- //chop up each into pieces maxSringLength long
+- remainingStr = instructions[ i ];
+- while( remainingStr.length() > 0 )
+- {
+- //if longer than max then chop off first max chars to print
+- if( remainingStr.length() >= maxStringLength )
+- {
+- //Try to chop on a word boundary
+- int posOfSpace = remainingStr.
+- lastIndexOf( ' ', maxStringLength - 1 );
+
+- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+-
+- printStr = remainingStr.substring( 0, posOfSpace + 1 );
+- remainingStr = remainingStr.substring( posOfSpace + 1 );
+- }
+- //else just print
+- else
+- {
+- printStr = remainingStr;
+- remainingStr = "";
+- }
+-
+- instructionsText.append( printStr + "\n" );
+-
+- }// while
+-
+- }// for
+-
+- }//printInstructions()
+-
+- //DO NOT call this directly, go through Sysout
+- public void displayMessage( String messageIn )
+- {
+- messageText.append( messageIn + "\n" );
+- System.out.println(messageIn);
++ // Thrown when an error not related to the behavior being verified is encountered.
++ class TestErrorException extends RuntimeException {
++ TestErrorException(String msg) {
++ super("Unexpected error: " + msg);
++ }
+ }
+-
+-}// TestDialog class
++}
+--- openjdk.orig/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java 2010-04-15 09:35:54.000000000 +0200
++++ openjdk/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java 2010-05-03 09:35:54.000000000 +0200
+@@ -23,16 +23,19 @@
+
+ /*
+ @test
+- @bug 4823903
+- @summary Tests actual focused window retaining.
+- @author Anton Tarasov: area=awt.focus
+- @run applet ActualFocusedWindowRetaining.html
++ @bug 4823903
++ @summary Tests actual focused window retaining.
++ @author Anton.Tarasov: area=awt.focus
++ @library ../../regtesthelpers
++ @build Util
++ @run main ActualFocusedWindowRetaining
+ */
+
+ import java.awt.*;
+ import java.awt.event.*;
+ import java.lang.reflect.*;
+ import java.applet.*;
++import test.java.awt.regtesthelpers.Util;
+
+ public class ActualFocusedWindowRetaining extends Applet {
+ public static Frame frame = new Frame("Other Frame");
+@@ -46,7 +49,7 @@
+ public static Window window1 = new TestWindow(owner, otherButton2, testButton2, 800, 200);
+ public static Window window2 = new TestWindow(owner, otherButton3, testButton3, 800, 300);
+ public static int step;
+- public static Robot robot;
++ public static Robot robot = Util.createRobot();
+
+ public static void main(String[] args) {
+ ActualFocusedWindowRetaining a = new ActualFocusedWindowRetaining();
+@@ -54,53 +57,25 @@
+ a.start();
+ }
+
+- public void init()
+- {
+- //Create instructions for the user here, as well as set up
+- // the environment -- set the layout manager, add buttons,
+- // etc.
+- this.setLayout (new BorderLayout ());
+-
+- String[] instructions =
+- {
+- "This is an AUTOMATIC test",
+- "simply wait until it is done"
+- };
+- Sysout.createDialogWithInstructions( instructions );
+- }
+-
+- public void start ()
+- {
+- if (Toolkit.getDefaultToolkit().getClass()
+- .getName().equals("sun.awt.motif.MToolkit")) {
+- Sysout.println("No testing on Motif.");
+- return;
+- }
+-
+- try {
+- robot = new Robot();
+- } catch (AWTException e) {
+- throw new RuntimeException("Error: unable to create robot", e);
+- }
+-
++ public void start () {
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ Object src = e.getSource();
+ Class cls = src.getClass();
+
+ if (cls == TestWindow.class) {
+- Sysout.println(e.paramString() + " on <" + (src == window1 ? "Window 1" : "Window 2") + ">");
++ System.out.println(e.paramString() + " on <" + (src == window1 ? "Window 1" : "Window 2") + ">");
+ } else if (cls == Frame.class) {
+- Sysout.println(e.paramString() + " on <" + ((Frame)src).getTitle() + ">");
++ System.out.println(e.paramString() + " on <" + ((Frame)src).getTitle() + ">");
+ } else if (cls == Button.class) {
+- Sysout.println(e.paramString() + " on <" + ((Button)src).getLabel() + ">");
++ System.out.println(e.paramString() + " on <" + ((Button)src).getLabel() + ">");
+ } else {
+- Sysout.println(e.paramString() + " on <Non-testing component>");
++ System.out.println(e.paramString() + " on <Non-testing component>");
+ }
+ }
+ }, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
+
+- setSize (200,200);
++ setSize (500, 200);
+ setVisible(true);
+ validate();
+
+@@ -117,15 +92,15 @@
+ owner.setSize(new Dimension(400, 100));
+ owner.setVisible(true);
+ owner.toFront();
+- waitTillShown(owner);
++ Util.waitTillShown(owner);
+
+ window1.setVisible(true);
+ window2.setVisible(true);
+ window1.toFront();
+ window2.toFront();
+ // Wait longer...
+- waitTillShown(window1);
+- waitTillShown(window2);
++ Util.waitTillShown(window1);
++ Util.waitTillShown(window2);
+
+ test();
+
+@@ -134,85 +109,39 @@
+ }
+
+ public void test() {
+-
+ Button[] butArr = new Button[] {testButton3, testButton2, testButton1};
+ Window[] winArr = new Window[] {window2, window1, owner};
+
+ step = 1;
+ for (int i = 0; i < 3; i++) {
+- clickOnCheckFocusOwner(butArr[i]);
+- clickOnCheckFocusedWindow(frame);
+- clickOn(owner);
+- if (!checkFocusedWindow(winArr[i])) {
+- stopTest("Test failed: actual focused window didn't get a focus");
+- }
+- if (!checkFocusOwner(butArr[i])) {
+- stopTest("Test failed: actual focus owner didn't get a focus");
+- }
++ clickInSeriesCheckFocus(null, butArr[i], frame);
++ clickOwnerCheckFocus(winArr[i], butArr[i]);
+ step++;
+ }
+
+ step = 4;
+- clickOnCheckFocusOwner(testButton3);
+- clickOnCheckFocusOwner(testButton1);
+- clickOnCheckFocusedWindow(frame);
+- clickOn(owner);
+- if (!checkFocusedWindow(owner)) {
+- stopTest("Test failed: actual focused window didn't get a focus");
+- }
+- if (!checkFocusOwner(testButton1)) {
+- stopTest("Test failed: actual focus owner didn't get a focus");
+- }
More information about the distro-pkg-dev
mailing list