11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 @test
26 @key headful
27 @bug 6429174
28 @summary Tests that mouse click at the are of intersection of two
29 scrollbars for text area doesn't trigger any scrolling
30 @author artem.ananiev@sun.com: area=awt.text
31 @library ../../../../lib/testlibrary
32 @build jdk.testlibrary.OSInfo
33 @run main ScrollbarIntersectionTest
34 */
35
36 import java.awt.*;
37 import java.awt.event.*;
38 import jdk.testlibrary.OSInfo;
39
40
41 public class ScrollbarIntersectionTest
42 {
43 private static void init()
44 {
45
46 Frame f = new Frame("F");
47 f.setBounds(100, 100, 480, 360);
48 f.setLayout(new BorderLayout());
49
50 TextArea ta = new TextArea(null, 8, 24, TextArea.SCROLLBARS_BOTH);
51 // append several lines to show vertical scrollbar
52 for (int i = 0; i < 128; i++)
53 {
54 ta.append("" + i + "\n");
55 }
56 // and some characters into the last line for horizontal scrollbar
57 for (int i = 0; i < 128; i++)
58 {
59 ta.append("" + i);
117 System.err.println("Selected text: " + sel);
118 if ((sel == null) || !sel.startsWith("0"))
119 {
120 fail("Test FAILED: TextArea is scrolled");
121 return;
122 }
123
124 pass();
125 }
126
127 private static boolean theTestPassed = false;
128 private static boolean testGeneratedInterrupt = false;
129 private static String failureMessage = "";
130
131 private static Thread mainThread = null;
132
133 private static int sleepTime = 300000;
134
135 public static void main( String args[] ) throws InterruptedException
136 {
137 if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
138 // On OS X, this area is commandeered by the system,
139 // and frame would be wildly resized
140 System.out.println("Not for OS X");
141 return;
142 }
143 mainThread = Thread.currentThread();
144 try
145 {
146 init();
147 }
148 catch( TestPassedException e )
149 {
150 return;
151 }
152
153 try
154 {
155 Thread.sleep( sleepTime );
156 throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
157 }
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 @test
26 @key headful
27 @bug 6429174
28 @summary Tests that mouse click at the are of intersection of two
29 scrollbars for text area doesn't trigger any scrolling
30 @author artem.ananiev@sun.com: area=awt.text
31 @library /test/lib
32 @build jdk.test.lib.Platform
33 @run main ScrollbarIntersectionTest
34 */
35
36 import java.awt.*;
37 import java.awt.event.*;
38
39 import jdk.test.lib.Platform;
40
41 public class ScrollbarIntersectionTest
42 {
43 private static void init()
44 {
45
46 Frame f = new Frame("F");
47 f.setBounds(100, 100, 480, 360);
48 f.setLayout(new BorderLayout());
49
50 TextArea ta = new TextArea(null, 8, 24, TextArea.SCROLLBARS_BOTH);
51 // append several lines to show vertical scrollbar
52 for (int i = 0; i < 128; i++)
53 {
54 ta.append("" + i + "\n");
55 }
56 // and some characters into the last line for horizontal scrollbar
57 for (int i = 0; i < 128; i++)
58 {
59 ta.append("" + i);
117 System.err.println("Selected text: " + sel);
118 if ((sel == null) || !sel.startsWith("0"))
119 {
120 fail("Test FAILED: TextArea is scrolled");
121 return;
122 }
123
124 pass();
125 }
126
127 private static boolean theTestPassed = false;
128 private static boolean testGeneratedInterrupt = false;
129 private static String failureMessage = "";
130
131 private static Thread mainThread = null;
132
133 private static int sleepTime = 300000;
134
135 public static void main( String args[] ) throws InterruptedException
136 {
137 if (Platform.isOSX()) {
138 // On OS X, this area is commandeered by the system,
139 // and frame would be wildly resized
140 System.out.println("Not for OS X");
141 return;
142 }
143 mainThread = Thread.currentThread();
144 try
145 {
146 init();
147 }
148 catch( TestPassedException e )
149 {
150 return;
151 }
152
153 try
154 {
155 Thread.sleep( sleepTime );
156 throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
157 }
|