Browse Source

Misc unit testsa

git-svn-id: http://svn.dmdirc.com/trunk@4308 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 years ago
parent
commit
86523cf792

+ 5
- 0
test/com/dmdirc/actions/ActionGroupTest.java View File

@@ -117,5 +117,10 @@ public class ActionGroupTest extends junit.framework.TestCase {
117 117
         instance.remove(null);
118 118
         assertFalse(instance.contains(null));
119 119
     }    
120
+    
121
+    @Test
122
+    public void testIsDelible() {
123
+        assertTrue(new ActionGroup("foo").isDelible());
124
+    }
120 125
 
121 126
 }

+ 27
- 0
test/com/dmdirc/config/prefs/PreferencesManagerTest.java View File

@@ -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
 }

Loading…
Cancel
Save