1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 | import static org.junit.Assert.assertFalse;
|
---|
6 | import static org.junit.Assert.assertNull;
|
---|
7 |
|
---|
8 | import java.awt.Color;
|
---|
9 |
|
---|
10 | import org.junit.BeforeClass;
|
---|
11 | import org.junit.Test;
|
---|
12 | import org.openstreetmap.josm.JOSMFixture;
|
---|
13 | import org.openstreetmap.josm.Main;
|
---|
14 | import org.openstreetmap.josm.TestUtils;
|
---|
15 | import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Unit tests of {@link MapScaler} class.
|
---|
19 | */
|
---|
20 | public class MapScalerTest {
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Setup tests
|
---|
24 | */
|
---|
25 | @BeforeClass
|
---|
26 | public static void setUpBeforeClass() {
|
---|
27 | JOSMFixture.createUnitTestFixture().init(true);
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Unit test of {@link MapScaler#MapScaler}.
|
---|
32 | */
|
---|
33 | @Test
|
---|
34 | public void testMapScaler() {
|
---|
35 | assertEquals(Color.WHITE, MapScaler.getColor());
|
---|
36 | MapScaler ms = new MapScaler(Main.map.mapView);
|
---|
37 | assertEquals("/MapView/Scaler", ms.helpTopic());
|
---|
38 | ms.paint(TestUtils.newGraphics());
|
---|
39 | AccessibleMapScaler ams = (AccessibleMapScaler) ms.getAccessibleContext();
|
---|
40 | assertEquals(1000.0, ams.getCurrentAccessibleValue().doubleValue(), 1e-3);
|
---|
41 | assertFalse(ams.setCurrentAccessibleValue(500));
|
---|
42 | assertNull(ams.getMinimumAccessibleValue());
|
---|
43 | assertNull(ams.getMaximumAccessibleValue());
|
---|
44 | }
|
---|
45 | }
|
---|