[9666] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.gui.dialogs;
|
---|
| 3 |
|
---|
| 4 | import static org.junit.Assert.assertEquals;
|
---|
| 5 | import static org.junit.Assert.assertNotNull;
|
---|
| 6 |
|
---|
| 7 | import java.awt.Color;
|
---|
| 8 | import java.awt.image.BufferedImage;
|
---|
| 9 |
|
---|
[10962] | 10 | import org.junit.Rule;
|
---|
[9666] | 11 | import org.junit.Test;
|
---|
| 12 | import org.openstreetmap.josm.Main;
|
---|
| 13 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
[12564] | 14 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
[9666] | 15 | import org.openstreetmap.josm.data.osm.Node;
|
---|
| 16 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
| 17 | import org.openstreetmap.josm.data.osm.RelationMember;
|
---|
| 18 | import org.openstreetmap.josm.data.osm.Way;
|
---|
[12630] | 19 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
[9666] | 20 | import org.openstreetmap.josm.gui.dialogs.ConflictDialog.ConflictPainter;
|
---|
[12564] | 21 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
[10962] | 22 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
[9666] | 23 |
|
---|
[10962] | 24 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
| 25 |
|
---|
[9666] | 26 | /**
|
---|
| 27 | * Unit tests of {@link ConflictDialog} class.
|
---|
| 28 | */
|
---|
| 29 | public class ConflictDialogTest {
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * Setup tests
|
---|
| 33 | */
|
---|
[10962] | 34 | @Rule
|
---|
| 35 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
[12564] | 36 | public JOSMTestRules test = new JOSMTestRules().mainMenu().platform().projection();
|
---|
[9666] | 37 |
|
---|
| 38 | /**
|
---|
| 39 | * Unit test of {@link ConflictDialog#ConflictDialog}.
|
---|
| 40 | */
|
---|
| 41 | @Test
|
---|
| 42 | public void testConflictDialog() {
|
---|
| 43 | assertNotNull(new ConflictDialog());
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * Unit test of {@link ConflictDialog#getColor} method.
|
---|
| 48 | */
|
---|
| 49 | @Test
|
---|
| 50 | public void testGetColor() {
|
---|
| 51 | assertEquals(Color.gray, ConflictDialog.getColor());
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | * Unit tests of {@link ConflictPainter} class.
|
---|
| 56 | */
|
---|
| 57 | @Test
|
---|
| 58 | public void testConflictPainter() {
|
---|
[12564] | 59 | Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
|
---|
[12630] | 60 | ConflictPainter cp = new ConflictPainter(MainApplication.getMap().mapView,
|
---|
| 61 | new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
|
---|
[9666] | 62 | Node n1 = new Node(1, 1);
|
---|
| 63 | n1.setCoor(new LatLon(1, 1));
|
---|
| 64 | Node n2 = new Node(2, 1);
|
---|
| 65 | n2.setCoor(new LatLon(2, 2));
|
---|
| 66 | Way w = new Way(1, 1);
|
---|
| 67 | w.addNode(n1);
|
---|
| 68 | w.addNode(n2);
|
---|
| 69 | Relation r = new Relation(1, 1);
|
---|
| 70 | r.addMember(new RelationMember("outer", w));
|
---|
| 71 | cp.visit(n1);
|
---|
| 72 | cp.visit(n2);
|
---|
| 73 | cp.visit(w);
|
---|
| 74 | cp.visit(r);
|
---|
| 75 | }
|
---|
| 76 | }
|
---|