提交 18366989 编写于 作者: P ptisnovs

6920143: test/java/awt/TestArea/UsingWithMouse.java needs realSync()

Summary: Added small delay to make sure that TextArea animation have finished
Reviewed-by: anthony
上级 d4681b69
...@@ -56,6 +56,7 @@ public class SelectionAutoscrollTest extends Applet { ...@@ -56,6 +56,7 @@ public class SelectionAutoscrollTest extends Applet {
TextArea textArea; TextArea textArea;
Robot robot; Robot robot;
final int desiredSelectionEnd = ('z'-'a'+1)*2; // 52 final int desiredSelectionEnd = ('z'-'a'+1)*2; // 52
final static int SCROLL_DELAY = 10; // ms
public void start () { public void start () {
createObjects(); createObjects();
...@@ -126,6 +127,8 @@ public class SelectionAutoscrollTest extends Applet { ...@@ -126,6 +127,8 @@ public class SelectionAutoscrollTest extends Applet {
moveMouseBelowTextArea( tremble%2!=0 ); moveMouseBelowTextArea( tremble%2!=0 );
Util.waitForIdle( robot ); Util.waitForIdle( robot );
// it is needed to add some small delay on Gnome
waitUntilScrollIsPerformed(robot);
} }
robot.mouseRelease( MouseEvent.BUTTON1_MASK ); robot.mouseRelease( MouseEvent.BUTTON1_MASK );
...@@ -141,9 +144,19 @@ public class SelectionAutoscrollTest extends Applet { ...@@ -141,9 +144,19 @@ public class SelectionAutoscrollTest extends Applet {
void moveMouseBelowTextArea( boolean shift ) { void moveMouseBelowTextArea( boolean shift ) {
Dimension d = textArea.getSize(); Dimension d = textArea.getSize();
Point l = textArea.getLocationOnScreen(); Point l = textArea.getLocationOnScreen();
int x = (int)(l.x+d.width*.5);
int y = (int)(l.y+d.height*1.5); int y = (int)(l.y+d.height*1.5);
if( shift ) y+=15; 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() { void checkResults() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册