source: josm/trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java@ 8876

Last change on this file since 8876 was 8857, checked in by Don-vip, 9 years ago

improve/cleanup unit tests

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNotNull;
6
7import java.awt.Transparency;
8import java.awt.image.BufferedImage;
9import java.io.File;
10import java.io.IOException;
11
12import org.junit.Test;
13import org.openstreetmap.josm.TestUtils;
14
15/**
16 * Unit tests of {@link ImageProvider} class.
17 */
18public class ImageProviderTest {
19
20 /**
21 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/9984">#9984</a>
22 * @throws IOException if an error occurs during reading
23 */
24 @Test
25 public void testTicket9984() throws IOException {
26 File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png"));
27 assertEquals(Transparency.TRANSLUCENT, ImageProvider.read(file, true, true).getTransparency());
28 assertEquals(Transparency.TRANSLUCENT, ImageProvider.read(file, false, true).getTransparency());
29 assertEquals(Transparency.OPAQUE, ImageProvider.read(file, false, false).getTransparency());
30 assertEquals(Transparency.OPAQUE, ImageProvider.read(file, true, false).getTransparency());
31 }
32
33 /**
34 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/10030">#10030</a>
35 * @throws IOException if an error occurs during reading
36 */
37 @Test
38 public void testTicket10030() throws IOException {
39 File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg"));
40 BufferedImage img = ImageProvider.read(file, true, true);
41 assertNotNull(img);
42 }
43}
Note: See TracBrowser for help on using the repository browser.