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

COVERAGE SUMMARY FOR SOURCE FILE [ImageCacheRenderThreadTest.java]

nameclass, %method, %block, %line, %
ImageCacheRenderThreadTest.java100% (1/1)100% (7/7)100% (99/99)100% (32/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImageCacheRenderThreadTest100% (1/1)100% (7/7)100% (99/99)100% (32/32)
ImageCacheRenderThreadTest (): void 100% (1/1)100% (3/3)100% (1/1)
imageCached (File): void 100% (1/1)100% (1/1)100% (1/1)
setUp (): void 100% (1/1)100% (9/9)100% (4/4)
tearDown (): void 100% (1/1)100% (6/6)100% (3/3)
testDisposeEmpty (): void 100% (1/1)100% (13/13)100% (5/5)
testDisposeNonEmpty (): void 100% (1/1)100% (36/36)100% (8/8)
testRenderAndDispose (): void 100% (1/1)100% (31/31)100% (10/10)

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.tools;
17 
18import java.io.File;
19 
20import junit.framework.TestCase;
21import net.sf.jomic.comic.ComicCache;
22 
23/**
24 *  TestCase for ImageCacheRenderThread.
25 *
26 * @author    Thomas Aglassinger
27 */
28public class ImageCacheRenderThreadTest extends TestCase implements ImageInCacheListener, StandardConstants
29{
30    private TestTools testTools;
31 
32    /*
33     *  (non-Javadoc)
34     *  @see junit.framework.TestCase#setUp()
35     */
36    protected void setUp()
37        throws Exception {
38        super.setUp();
39        testTools = TestTools.instance();
40        testTools.setupCache();
41    }
42 
43    public void imageCached(File imageFile) {
44        // TODO Auto-generated method stub
45 
46    }
47 
48    public void testDisposeEmpty() {
49        ComicCache cache = ComicCache.instance();
50        ImageCacheRenderThread renderer = new ImageCacheRenderThread(cache.getImageCache());
51 
52        renderer.start();
53        renderer.dispose();
54    }
55 
56    public void testDisposeNonEmpty() {
57        ComicCache cache = ComicCache.instance();
58        ImageCacheRenderThread renderer = new ImageCacheRenderThread(cache.getImageCache());
59 
60        renderer.start();
61        renderer.addTask(testTools.getTestImageFile(), this,
62                ImageCacheRenderThread.PRIORITY_SOMETIMES);
63        renderer.addTask(testTools.getTestGeneratedInputFile("02.png"), this,
64                ImageCacheRenderThread.PRIORITY_SOMETIMES);
65        renderer.addTask(testTools.getTestGeneratedInputFile("03.png"), this,
66                ImageCacheRenderThread.PRIORITY_SOMETIMES);
67        renderer.dispose();
68    }
69 
70    public void testRenderAndDispose()
71        throws InterruptedException {
72        ComicCache cache = ComicCache.instance();
73        ImageCache imageCache = cache.getImageCache();
74        ImageCacheRenderThread renderer = new ImageCacheRenderThread(imageCache);
75 
76        renderer.start();
77 
78        File imageFile = testTools.getTestImageFile();
79 
80        renderer.addTask(imageFile, this, ImageCacheRenderThread.PRIORITY_SOMETIMES);
81        while (!imageCache.has(imageFile)) {
82            Thread.sleep(TICK);
83        }
84        renderer.dispose();
85    }
86 
87 
88    /*
89     *  (non-Javadoc)
90     *  @see junit.framework.TestCase#tearDown()
91     */
92    protected void tearDown()
93        throws Exception {
94        testTools = null;
95        super.tearDown();
96    }
97 
98}

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