EMMA Coverage Report (generated Sun Apr 20 22:38:01 CEST 2008)
[all classes][net.sf.jomic.comic]

COVERAGE SUMMARY FOR SOURCE FILE [ComicInfoTest.java]

nameclass, %method, %block, %line, %
ComicInfoTest.java100% (1/1)100% (9/9)94%  (181/193)98%  (36.1/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComicInfoTest100% (1/1)100% (9/9)94%  (181/193)98%  (36.1/37)
setUp (): void 100% (1/1)75%  (15/20)95%  (4.8/5)
<static initializer> 100% (1/1)80%  (12/15)80%  (0.8/1)
checkFile (String): void 100% (1/1)96%  (110/114)97%  (15.5/16)
ComicInfoTest (): void 100% (1/1)100% (3/3)100% (1/1)
showComicInfoFrame (ComicModel): void 100% (1/1)100% (20/20)100% (5/5)
tearDown (): void 100% (1/1)100% (9/9)100% (4/4)
testCheckIncomplete (): void 100% (1/1)100% (4/4)100% (2/2)
testCheckValid (): void 100% (1/1)100% (4/4)100% (2/2)
testEmptyInfoFrame (): void 100% (1/1)100% (4/4)100% (2/2)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2008 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.comic;
17 
18import java.awt.Dimension;
19import java.io.File;
20import java.io.IOException;
21 
22import junit.extensions.abbot.ComponentTestFixture;
23import net.sf.jomic.tools.TestTools;
24import net.sf.wraplog.Logger;
25 
26/**
27 *  TestCase for ComicInfoPanel.
28 *
29 * @author    Thomas Aglassinger
30 */
31public class ComicInfoTest extends ComponentTestFixture
32{
33    private Logger logger;
34    private TestTools testTools;
35 
36    protected void setUp()
37        throws Exception {
38        super.setUp();
39        testTools = TestTools.instance();
40        testTools.setupCache();
41        logger = Logger.getLogger(ComicInfoTest.class);
42    }
43 
44    public void testCheckIncomplete()
45        throws IOException, InterruptedException {
46        checkFile(TestTools.BROKEN_IMAGE_INCOMPLETE_CBZ);
47    }
48 
49    public void testCheckValid()
50        throws IOException, InterruptedException {
51        checkFile(TestTools.TEST_COMIC_FILE_NAME);
52    }
53 
54    public void testEmptyInfoFrame() {
55        showComicInfoFrame(null);
56    }
57 
58    protected void tearDown()
59        throws Exception {
60        logger = null;
61        testTools = null;
62        super.tearDown();
63    }
64 
65    private void checkFile(final String testFileName)
66        throws IOException, InterruptedException {
67        assert testFileName != null;
68        File comicFile = testTools.getTestFile(testFileName);
69 
70        if (logger.isInfoEnabled()) {
71            logger.info("checking \"" + comicFile + "\"");
72        }
73        ComicModel model = new ComicModel(comicFile);
74 
75        model.check(null);
76        for (int i = 0; i < model.getImageCount(); i += 1) {
77            ComicImage comicImage = model.getComicImage(i);
78            File file = comicImage.getFile();
79            String prefix = i + ": " + new File(file.getParentFile().getName(), file.getName()) + ": ";
80 
81            if (comicImage.hasError()) {
82                logger.warn(prefix + comicImage.getError());
83            } else {
84                if (logger.isInfoEnabled()) {
85                    logger.info(prefix + comicImage.getWidth() + "x" + comicImage.getHeight());
86                }
87            }
88        }
89 
90        showComicInfoFrame(model);
91    }
92 
93    private void showComicInfoFrame(ComicModel model) {
94        ComicInfoPanel infoPane = new ComicInfoPanel();
95 
96        infoPane.setComicModel(model);
97        showFrame(infoPane, new Dimension(TestTools.FRAME_WIDTH, TestTools.FRAME_HEIGHT));
98        testTools.waitSomeTime();
99    }
100}

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