1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.hamcrest.CoreMatchers.is;
|
---|
5 | import static org.junit.Assert.assertThat;
|
---|
6 |
|
---|
7 | import java.awt.Transparency;
|
---|
8 | import java.io.File;
|
---|
9 | import java.io.IOException;
|
---|
10 |
|
---|
11 | import org.junit.Test;
|
---|
12 | import org.openstreetmap.josm.TestUtils;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Unit tests of {@link ImageProvider} class.
|
---|
16 | */
|
---|
17 | public class ImageProviderTest {
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/9984">#9984</a>
|
---|
21 | * @throws IOException if an error occurs during reading
|
---|
22 | */
|
---|
23 | @Test
|
---|
24 | public void testTicket9984() throws IOException {
|
---|
25 | File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png"));
|
---|
26 | assertThat(ImageProvider.read(file, true, true).getTransparency(), is(Transparency.TRANSLUCENT));
|
---|
27 | assertThat(ImageProvider.read(file, false, true).getTransparency(), is(Transparency.TRANSLUCENT));
|
---|
28 | assertThat(ImageProvider.read(file, false, false).getTransparency(), is(Transparency.OPAQUE));
|
---|
29 | assertThat(ImageProvider.read(file, true, false).getTransparency(), is(Transparency.OPAQUE));
|
---|
30 | }
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/10030">#10030</a>
|
---|
34 | * @throws IOException if an error occurs during reading
|
---|
35 | */
|
---|
36 | @Test
|
---|
37 | public void testTicket10030() throws IOException {
|
---|
38 | File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg"));
|
---|
39 | ImageProvider.read(file, true, true);
|
---|
40 | }
|
---|
41 | }
|
---|