1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 | import static org.junit.Assert.assertNotNull;
|
---|
6 |
|
---|
7 | import java.awt.Transparency;
|
---|
8 | import java.awt.image.BufferedImage;
|
---|
9 | import java.io.File;
|
---|
10 | import java.io.IOException;
|
---|
11 |
|
---|
12 | import org.junit.Test;
|
---|
13 | import org.openstreetmap.josm.TestUtils;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Unit tests of {@link ImageProvider} class.
|
---|
17 | */
|
---|
18 | public 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 | }
|
---|