51 * that those change upon clicking. When toggling radio buttons it |
52 * that those change upon clicking. When toggling radio buttons it |
52 * verifies that other radio buttons in the same group are not longer |
53 * verifies that other radio buttons in the same group are not longer |
53 * selected. |
54 * selected. |
54 * |
55 * |
55 * @library /sanity/client/lib/jemmy/src |
56 * @library /sanity/client/lib/jemmy/src |
56 * @library /sanity/client/lib/Jemmy2Ext/src |
57 * @library /sanity/client/lib/Extensions/src |
57 * @library /sanity/client/lib/SwingSet3/src |
58 * @library /sanity/client/lib/SwingSet3/src |
58 * @build org.jemmy2ext.JemmyExt |
59 * @build org.jemmy2ext.JemmyExt |
59 * @build com.sun.swingset3.demos.togglebutton.ToggleButtonDemo |
60 * @build com.sun.swingset3.demos.togglebutton.ToggleButtonDemo |
60 * @run testng ToggleButtonDemoTest |
61 * @run testng ToggleButtonDemoTest |
61 */ |
62 */ |
|
63 @Listeners(GuiTestListener.class) |
62 public class ToggleButtonDemoTest { |
64 public class ToggleButtonDemoTest { |
63 |
65 |
64 @Test |
66 @Test |
65 public void test() throws Exception { |
67 public void test() throws Exception { |
66 captureDebugInfoOnFail(() -> { |
68 new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication(); |
67 new ClassReference(ToggleButtonDemo.class.getCanonicalName()).startApplication(); |
|
68 |
69 |
69 JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value()); |
70 JFrameOperator mainFrame = new JFrameOperator(ToggleButtonDemo.class.getAnnotation(DemoProperties.class).value()); |
70 JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame); |
71 JTabbedPaneOperator tabPane = new JTabbedPaneOperator(mainFrame); |
71 |
72 |
72 // Radio Button Toggles |
73 // Radio Button Toggles |
73 testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null); |
74 testRadioButtons(getBorderTitledJPanelOperator(mainFrame, TEXT_RADIO_BUTTONS), 3, null); |
74 testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null); |
75 testRadioButtons(getBorderTitledJPanelOperator(mainFrame, IMAGE_RADIO_BUTTONS), 3, null); |
75 testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t)); |
76 testRadioButtons(getLabeledContainerOperator(mainFrame, PAD_AMOUNT), 3, (t, i) -> DEFAULT.equals(t)); |
76 |
77 |
77 // switch to the Check Boxes Tab |
78 // switch to the Check Boxes Tab |
78 tabPane.selectPage(CHECK_BOXES); |
79 tabPane.selectPage(CHECK_BOXES); |
79 |
80 |
80 // Check Box Toggles |
81 // Check Box Toggles |
81 ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES); |
82 ContainerOperator<?> textCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, TEXT_CHECKBOXES); |
82 testCheckBox(textCheckBoxesJPanel, CHECK1, false); |
83 testCheckBox(textCheckBoxesJPanel, CHECK1, false); |
83 testCheckBox(textCheckBoxesJPanel, CHECK2, false); |
84 testCheckBox(textCheckBoxesJPanel, CHECK2, false); |
84 testCheckBox(textCheckBoxesJPanel, CHECK3, false); |
85 testCheckBox(textCheckBoxesJPanel, CHECK3, false); |
85 |
86 |
86 ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES); |
87 ContainerOperator<?> imageCheckBoxesJPanel = getBorderTitledJPanelOperator(mainFrame, IMAGE_CHECKBOXES); |
87 testCheckBox(imageCheckBoxesJPanel, CHECK1, false); |
88 testCheckBox(imageCheckBoxesJPanel, CHECK1, false); |
88 testCheckBox(imageCheckBoxesJPanel, CHECK2, false); |
89 testCheckBox(imageCheckBoxesJPanel, CHECK2, false); |
89 testCheckBox(imageCheckBoxesJPanel, CHECK3, false); |
90 testCheckBox(imageCheckBoxesJPanel, CHECK3, false); |
90 |
91 |
91 ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS); |
92 ContainerOperator<?> displayOptionsContainer = getLabeledContainerOperator(mainFrame, DISPLAY_OPTIONS); |
92 testCheckBox(displayOptionsContainer, PAINT_BORDER, false); |
93 testCheckBox(displayOptionsContainer, PAINT_BORDER, false); |
93 testCheckBox(displayOptionsContainer, PAINT_FOCUS, true); |
94 testCheckBox(displayOptionsContainer, PAINT_FOCUS, true); |
94 testCheckBox(displayOptionsContainer, ENABLED, true); |
95 testCheckBox(displayOptionsContainer, ENABLED, true); |
95 testCheckBox(displayOptionsContainer, CONTENT_FILLED, true); |
96 testCheckBox(displayOptionsContainer, CONTENT_FILLED, true); |
96 |
97 |
97 // Direction Button Toggles |
98 // Direction Button Toggles |
98 testToggleButtons(mainFrame); |
99 testToggleButtons(mainFrame); |
99 }); |
|
100 } |
100 } |
101 |
101 |
102 /** |
102 /** |
103 * The interface is invoked for each radio button providing its name and |
103 * The interface is invoked for each radio button providing its name and |
104 * index and it should return whether the radio button has to be selected. |
104 * index and it should return whether the radio button has to be selected. |