Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sanity/client/SwingSet/src/TabbedPaneDemoTest.java
41153 views
1
/*
2
* Copyright (c) 2011, 2018, 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
24
import org.jtregext.GuiTestListener;
25
import com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo;
26
import static com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo.*;
27
import static org.jemmy2ext.JemmyExt.getLabeledContainerOperator;
28
import static org.testng.AssertJUnit.*;
29
import javax.swing.UIManager;
30
import org.testng.annotations.Test;
31
import org.netbeans.jemmy.ClassReference;
32
import org.netbeans.jemmy.operators.ContainerOperator;
33
import org.netbeans.jemmy.operators.JFrameOperator;
34
import org.netbeans.jemmy.operators.JRadioButtonOperator;
35
import org.netbeans.jemmy.operators.JTabbedPaneOperator;
36
import org.testng.annotations.Listeners;
37
38
/*
39
* @test
40
* @key headful
41
* @summary Verifies SwingSet3 TabbedPaneDemo by iterating through tab placement
42
* positions, opening each tab and verifying the the tab gets selected.
43
*
44
* @library /sanity/client/lib/jemmy/src
45
* @library /sanity/client/lib/Extensions/src
46
* @library /sanity/client/lib/SwingSet3/src
47
* @modules java.desktop
48
* java.logging
49
* @build org.jemmy2ext.JemmyExt
50
* @build com.sun.swingset3.demos.tabbedpane.TabbedPaneDemo
51
* @run testng/timeout=600 TabbedPaneDemoTest
52
*/
53
@Listeners(GuiTestListener.class)
54
public class TabbedPaneDemoTest {
55
56
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
57
public void test(String lookAndFeel) throws Exception {
58
UIManager.setLookAndFeel(lookAndFeel);
59
new ClassReference(TabbedPaneDemo.class.getCanonicalName()).startApplication();
60
61
JFrameOperator mainFrame = new JFrameOperator(DEMO_TITLE);
62
63
for (String tp : new String[]{TOP, LEFT, BOTTOM, RIGHT}) {
64
testTabs(mainFrame, tp);
65
}
66
}
67
68
public void testTabs(JFrameOperator mainFrame, String tabPlacement) throws Exception {
69
ContainerOperator<?> rbCont = getLabeledContainerOperator(mainFrame, TAB_PLACEMENT);
70
new JRadioButtonOperator(rbCont, tabPlacement).doClick();
71
72
final String[] tabTitles = new String[]{CAMILLE, MIRANDA, EWAN, BOUNCE};
73
for (int i = 0; i < tabTitles.length; i++) {
74
String pageTitle = tabTitles[i];
75
JTabbedPaneOperator tabOperator = new JTabbedPaneOperator(mainFrame);
76
tabOperator.setVerification(true);
77
tabOperator.selectPage(pageTitle);
78
}
79
}
80
81
}
82
83