1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.bbox;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
---|
6 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
---|
7 |
|
---|
8 | import org.junit.jupiter.api.extension.RegisterExtension;
|
---|
9 | import org.junit.jupiter.api.Test;
|
---|
10 | import org.openstreetmap.josm.TestUtils;
|
---|
11 | import org.openstreetmap.josm.gui.bbox.SizeButton.AccessibleSizeButton;
|
---|
12 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
13 |
|
---|
14 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link SizeButton} class.
|
---|
18 | */
|
---|
19 | class SizeButtonTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Setup tests
|
---|
23 | */
|
---|
24 | @RegisterExtension
|
---|
25 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
26 | public JOSMTestRules test = new JOSMTestRules().preferences();
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Unit test of {@link SizeButton#SizeButton}.
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | void testSizeButton() {
|
---|
33 | SizeButton sb = new SizeButton(new SlippyMapBBoxChooser());
|
---|
34 | sb.paint(TestUtils.newGraphics());
|
---|
35 | AccessibleSizeButton asb = (AccessibleSizeButton) sb.getAccessibleContext();
|
---|
36 | assertEquals(1, asb.getAccessibleActionCount());
|
---|
37 | assertEquals("toggle", asb.getAccessibleActionDescription(0));
|
---|
38 | assertFalse(sb.isEnlarged());
|
---|
39 | assertTrue(asb.doAccessibleAction(0));
|
---|
40 | sb.paint(TestUtils.newGraphics());
|
---|
41 | assertTrue(sb.isEnlarged());
|
---|
42 | }
|
---|
43 | }
|
---|