changeset 1862:102fc7d29141

Patch for test awt/TextArea/UsingWithMouse.java
author ptisnovs
date Thu, 28 Jan 2010 11:30:12 +0100
parents a1e161b0156e
children 1d8ccb881ce7
files patches/icedtea-6920143-using-with-mouse.patch
diffstat 1 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-6920143-using-with-mouse.patch	Thu Jan 28 11:30:12 2010 +0100
@@ -0,0 +1,45 @@
+6920143: test/java/awt/TestArea/UsingWithMouse.java needs realSync()
+Summary: Added small delay to make sure that TextArea animation have finished
+Reviewed-by: anthony
+
+--- openjdk.orig/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	2010-01-27 14:45:28.000000000 +0100
++++ openjdk/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	2010-01-27 14:45:27.000000000 +0100
+@@ -56,6 +56,7 @@
+     TextArea textArea;
+     Robot robot;
+     final int desiredSelectionEnd = ('z'-'a'+1)*2;  // 52
++    final static int SCROLL_DELAY = 100; // ms
+ 
+     public void start () {
+         createObjects();
+@@ -126,6 +127,8 @@
+ 
+             moveMouseBelowTextArea( tremble%2!=0 );
+             Util.waitForIdle( robot );
++            // it is needed to add some small delay on Gnome
++            waitUntilScrollIsPerformed(robot);
+         }
+ 
+         robot.mouseRelease( MouseEvent.BUTTON1_MASK );
+@@ -141,9 +144,19 @@
+     void moveMouseBelowTextArea( boolean shift ) {
+         Dimension d = textArea.getSize();
+         Point l = textArea.getLocationOnScreen();
++        int x = (int)(l.x+d.width*.5);
+         int y = (int)(l.y+d.height*1.5);
+         if( shift ) y+=15;
+-        robot.mouseMove( (int)(l.x+d.width*.5), y );
++        robot.mouseMove( x, y );
++    }
++
++    void waitUntilScrollIsPerformed(Robot robot) {
++        try {
++            Thread.sleep( SCROLL_DELAY );
++        }
++        catch( Exception e ) {
++            throw new RuntimeException( e );
++        }
+     }
+ 
+     void checkResults() {
+