Quellcode durchsuchen

Remove unused Swing testing library

Change-Id: Ifaf1e2fc359c2fddbb7ec783496afb3995bbd07e
Reviewed-on: http://gerrit.dmdirc.com/2375
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.7rc1
Greg Holmes vor 12 Jahren
Ursprung
Commit
da0619a53c

BIN
lib/uispec4j-2.2.jar Datei anzeigen


+ 0
- 59
test/com/dmdirc/harness/ui/ClassAndNameComponentMatcher.java Datei anzeigen

@@ -1,59 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2012 DMDirc Developers
3
- * 
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- * 
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- * 
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import java.awt.Component;
26
-import org.uispec4j.finder.ComponentMatcher;
27
-
28
-/**
29
- * Component matcher that matches components on their class and name.
30
- */
31
-public class ClassAndNameComponentMatcher implements ComponentMatcher {
32
-
33
-    private Class<?> clazz;
34
-    private String name;
35
-
36
-    /**
37
-     * Creates a new component matcher than matches components on their
38
-     * class and their name.
39
-     *
40
-     * @param clazz Class to match
41
-     * @param name Component name to match
42
-     */
43
-    public ClassAndNameComponentMatcher(final Class<?> clazz, final String name) {
44
-        this.clazz = clazz;
45
-        this.name = name;
46
-    }
47
-
48
-    /**
49
-     * {@inheritDoc}
50
-     * 
51
-     * @param component Component to try and match
52
-     *
53
-     * @return true iif the component matches
54
-     */
55
-    @Override
56
-    public boolean matches(final Component component) {
57
-        return component.getClass() == clazz && component.getName().equals(name);
58
-    }
59
-}

+ 0
- 57
test/com/dmdirc/harness/ui/ClassComponentMatcher.java Datei anzeigen

@@ -1,57 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2012 DMDirc Developers
3
- * 
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- * 
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- * 
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import java.awt.Component;
26
-
27
-import org.uispec4j.finder.ComponentMatcher;
28
-
29
-/**
30
- * Simple UISpec4J component matcher that matches by type.
31
- */
32
-public class ClassComponentMatcher implements ComponentMatcher {
33
-
34
-    private final Class<?> clazz;
35
-
36
-    /**
37
-     * Creates a new component matcher, searching for any components matching
38
-     * the specified class in the specified component.
39
-     *
40
-     * @param clazz Class to search for
41
-     */
42
-    public ClassComponentMatcher(final Class<?> clazz) {
43
-        this.clazz = clazz;
44
-    }
45
-
46
-    /**
47
-     * {@inheritDoc}
48
-     * 
49
-     * @param component Component to match against
50
-     * 
51
-     * @return true iif the component matches
52
-     */
53
-    @Override
54
-    public boolean matches(final Component component) {
55
-        return component.getClass() == clazz;
56
-    }
57
-}

+ 0
- 114
test/com/dmdirc/harness/ui/DMDircUITestCase.java Datei anzeigen

