|
@@ -21,8 +21,11 @@
|
21
|
21
|
*/
|
22
|
22
|
package com.dmdirc.config.prefs;
|
23
|
23
|
|
|
24
|
+import com.dmdirc.actions.ActionManager;
|
|
25
|
+import com.dmdirc.actions.CoreActionType;
|
24
|
26
|
import com.dmdirc.harness.TestPreferencesInterface;
|
25
|
27
|
import com.dmdirc.config.IdentityManager;
|
|
28
|
+import com.dmdirc.harness.TestActionListener;
|
26
|
29
|
import org.junit.Before;
|
27
|
30
|
import org.junit.Test;
|
28
|
31
|
import static org.junit.Assert.*;
|
|
@@ -73,5 +76,29 @@ public class PreferencesManagerTest extends junit.framework.TestCase {
|
73
|
76
|
pm.fireSaveListeners();
|
74
|
77
|
assertTrue(tpi.saved);
|
75
|
78
|
}
|
|
79
|
+
|
|
80
|
+ @Test
|
|
81
|
+ public void testOpenAction() {
|
|
82
|
+ final TestActionListener tal = new TestActionListener();
|
|
83
|
+ ActionManager.init();
|
|
84
|
+ ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_OPENED);
|
|
85
|
+
|
|
86
|
+ new PreferencesManager();
|
|
87
|
+
|
|
88
|
+ assertNotNull(tal.events.get(CoreActionType.CLIENT_PREFS_OPENED));
|
|
89
|
+ assertEquals(1, tal.events.get(CoreActionType.CLIENT_PREFS_OPENED).size());
|
|
90
|
+ }
|
|
91
|
+
|
|
92
|
+ @Test
|
|
93
|
+ public void testCloseAction() {
|
|
94
|
+ final TestActionListener tal = new TestActionListener();
|
|
95
|
+ ActionManager.init();
|
|
96
|
+ ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_CLOSED);
|
|
97
|
+
|
|
98
|
+ new PreferencesManager().close();
|
|
99
|
+
|
|
100
|
+ assertNotNull(tal.events.get(CoreActionType.CLIENT_PREFS_CLOSED));
|
|
101
|
+ assertEquals(1, tal.events.get(CoreActionType.CLIENT_PREFS_CLOSED).size());
|
|
102
|
+ }
|
76
|
103
|
|
77
|
104
|
}
|