author | martin |
Wed, 30 Nov 2016 19:40:36 -0800 | |
changeset 42443 | b9b966ca4a58 |
parent 39006 | fd8c3312d043 |
permissions | -rw-r--r-- |
36744 | 1 |
/* |
2 |
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
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 |
||
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
24 |
import org.jtregext.GuiTestListener; |
36744 | 25 |
import com.sun.swingset3.demos.scrollpane.ScrollPaneDemo; |
26 |
import static com.sun.swingset3.demos.scrollpane.ScrollPaneDemo.DEMO_TITLE; |
|
27 |
import static org.testng.AssertJUnit.*; |
|
28 |
import org.testng.annotations.Test; |
|
29 |
import org.netbeans.jemmy.ClassReference; |
|
30 |
import org.netbeans.jemmy.operators.JFrameOperator; |
|
31 |
import org.netbeans.jemmy.operators.JScrollPaneOperator; |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
32 |
import org.testng.annotations.Listeners; |
36744 | 33 |
|
34 |
/* |
|
35 |
* @test |
|
36 |
* @key headful |
|
37 |
* @summary Verifies SwingSet3 ScrollPaneDemo by scrolling to bottom, to top, |
|
38 |
* to left and to right and checking scroll bar values. |
|
39 |
* |
|
40 |
* @library /sanity/client/lib/jemmy/src |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
41 |
* @library /sanity/client/lib/Extensions/src |
36744 | 42 |
* @library /sanity/client/lib/SwingSet3/src |
39006
fd8c3312d043
8157339: Further stabilization for the SwingSet client sanity tests
prr
parents:
37677
diff
changeset
|
43 |
* @modules java.desktop |
fd8c3312d043
8157339: Further stabilization for the SwingSet client sanity tests
prr
parents:
37677
diff
changeset
|
44 |
* java.logging |
36744 | 45 |
* @build org.jemmy2ext.JemmyExt |
46 |
* @build com.sun.swingset3.demos.scrollpane.ScrollPaneDemo |
|
47 |
* @run testng ScrollPaneDemoTest |
|
48 |
*/ |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
49 |
@Listeners(GuiTestListener.class) |
36744 | 50 |
public class ScrollPaneDemoTest { |
51 |
||
52 |
@Test |
|
53 |
public void test() throws Exception { |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
54 |
|
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
55 |
new ClassReference(ScrollPaneDemo.class.getName()).startApplication(); |
36744 | 56 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
57 |
JFrameOperator frame = new JFrameOperator(DEMO_TITLE); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
58 |
JScrollPaneOperator jspo = new JScrollPaneOperator(frame); |
36744 | 59 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
60 |
// Set initial scrollbar positions |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
61 |
int initialVerticalValue = jspo.getVerticalScrollBar().getValue(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
62 |
int initialHorizontalValue = jspo.getHorizontalScrollBar().getValue(); |
36744 | 63 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
64 |
System.out.println("Initial Vertical Value = " + jspo.getVerticalScrollBar().getValue()); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
65 |
System.out.println("Initial HoriZontal Value = " + jspo.getHorizontalScrollBar().getValue()); |
36744 | 66 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
67 |
// Check scroll to Bottom |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
68 |
{ |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
69 |
jspo.scrollToBottom(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
70 |
int currentValue = jspo.getVerticalScrollBar().getValue(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
71 |
System.out.println("Final Value = " + currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
72 |
assertTrue("Scroll to Bottom of Pane " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
73 |
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
74 |
+ "< currentValue, actual value = " + currentValue + ")", |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
75 |
initialVerticalValue < currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
76 |
} |
36744 | 77 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
78 |
// Check scroll to Top |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
79 |
{ |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
80 |
jspo.scrollToTop(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
81 |
int currentValue = jspo.getVerticalScrollBar().getValue(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
82 |
System.out.println("Top Scroll Final Value = " + currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
83 |
assertTrue("Scroll to Top of Pane " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
84 |
+ "(initialVerticalValue, actual value: " + initialVerticalValue + " " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
85 |
+ "> currentValue, actual value = " + currentValue + ")", |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
86 |
initialVerticalValue > currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
87 |
} |
36744 | 88 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
89 |
// Check scroll to Left |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
90 |
{ |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
91 |
jspo.scrollToLeft(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
92 |
int currentValue = jspo.getHorizontalScrollBar().getValue(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
93 |
System.out.println("Scroll to Left Final Value = " + currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
94 |
assertTrue("Scroll to Left of Pane " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
95 |
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
96 |
+ "> currentValue, actual value = " + currentValue + ")", |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
97 |
initialHorizontalValue > currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
98 |
} |
36744 | 99 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
100 |
// Check scroll to Right |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
101 |
{ |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
102 |
jspo.scrollToRight(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
103 |
int currentValue = jspo.getHorizontalScrollBar().getValue(); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
104 |
System.out.println("Scroll to Right Final Value = " + currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
105 |
assertTrue("Scroll to Right of Pane " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
106 |
+ "(initialHorizontalValue, actual value: " + initialHorizontalValue + " " |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
107 |
+ "< currentValue, actual value = " + currentValue + ")", |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
108 |
initialHorizontalValue < currentValue); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
109 |
} |
36744 | 110 |
} |
111 |
||
112 |
} |