01: package org.uispec4j;
02:
03: import org.uispec4j.utils.UIComponentFactory;
04: import org.uispec4j.xml.XmlAssert;
05:
06: import javax.swing.*;
07:
08: public class RadioButtonTest extends ButtonTestCase {
09: private RadioButton radioButton;
10: private JRadioButton jRadioButton;
11:
12: protected void setUp() throws Exception {
13: super .setUp();
14: jRadioButton = new JRadioButton("myRadioButton");
15: radioButton = (RadioButton) UIComponentFactory
16: .createUIComponent(jRadioButton);
17: }
18:
19: protected AbstractButton getButton() {
20: return radioButton;
21: }
22:
23: protected javax.swing.AbstractButton getSwingButton() {
24: return jRadioButton;
25: }
26:
27: public void testGetComponentTypeName() throws Exception {
28: assertEquals("radioButton", radioButton
29: .getDescriptionTypeName());
30: }
31:
32: public void testGetDescription() throws Exception {
33: XmlAssert.assertEquivalent(
34: "<radioButton label='myRadioButton'/>", radioButton
35: .getDescription());
36: }
37:
38: public void testFactory() throws Exception {
39: checkFactory(jRadioButton, RadioButton.class);
40: }
41:
42: public void testIsActivated() throws Exception {
43: assertFalse(radioButton.isSelected());
44: jRadioButton.doClick();
45: assertTrue(radioButton.isSelected());
46: jRadioButton.doClick();
47: assertFalse(radioButton.isSelected());
48: }
49:
50: public void testActivate() throws Exception {
51: assertFalse(radioButton.isSelected());
52: radioButton.click();
53: assertTrue(jRadioButton.isSelected());
54: assertTrue(radioButton.isSelected());
55: radioButton.click();
56: assertFalse(radioButton.isSelected());
57: assertFalse(jRadioButton.isSelected());
58: }
59: }
|