source: josm/trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java@ 17360

Last change on this file since 17360 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertFalse;
6import static org.junit.jupiter.api.Assertions.assertNull;
7
8import java.awt.Color;
9
10import org.junit.jupiter.api.extension.RegisterExtension;
11import org.junit.jupiter.api.Test;
12import org.openstreetmap.josm.TestUtils;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.gui.MapScaler.AccessibleMapScaler;
15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
16import org.openstreetmap.josm.testutils.JOSMTestRules;
17
18import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
20/**
21 * Unit tests of {@link MapScaler} class.
22 */
23class MapScalerTest {
24
25 /**
26 * Setup tests
27 */
28 @RegisterExtension
29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
30 public JOSMTestRules test = new JOSMTestRules().main().projection();
31
32 /**
33 * Unit test of {@link MapScaler#MapScaler}.
34 */
35 @Test
36 void testMapScaler() {
37 MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
38 assertEquals(Color.WHITE, MapScaler.getColor());
39 MapScaler ms = new MapScaler(MainApplication.getMap().mapView);
40 assertEquals("/MapView/Scaler", ms.helpTopic());
41 ms.paint(TestUtils.newGraphics());
42 AccessibleMapScaler ams = (AccessibleMapScaler) ms.getAccessibleContext();
43 assertEquals(1000.0, ams.getCurrentAccessibleValue().doubleValue(), 1e-3);
44 assertFalse(ams.setCurrentAccessibleValue(500));
45 assertNull(ams.getMinimumAccessibleValue());
46 assertNull(ams.getMaximumAccessibleValue());
47 }
48}
Note: See TracBrowser for help on using the repository browser.