1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.conflict.tags;
|
---|
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.assertNotNull;
|
---|
7 | import static org.junit.jupiter.api.Assertions.assertNull;
|
---|
8 |
|
---|
9 | import java.awt.Insets;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
12 | import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo;
|
---|
13 | import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfoTable;
|
---|
14 | import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsTableModel;
|
---|
15 | import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
---|
16 |
|
---|
17 | import org.junit.jupiter.api.Test;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Unit tests of {@link PasteTagsConflictResolverDialog} class.
|
---|
21 | */
|
---|
22 | // Needed to due to OSM primitive dependencies
|
---|
23 | @BasicPreferences
|
---|
24 | class PasteTagsConflictResolverDialogTest {
|
---|
25 | /**
|
---|
26 | * Unit test of {@link PasteTagsConflictResolverDialog#PANE_TITLES}.
|
---|
27 | */
|
---|
28 | @Test
|
---|
29 | void testPaneTitles() {
|
---|
30 | assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES);
|
---|
31 | assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE));
|
---|
32 | assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.WAY));
|
---|
33 | assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.RELATION));
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Unit test of {@link PasteTagsConflictResolverDialog.StatisticsInfoTable} class.
|
---|
38 | */
|
---|
39 | @Test
|
---|
40 | void testStatisticsInfoTable() {
|
---|
41 | StatisticsInfo info = new StatisticsInfo();
|
---|
42 | StatisticsTableModel model = new StatisticsTableModel();
|
---|
43 | assertFalse(model.isCellEditable(0, 0));
|
---|
44 | assertEquals(1, model.getRowCount());
|
---|
45 | model.append(info);
|
---|
46 | assertEquals(2, model.getRowCount());
|
---|
47 | assertEquals("Paste ...", model.getValueAt(0, 0));
|
---|
48 | assertEquals(info, model.getValueAt(1, 0));
|
---|
49 | assertNull(model.getValueAt(2, 0));
|
---|
50 | model.reset();
|
---|
51 | assertEquals(1, model.getRowCount());
|
---|
52 | assertEquals(new Insets(0, 0, 20, 0), new StatisticsInfoTable(model).getInsets());
|
---|
53 | }
|
---|
54 | }
|
---|