@@ -1,114 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2012 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import com.dmdirc.ui.IconManager;
26
-import com.dmdirc.plugins.PluginInfo;
27
-import com.dmdirc.plugins.PluginMetaData;
28
-import com.dmdirc.Main;
29
-import com.dmdirc.WritableFrameContainer;
30
-import com.dmdirc.addons.ui_swing.MainFrame;
31
-import com.dmdirc.addons.ui_swing.SwingController;
32
-import com.dmdirc.addons.ui_swing.SwingWindowFactory;
33
-import com.dmdirc.config.ConfigManager;
34
-import com.dmdirc.config.IdentityManager;
35
-import com.dmdirc.config.InvalidIdentityFileException;
36
-import com.dmdirc.plugins.PluginManager;
37
-import com.dmdirc.ui.messages.IRCDocument;
38
-import com.dmdirc.updater.Version;
39
-
40
-import org.uispec4j.UISpecTestCase;
41
-import static org.mockito.Mockito.*;
42
-
43
-/**
44
- * Provides a basic test environment for testing the DMDirc Swing UI.
45
- */
46
-public class DMDircUITestCase extends UISpecTestCase {
47
-
48
-    static {
49
-        try {
50
-            IdentityManager.getIdentityManager().initialise();
51
-        } catch (InvalidIdentityFileException ex) {
52
-            //Ignore
53
-        }
54
-
55
-        IdentityManager.getAddonIdentity().setOption("test", "windowMenuScrollInterval", "1");
56
-        IdentityManager.getAddonIdentity().setOption("test", "desktopbackground", "");
57
-        IdentityManager.getAddonIdentity().setOption("test", "desktopbackgroundoption", "SCALE");
58
-        IdentityManager.getAddonIdentity().setOption("test", "windowMenuItems", "1");
59
-        IdentityManager.getAddonIdentity().setOption("test", "windowMenuScrollInterval", "1");
60
-        Main.ensureExists(PluginManager.getPluginManager(), "tabcompletion");
61
-    }
62
-
63
-    /**
64
-     * Returns a mocked SwingController.
65
-     *
66
-     * @return SwingController mock
67
-     */
68
-    public static SwingController getMockedController() {
69
-        final PluginInfo pluginInfo = mock(PluginInfo.class);
70
-        final PluginMetaData metaData = mock(PluginMetaData.class);
71
-        final SwingController controller = mock(SwingController.class);
72
-        final SwingWindowFactory windowFactory = mock(SwingWindowFactory.class);
73
-        when(controller.getDomain()).thenReturn("test");
74
-        when(controller.getWindowFactory()).thenReturn(windowFactory);
75
-        when(controller.getVersion()).thenReturn(new Version(1));
76
-        when(pluginInfo.getMetaData()).thenReturn(metaData);
77
-        when(metaData.getVersion()).thenReturn(new Version(1));
78
-
79
-        return controller;
80
-    }
81
-
82
-    /**
83
-     * Returns a mocked SwingController that contains a mocked Main Frame.
84
-     *
85
-     * @return SwingController + MainFrame mock
86
-     */
87
-    public static SwingController getMockedControllerAndMainFrame() {
88
-        SwingController controller = getMockedController();
89
-        final MainFrame mainFrame = new MainFrame(controller);
90
-        when(controller.getMainFrame()).thenReturn(mainFrame);
91
-
92
-        return controller;
93
-    }
94
-
95
-    /**
96
-     * Returns a mocked WritableFrameContainer.
97
-     *
98
-     * @return FrameContainer mock
99
-     */
100
-    public static WritableFrameContainer getMockedContainer() {
101
-        final IRCDocument document = mock(IRCDocument.class);
102
-        @SuppressWarnings("unchecked")
103
-        final WritableFrameContainer container = mock(
104
-                WritableFrameContainer.class);
105
-        final ConfigManager config = mock(ConfigManager.class);
106
-        final IconManager iconManager = mock(IconManager.class);
107
-        when(container.getDocument()).thenReturn(document);
108
-        when(container.getConfigManager()).thenReturn(config);
109
-        when(config.getOption(anyString(), anyString())).thenReturn("mirc");
110
-        when(container.getIconManager()).thenReturn(iconManager);
111
-
112
-        return container;
113
-    }
114
-}

+ 0
- 46
test/com/dmdirc/harness/ui/WindowButtonHandler.java Datei anzeigen

@@ -1,46 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2012 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import org.uispec4j.Trigger;
26
-import org.uispec4j.Window;
27
-import org.uispec4j.interception.WindowHandler;
28
-import static org.junit.Assume.*;
29
-
30
-public class WindowButtonHandler extends WindowHandler {
31
-
32
-    private final String title, button;
33
-
34
-    public WindowButtonHandler(final String title, final String button) {
35
-        this.title = title;
36
-        this.button = button;
37
-    }
38
-
39
-    @Override
40
-    public Trigger process(final Window window) throws Exception {
41
-        assumeTrue(title.equals(window.getTitle()));
42
-
43
-        return window.getButton(button).triggerClick();
44
-    }
45
-
46
-}

Laden…
Abbrechen
Speichern