From 0c8c19d62996cab6223d18485cc77fbba9752f92 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 27 Jan 2010 17:47:53 +0100 Subject: [PATCH] 6920143: test/java/awt/TestArea/UsingWithMouse.java needs realSync() Added small delay to make sure that TextArea animation have finished Reviewed-by: anthony --- .../UsingWithMouse/SelectionAutoscrollTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java b/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java index 08ad5d1211f..5c7a70a03a5 100644 --- a/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java +++ b/jdk/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java @@ -56,6 +56,7 @@ public class SelectionAutoscrollTest extends Applet { TextArea textArea; Robot robot; final int desiredSelectionEnd = ('z'-'a'+1)*2; // 52 + final static int SCROLL_DELAY = 10; // ms public void start () { createObjects(); @@ -126,6 +127,8 @@ public class SelectionAutoscrollTest extends Applet { 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 @@ public class SelectionAutoscrollTest extends Applet { 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() {