19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
|
24 import org.jtregext.GuiTestListener; |
24 import com.sun.swingset3.demos.combobox.ComboBoxDemo; |
25 import com.sun.swingset3.demos.combobox.ComboBoxDemo; |
25 import static org.testng.AssertJUnit.*; |
26 import static org.testng.AssertJUnit.*; |
26 import org.testng.annotations.Test; |
27 import org.testng.annotations.Test; |
27 import org.netbeans.jemmy.ClassReference; |
28 import org.netbeans.jemmy.ClassReference; |
28 import org.netbeans.jemmy.operators.JComboBoxOperator; |
29 import org.netbeans.jemmy.operators.JComboBoxOperator; |
29 import org.netbeans.jemmy.operators.JFrameOperator; |
30 import org.netbeans.jemmy.operators.JFrameOperator; |
30 import static com.sun.swingset3.demos.combobox.ComboBoxDemo.*; |
31 import static com.sun.swingset3.demos.combobox.ComboBoxDemo.*; |
31 import static org.jemmy2ext.JemmyExt.captureDebugInfoOnFail; |
32 import org.testng.annotations.Listeners; |
32 |
33 |
33 /* |
34 /* |
34 * @test |
35 * @test |
35 * @key headful |
36 * @key headful |
36 * @summary Verifies ComboBoxes on SwingSet2 ComboBoxDemo page by selecting |
37 * @summary Verifies ComboBoxes on SwingSet2 ComboBoxDemo page by selecting |
37 * each value of each ComboBox. |
38 * each value of each ComboBox. |
38 * |
39 * |
39 * @library /sanity/client/lib/jemmy/src |
40 * @library /sanity/client/lib/jemmy/src |
40 * @library /sanity/client/lib/Jemmy2Ext/src |
41 * @library /sanity/client/lib/Extensions/src |
41 * @library /sanity/client/lib/SwingSet3/src |
42 * @library /sanity/client/lib/SwingSet3/src |
42 * @build org.jemmy2ext.JemmyExt |
43 * @build org.jemmy2ext.JemmyExt |
43 * @build com.sun.swingset3.demos.combobox.ComboBoxDemo |
44 * @build com.sun.swingset3.demos.combobox.ComboBoxDemo |
44 * @run testng ComboBoxDemoTest |
45 * @run testng ComboBoxDemoTest |
45 */ |
46 */ |
|
47 @Listeners(GuiTestListener.class) |
46 public class ComboBoxDemoTest { |
48 public class ComboBoxDemoTest { |
47 |
49 |
48 private static enum ComboBoxInfo { |
50 private static enum ComboBoxInfo { |
49 PRESETS("Presets:"), |
51 PRESETS("Presets:"), |
50 HAIR("Hair:"), |
52 HAIR("Hair:"), |
59 |
61 |
60 } |
62 } |
61 |
63 |
62 @Test |
64 @Test |
63 public void test() throws Exception { |
65 public void test() throws Exception { |
64 captureDebugInfoOnFail(() -> { |
|
65 new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication(); |
|
66 |
66 |
67 JFrameOperator frame = new JFrameOperator(DEMO_TITLE); |
67 new ClassReference(ComboBoxDemo.class.getCanonicalName()).startApplication(); |
68 for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) { |
68 |
69 comboBoxChecker(frame, comboBoxInfo); |
69 JFrameOperator frame = new JFrameOperator(DEMO_TITLE); |
70 } |
70 for (ComboBoxInfo comboBoxInfo : ComboBoxInfo.values()) { |
71 }); |
71 comboBoxChecker(frame, comboBoxInfo); |
|
72 } |
72 } |
73 } |
73 |
74 |
74 private void comboBoxChecker(JFrameOperator jfo, ComboBoxInfo comboBoxInfo) { |
75 private void comboBoxChecker(JFrameOperator jfo, ComboBoxInfo comboBoxInfo) { |
75 JComboBoxOperator jcbo = new JComboBoxOperator(jfo, comboBoxInfo.ordinal()); |
76 JComboBoxOperator jcbo = new JComboBoxOperator(jfo, comboBoxInfo.ordinal()); |
76 for (int i = 0; i < jcbo.getItemCount(); i++) { |
77 for (int i = 0; i < jcbo.getItemCount(); i++) { |