|
@@ -22,11 +22,15 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.ui_swing.dialogs.actionsmanager;
|
24
|
24
|
|
|
25
|
+import javax.swing.JLabel;
|
|
26
|
+import com.dmdirc.addons.ui_swing.components.text.TextLabel;
|
25
|
27
|
import com.dmdirc.actions.ActionGroup;
|
26
|
28
|
import com.dmdirc.updater.Version;
|
27
|
29
|
import org.junit.Test;
|
28
|
30
|
import org.uispec4j.Panel;
|
|
31
|
+import org.uispec4j.UIComponent;
|
29
|
32
|
import org.uispec4j.UISpecTestCase;
|
|
33
|
+import org.uispec4j.finder.ComponentMatcher;
|
30
|
34
|
import static org.junit.Assert.*;
|
31
|
35
|
import static org.mockito.Mockito.*;
|
32
|
36
|
|
|
@@ -59,13 +63,18 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
|
59
|
63
|
|
60
|
64
|
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
|
61
|
65
|
|
62
|
|
- assertEquals("<panel>"
|
63
|
|
- + "<textBox text=\"description\"/>"
|
64
|
|
- + "<textBox text=\"Author: \"/>"
|
65
|
|
- + "<textBox text=\"foo <bar@baz>\"/>"
|
66
|
|
- + "<textBox text=\"Version: \"/>"
|
67
|
|
- + "<textBox text=\"17\"/>"
|
68
|
|
- + "</panel>", panel.getDescription().replace("\n", ""));
|
|
66
|
+ final UIComponent[] components = panel.getUIComponents(
|
|
67
|
+ ComponentMatcher.ALL);
|
|
68
|
+ assertEquals("Description", "description", ((TextLabel) components[0]
|
|
69
|
+ .getAwtComponent()).getText().split("</?body.*?>")[1].trim());
|
|
70
|
+ assertEquals("Author label", "Author: ", ((JLabel) components[1]
|
|
71
|
+ .getAwtComponent()).getText());
|
|
72
|
+ assertEquals("Author", "foo <bar@baz>", ((JLabel) components[2]
|
|
73
|
+ .getAwtComponent()).getText());
|
|
74
|
+ assertEquals("Version label", "Version: ", ((JLabel) components[3]
|
|
75
|
+ .getAwtComponent()).getText());
|
|
76
|
+ assertEquals("version", "17", ((JLabel) components[4].getAwtComponent())
|
|
77
|
+ .getText());
|
69
|
78
|
}
|
70
|
79
|
|
71
|
80
|
@Test
|
|
@@ -76,11 +85,14 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
|
76
|
85
|
|
77
|
86
|
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
|
78
|
87
|
|
79
|
|
- assertEquals("<panel>"
|
80
|
|
- + "<textBox text=\"description\"/>"
|
81
|
|
- + "<textBox text=\"Version: \"/>"
|
82
|
|
- + "<textBox text=\"17\"/>"
|
83
|
|
- + "</panel>", panel.getDescription().replace("\n", ""));
|
|
88
|
+ final UIComponent[] components = panel.getUIComponents(
|
|
89
|
+ ComponentMatcher.ALL);
|
|
90
|
+ assertEquals("Description", "description", ((TextLabel) components[0]
|
|
91
|
+ .getAwtComponent()).getText().split("</?body.*?>")[1].trim());
|
|
92
|
+ assertEquals("Version label", "Version: ", ((JLabel) components[3]
|
|
93
|
+ .getAwtComponent()).getText());
|
|
94
|
+ assertEquals("version", "17", ((JLabel) components[4].getAwtComponent())
|
|
95
|
+ .getText());
|
84
|
96
|
}
|
85
|
97
|
|
86
|
98
|
@Test
|
|
@@ -92,11 +104,14 @@ public class ActionGroupInformationPanelTest extends UISpecTestCase {
|
92
|
104
|
|
93
|
105
|
final Panel panel = new Panel(new ActionGroupInformationPanel(group));
|
94
|
106
|
|
95
|
|
- assertEquals("<panel>"
|
96
|
|
- + "<textBox text=\"description\"/>"
|
97
|
|
- + "<textBox text=\"Author: \"/>"
|
98
|
|
- + "<textBox text=\"foo <bar@baz>\"/>"
|
99
|
|
- + "</panel>", panel.getDescription().replace("\n", ""));
|
|
107
|
+ final UIComponent[] components = panel.getUIComponents(
|
|
108
|
+ ComponentMatcher.ALL);
|
|
109
|
+ assertEquals("Description", "description", ((TextLabel) components[0]
|
|
110
|
+ .getAwtComponent()).getText().split("</?body.*?>")[1].trim());
|
|
111
|
+ assertEquals("Author label", "Author: ", ((JLabel) components[1]
|
|
112
|
+ .getAwtComponent()).getText());
|
|
113
|
+ assertEquals("Author", "foo <bar@baz>", ((JLabel) components[2]
|
|
114
|
+ .getAwtComponent()).getText());
|
100
|
115
|
}
|
101
|
116
|
|
102
|
117
|
}
|