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

COVERAGE SUMMARY FOR SOURCE FILE [ToolsTest.java]

nameclass, %method, %block, %line, %
ToolsTest.java100% (1/1)100% (10/10)88%  (118/134)96%  (24.1/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ToolsTest100% (1/1)100% (10/10)88%  (118/134)96%  (24.1/25)
testCreateGrayTestImage (): void 100% (1/1)71%  (12/17)90%  (2.7/3)
testDifferentImageDeltaFrame (): void 100% (1/1)71%  (12/17)85%  (1.7/2)
testSameImageDeltaFrame (): void 100% (1/1)71%  (12/17)85%  (1.7/2)
testCreateGolorTestImage (): void 100% (1/1)94%  (16/17)98%  (2.9/3)
ToolsTest (): void 100% (1/1)100% (3/3)100% (1/1)
createColorImage (): RenderedImage 100% (1/1)100% (9/9)100% (1/1)
createGrayImage (): RenderedImage 100% (1/1)100% (9/9)100% (1/1)
setUp (): void 100% (1/1)100% (6/6)100% (3/3)
tearDown (): void 100% (1/1)100% (4/4)100% (2/2)
testImagesAreEqual (): void 100% (1/1)100% (35/35)100% (7/7)

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.jaiunit;
17 
18import java.awt.image.BufferedImage;
19import java.awt.image.RenderedImage;
20 
21import junit.framework.TestCase;
22import net.sf.jomic.tools.TestTools;
23 
24/**
25 *  TestCase for Tools.
26 *
27 * @author    Thomas Aglassinger
28 */
29public class ToolsTest extends TestCase
30{
31    private static final int IMAGE_HEIGHT = 480;
32    private static final int IMAGE_WIDTH = 640;
33    private Tools tools;
34 
35    /*
36     *  (non-Javadoc)
37     *  @see junit.framework.TestCase#setUp()
38     */
39    protected void setUp()
40        throws Exception {
41        TestTools.instance();
42        tools = Tools.instance();
43    }
44 
45    public void testCreateGolorTestImage() {
46        RenderedImage image = createColorImage();
47 
48        tools.showImage(image, ToolsTest.class, "testCreateGolorTestImage");
49    }
50 
51    public void testCreateGrayTestImage() {
52        RenderedImage image = createGrayImage();
53 
54        tools.showImage(image, ToolsTest.class, "testCreateGrayTestImage");
55    }
56 
57    public void testDifferentImageDeltaFrame() {
58        tools.showDeltaImage(createColorImage(), createGrayImage(), ToolsTest.class, "testDifferentImageDeltaFrame");
59    }
60 
61    public void testImagesAreEqual() {
62        RenderedImage color = createColorImage();
63        RenderedImage gray = createGrayImage();
64 
65        assertEquals(true, tools.imagesAreEqual(color, color));
66        assertEquals(false, tools.imagesAreEqual(color, gray));
67        assertEquals(false, tools.imagesAreEqual(gray, color));
68        assertEquals(true, tools.imagesAreEqual(gray, gray));
69 
70    }
71 
72    public void testSameImageDeltaFrame() {
73        tools.showDeltaImage(createColorImage(), createColorImage(), ToolsTest.class, "testSameImageDeltaFrame");
74    }
75 
76    /*
77     *  (non-Javadoc)
78     *  @see junit.framework.TestCase#tearDown()
79     */
80    protected void tearDown()
81        throws Exception {
82        tools = null;
83    }
84 
85    private RenderedImage createColorImage() {
86        return tools.createTestImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB, "test", "color image");
87    }
88 
89    private RenderedImage createGrayImage() {
90        return tools.createTestImage(IMAGE_WIDTH, 480, BufferedImage.TYPE_BYTE_GRAY, "test", "gray scale image");
91    }
92 
93}

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