EMMA Coverage Report (generated Sat Oct 08 11:41:37 CEST 2011)
[all classes][net.sf.jomic.ui]

COVERAGE SUMMARY FOR SOURCE FILE [OpenComicFileChooserAccessoryTest.java]

nameclass, %method, %block, %line, %
OpenComicFileChooserAccessoryTest.java67%  (2/3)100% (7/7)84%  (74/88)88%  (29/33)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OpenComicFileChooserAccessoryTest100% (1/1)100% (5/5)81%  (59/73)85%  (23/27)
fixtureTearDown (): void 100% (1/1)50%  (7/14)67%  (4/6)
fixtureSetUp (): void 100% (1/1)59%  (10/17)71%  (5/7)
OpenComicFileChooserAccessoryTest (): void 100% (1/1)100% (3/3)100% (2/2)
testAccessory (): void 100% (1/1)100% (12/12)100% (4/4)
testFileChooser (): void 100% (1/1)100% (27/27)100% (8/8)
     
class OpenComicFileChooserAccessoryTest$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class OpenComicFileChooserAccessoryTest$ShowOpenDialogRunner100% (1/1)100% (2/2)100% (15/15)100% (6/6)
OpenComicFileChooserAccessoryTest$ShowOpenDialogRunner (OpenComicFileChooserA... 100% (1/1)100% (9/9)100% (4/4)
run (): void 100% (1/1)100% (6/6)100% (2/2)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2011 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic.ui;
17 
18import javax.swing.JFileChooser;
19import javax.swing.SwingUtilities;
20 
21import junit.extensions.abbot.ComponentTestFixture;
22import net.sf.jomic.tools.TestTools;
23 
24/**
25 *  TestCase for OpenComicFileChooserAccessory.
26 *
27 * @author    Thomas Aglassinger
28 */
29public class OpenComicFileChooserAccessoryTest extends ComponentTestFixture
30{
31    private TestTools testTools;
32 
33    public void testAccessory() {
34        OpenComicFileChooserAccessory accessory = new OpenComicFileChooserAccessory();
35 
36        showFrame(accessory);
37        testTools.waitSomeTime();
38    }
39 
40    public void testFileChooser() {
41        final JFileChooser chooser = new JFileChooser();
42        OpenComicFileChooserAccessory accessory = new OpenComicFileChooserAccessory();
43 
44        chooser.setAccessory(accessory);
45 
46        Runnable chooserRunner = new ShowOpenDialogRunner(chooser);
47 
48        SwingUtilities.invokeLater(chooserRunner);
49        testTools.waitSomeTime();
50        chooser.setVisible(false);
51    }
52 
53    protected void fixtureSetUp()
54        throws Exception {
55        try {
56            super.fixtureSetUp();
57        } catch (Throwable error) {
58            throw new IllegalStateException("cannot setup fixture", error);
59        }
60        testTools = TestTools.instance();
61        testTools.setupCache();
62    }
63 
64    protected void fixtureTearDown()
65        throws Exception {
66        testTools = null;
67        try {
68            super.fixtureTearDown();
69        } catch (Throwable error) {
70            throw new IllegalStateException("cannot tear down fixture", error);
71        }
72 
73    }
74 
75    /**
76     *  Runnable to show a JFileChooser.
77     *
78     * @author    Thomas Aglassinger
79     */
80    private final class ShowOpenDialogRunner implements Runnable
81    {
82        private final JFileChooser chooser;
83 
84        private ShowOpenDialogRunner(JFileChooser newChooser) {
85            super();
86            chooser = newChooser;
87        }
88 
89        public void run() {
90            chooser.showOpenDialog(null);
91        }
92    }
93}

[all classes][net.sf.jomic.ui]
EMMA 2.0.4217 (C) Vladimir Roubtsov