|
@@ -28,13 +28,16 @@ import com.dmdirc.config.IdentityManager;
|
28
|
28
|
import com.dmdirc.harness.ui.UIClassTestRunner;
|
29
|
29
|
import com.dmdirc.harness.ui.ClassFinder;
|
30
|
30
|
|
31
|
|
-import com.dmdirc.harness.ui.UITest;
|
|
31
|
+import com.dmdirc.harness.ui.UITestIface;
|
|
32
|
+import com.dmdirc.ui.swing.JRadioButtonByTextMatcher;
|
32
|
33
|
import com.dmdirc.ui.swing.components.ImageButton;
|
33
|
34
|
|
34
|
35
|
import java.awt.Component;
|
35
|
36
|
import javax.swing.JButton;
|
36
|
37
|
import javax.swing.JPanel;
|
37
|
38
|
|
|
39
|
+import javax.swing.JTextField;
|
|
40
|
+import javax.swing.text.JTextComponent;
|
38
|
41
|
import org.fest.swing.core.EventMode;
|
39
|
42
|
import org.fest.swing.core.matcher.JButtonByTextMatcher;
|
40
|
43
|
import org.fest.swing.core.matcher.JLabelByTextMatcher;
|
|
@@ -48,7 +51,7 @@ import org.junit.runner.RunWith;
|
48
|
51
|
import static org.junit.Assert.*;
|
49
|
52
|
|
50
|
53
|
@RunWith(UIClassTestRunner.class)
|
51
|
|
-public class ActionEditorDialogTest implements UITest {
|
|
54
|
+public class ActionEditorDialogTest implements UITestIface {
|
52
|
55
|
|
53
|
56
|
private DialogFixture window;
|
54
|
57
|
|
|
@@ -100,6 +103,7 @@ public class ActionEditorDialogTest implements UITest {
|
100
|
103
|
label.requireVisible();
|
101
|
104
|
|
102
|
105
|
assertTrue(items > triggers.comboBox().target.getItemCount());
|
|
106
|
+ window.button(JButtonByTextMatcher.withText("OK")).requireEnabled();
|
103
|
107
|
|
104
|
108
|
triggers.button(new ClassFinder<JButton>(ImageButton.class, null)).click();
|
105
|
109
|
|
|
@@ -109,6 +113,40 @@ public class ActionEditorDialogTest implements UITest {
|
109
|
113
|
}
|
110
|
114
|
|
111
|
115
|
assertEquals(items, triggers.comboBox().target.getItemCount());
|
|
116
|
+ window.button(JButtonByTextMatcher.withText("OK")).requireDisabled();
|
|
117
|
+ }
|
|
118
|
+
|
|
119
|
+ @Test
|
|
120
|
+ public void testBasicConditionTrees() {
|
|
121
|
+ setupWindow(null);
|
|
122
|
+
|
|
123
|
+ window.panel(new ClassFinder<JPanel>(ActionNamePanel.class, null)).textBox()
|
|
124
|
+ .enterText("test1");
|
|
125
|
+ final JPanelFixture triggers = window.panel(
|
|
126
|
+ new ClassFinder<JPanel>(ActionTriggersPanel.class, null));
|
|
127
|
+
|
|
128
|
+ triggers.comboBox().selectItem("Channel message received");
|
|
129
|
+ triggers.button(JButtonByTextMatcher.withText("Add")).requireEnabled().click();
|
|
130
|
+
|
|
131
|
+ window.radioButton(new JRadioButtonByTextMatcher("All of the conditions are true"))
|
|
132
|
+ .requireEnabled().requireSelected();
|
|
133
|
+ window.radioButton(new JRadioButtonByTextMatcher("At least one of the conditions is true"))
|
|
134
|
+ .requireEnabled();
|
|
135
|
+ window.radioButton(new JRadioButtonByTextMatcher("The conditions match a custom rule"))
|
|
136
|
+ .requireEnabled();
|
|
137
|
+ window.panel(new ClassFinder<JPanel>(ActionConditionsTreePanel.class, null))
|
|
138
|
+ .textBox(new ClassFinder<JTextComponent>(JTextField.class, null))
|
|
139
|
+ .requireDisabled();
|
|
140
|
+
|
|
141
|
+ window.button(JButtonByTextMatcher.withText("OK")).requireEnabled();
|
|
142
|
+
|
|
143
|
+ window.radioButton(new JRadioButtonByTextMatcher("The conditions match a custom rule"))
|
|
144
|
+ .click().requireSelected();
|
|
145
|
+ window.panel(new ClassFinder<JPanel>(ActionConditionsTreePanel.class, null))
|
|
146
|
+ .textBox(new ClassFinder<JTextComponent>(JTextField.class, null))
|
|
147
|
+ .requireEnabled().enterText("invalid");
|
|
148
|
+
|
|
149
|
+ window.button(JButtonByTextMatcher.withText("OK")).requireDisabled();
|
112
|
150
|
}
|
113
|
151
|
|
114
|
152
|
protected void setupWindow(final Action action) {
|