1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer.gpx;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 |
|
---|
6 | import javax.swing.JLabel;
|
---|
7 | import javax.swing.JPanel;
|
---|
8 |
|
---|
9 | import org.junit.jupiter.api.Disabled;
|
---|
10 | import org.junit.jupiter.api.Test;
|
---|
11 | import org.openstreetmap.josm.TestUtils;
|
---|
12 | import org.openstreetmap.josm.gui.ExtendedDialog;
|
---|
13 | import org.openstreetmap.josm.gui.layer.GpxLayerTest;
|
---|
14 | import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link ChooseTrackVisibilityAction} class.
|
---|
18 | */
|
---|
19 | class ChooseTrackVisibilityActionTest {
|
---|
20 | /**
|
---|
21 | * Test action.
|
---|
22 | * @throws Exception if an error occurs
|
---|
23 | */
|
---|
24 | @Test
|
---|
25 | @Disabled("broken, see #16796")
|
---|
26 | void testAction() throws Exception {
|
---|
27 | TestUtils.assumeWorkingJMockit();
|
---|
28 | final ExtendedDialogMocker edMocker = new ExtendedDialogMocker() {
|
---|
29 | @Override
|
---|
30 | protected String getString(final ExtendedDialog instance) {
|
---|
31 | return ((JLabel) ((JPanel) instance.getContentPane().getComponent(0)).getComponent(2)).getText();
|
---|
32 | }
|
---|
33 | };
|
---|
34 | edMocker.getMockResultMap().put(
|
---|
35 | "<html>Select all tracks that you want to be displayed. " +
|
---|
36 | "You can drag select a range of tracks or use CTRL+Click to select specific ones. " +
|
---|
37 | "The map is updated live in the background. "+
|
---|
38 | "Open the URLs by double clicking them, edit name and description by double clicking the cell.</html>",
|
---|
39 | "Show all"
|
---|
40 | );
|
---|
41 |
|
---|
42 | new ChooseTrackVisibilityAction(GpxLayerTest.getMinimalGpxLayer()).actionPerformed(null);
|
---|
43 |
|
---|
44 | assertEquals(1, edMocker.getInvocationLog().size());
|
---|
45 | Object[] invocationLogEntry = edMocker.getInvocationLog().get(0);
|
---|
46 | assertEquals(2, (int) invocationLogEntry[0]);
|
---|
47 | assertEquals("Set track visibility for Bananas", invocationLogEntry[2]);
|
---|
48 | }
|
---|
49 | }
|
---|