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

COVERAGE SUMMARY FOR SOURCE FILE [ComicThumbViewTest.java]

nameclass, %method, %block, %line, %
ComicThumbViewTest.java100% (1/1)86%  (6/7)78%  (130/167)89%  (35.5/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComicThumbViewTest100% (1/1)86%  (6/7)78%  (130/167)89%  (35.5/40)
valueChanged (ListSelectionEvent): void 0%   (0/1)0%   (0/24)0%   (0/4)
setUp (): void 100% (1/1)78%  (18/23)96%  (5.8/6)
<static initializer> 100% (1/1)80%  (12/15)80%  (0.8/1)
testComicThumbView (): void 100% (1/1)91%  (51/56)99%  (14.9/15)
ComicThumbViewTest (): void 100% (1/1)100% (3/3)100% (1/1)
tearDown (): void 100% (1/1)100% (12/12)100% (5/5)
testImageTest (): void 100% (1/1)100% (34/34)100% (9/9)

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.image.RenderedImage;
19import java.io.File;
20import java.io.IOException;
21 
22import javax.swing.event.ListSelectionEvent;
23import javax.swing.event.ListSelectionListener;
24 
25import junit.extensions.abbot.ComponentTestFixture;
26import net.sf.jomic.common.Settings;
27import net.sf.jomic.tools.TestTools;
28import net.sf.wraplog.Logger;
29 
30/**
31 *  TestCase for ComicThumbView.
32 */
33public class ComicThumbViewTest extends ComponentTestFixture implements ListSelectionListener
34{
35    private Logger logger;
36    private Settings settings;
37    private TestTools testTools;
38 
39    protected void setUp()
40        throws Exception {
41        super.setUp();
42        testTools = TestTools.instance();
43        testTools.setupCache();
44        logger = Logger.getLogger(ComicThumbViewTest.class);
45        settings = Settings.instance();
46    }
47 
48    public void testComicThumbView()
49        throws IOException, InterruptedException {
50 
51        File comicFile = testTools.getTestComicFile();
52        ComicModel comic = new ComicModel(comicFile);
53        ComicThumbView thumbView = new ComicThumbView();
54 
55        thumbView.addListSelectionListener(this);
56        try {
57            thumbView.setOpaque(true);
58            thumbView.setBackground(settings.getFillColor());
59            thumbView.setComic(comic);
60            showFrame(thumbView);
61 
62            assertEquals(0, thumbView.getThumbIndexAtOrAfterY(0));
63            assertEquals(0, thumbView.getThumbIndexAtOrAfterY(1));
64 
65            testTools.waitSomeTime();
66            thumbView.setComic(null);
67        } finally {
68            thumbView.dispose();
69        }
70    }
71 
72    public void testImageTest()
73        throws IOException, InterruptedException {
74        ComicCache comicCache = ComicCache.instance();
75        File comicFile = testTools.getTestComicFile();
76        ComicModel comic = new ComicModel(comicFile);
77 
78        for (int i = 0; i < comic.getImageCount(); i += 1) {
79            ComicImage comicImage = comic.getComicImage(i);
80            File imageFile = comicImage.getFile();
81            RenderedImage image = comicCache.getImage(imageFile);
82 
83            assertNotNull("image", image);
84        }
85    }
86 
87    public void valueChanged(ListSelectionEvent event) {
88        assert event != null;
89        if (logger.isInfoEnabled()) {
90            logger.info("selection changed: " + event);
91        }
92    }
93 
94    protected void tearDown()
95        throws Exception {
96        settings = null;
97        testTools = null;
98        logger = null;
99        super.tearDown();
100    }
101 
102}

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