./test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java

Print this page
rev 293 : Ensure that scrolling and text selection is really performed on Gnome
using method SunToolkit.realSync().

*** 139,151 **** } void moveMouseBelowTextArea( boolean shift ) { Dimension d = textArea.getSize(); Point l = textArea.getLocationOnScreen(); int y = (int)(l.y+d.height*1.5); if( shift ) y+=15; ! robot.mouseMove( (int)(l.x+d.width*.5), y ); } void checkResults() { //try { Thread.sleep( 30*1000 ); } //catch( Exception e ) { throw new RuntimeException( e ); } --- 139,162 ---- } 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( x, y ); ! // it is needed to add some small delay on Gnome ! waitUntilScrollIsPerformed(); ! } ! ! /** ! * Force window toolkit to synchronize with the native windowing ! * sub-system. ! */ ! void waitUntilScrollIsPerformed() { ! ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); } void checkResults() { //try { Thread.sleep( 30*1000 ); } //catch( Exception e ) { throw new RuntimeException( e ); }