author | amurillo |
Fri, 19 Aug 2016 11:22:14 -0700 | |
changeset 40386 | cf75dd18b3cd |
parent 39006 | fd8c3312d043 |
permissions | -rw-r--r-- |
36744 | 1 |
/* |
2 |
* Copyright (c) 2011, 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.window.WindowDemo; |
26 |
import static com.sun.swingset3.demos.window.WindowDemo.*; |
|
27 |
import static org.jemmy2ext.JemmyExt.*; |
|
28 |
import static org.testng.AssertJUnit.*; |
|
29 |
import org.testng.annotations.Test; |
|
30 |
import org.netbeans.jemmy.ClassReference; |
|
31 |
import org.netbeans.jemmy.operators.JButtonOperator; |
|
32 |
import org.netbeans.jemmy.operators.JFrameOperator; |
|
33 |
import org.netbeans.jemmy.operators.JLabelOperator; |
|
34 |
import org.netbeans.jemmy.operators.WindowOperator; |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
35 |
import org.testng.annotations.Listeners; |
36744 | 36 |
|
37 |
/* |
|
38 |
* @test |
|
39 |
* @key headful |
|
40 |
* @summary Verifies SwingSet3 WindowDemo by checking that separate JWindow is |
|
41 |
* shown, it contains predefined label and no new windows are opened |
|
42 |
* when the "Show JWindow..." button is clicked. |
|
43 |
* |
|
44 |
* @library /sanity/client/lib/jemmy/src |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
45 |
* @library /sanity/client/lib/Extensions/src |
36744 | 46 |
* @library /sanity/client/lib/SwingSet3/src |
39006
fd8c3312d043
8157339: Further stabilization for the SwingSet client sanity tests
prr
parents:
37677
diff
changeset
|
47 |
* @modules java.desktop |
fd8c3312d043
8157339: Further stabilization for the SwingSet client sanity tests
prr
parents:
37677
diff
changeset
|
48 |
* java.logging |
36744 | 49 |
* @build org.jemmy2ext.JemmyExt |
50 |
* @build com.sun.swingset3.demos.window.WindowDemo |
|
51 |
* @run testng WindowDemoTest |
|
52 |
*/ |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
53 |
@Listeners(GuiTestListener.class) |
36744 | 54 |
public class WindowDemoTest { |
55 |
||
56 |
@Test |
|
57 |
public void test() throws Exception { |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
58 |
|
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
59 |
new ClassReference(WindowDemo.class.getCanonicalName()).startApplication(); |
36744 | 60 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
61 |
JFrameOperator frame = new JFrameOperator(); |
36744 | 62 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
63 |
assertEquals("Only one JWindow is shown", 1, getJWindowCount()); |
36744 | 64 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
65 |
WindowOperator window = new WindowOperator(getJWindow()); |
36744 | 66 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
67 |
assertTrue("JFrame is showing", frame.isShowing()); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
68 |
assertFalse("JFrame is not iconified", isIconified(frame)); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
69 |
assertTrue("JWindow is showing", window.isShowing()); |
36744 | 70 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
71 |
final String labelText = I_HAVE_NO_SYSTEM_BORDER; |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
72 |
JLabelOperator jLabelOperator = new JLabelOperator(window, labelText); |
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
73 |
assertEquals("JWindow contains the label with corresponding text", labelText, jLabelOperator.getText()); |
36744 | 74 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
75 |
new JButtonOperator(frame, SHOW_J_WINDOW).push(); |
36744 | 76 |
|
37677
9774eca96b01
8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents:
36744
diff
changeset
|
77 |
assertEquals("Only one JWindow is shown", 1, getJWindowCount()); |
36744 | 78 |
} |
79 |
||
80 |
} |