source: josm/trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java@ 11241

Last change on this file since 11241 was 10962, checked in by Don-vip, 8 years ago

improve unit tests

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNotNull;
6
7import java.awt.Color;
8import java.awt.image.BufferedImage;
9
10import org.junit.Rule;
11import org.junit.Test;
12import org.openstreetmap.josm.Main;
13import org.openstreetmap.josm.data.coor.LatLon;
14import org.openstreetmap.josm.data.osm.Node;
15import org.openstreetmap.josm.data.osm.Relation;
16import org.openstreetmap.josm.data.osm.RelationMember;
17import org.openstreetmap.josm.data.osm.Way;
18import org.openstreetmap.josm.gui.dialogs.ConflictDialog.ConflictPainter;
19import org.openstreetmap.josm.testutils.JOSMTestRules;
20
21import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
22
23/**
24 * Unit tests of {@link ConflictDialog} class.
25 */
26public class ConflictDialogTest {
27
28 /**
29 * Setup tests
30 */
31 @Rule
32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
33 public JOSMTestRules test = new JOSMTestRules().platform().commands();
34
35 /**
36 * Unit test of {@link ConflictDialog#ConflictDialog}.
37 */
38 @Test
39 public void testConflictDialog() {
40 assertNotNull(new ConflictDialog());
41 }
42
43 /**
44 * Unit test of {@link ConflictDialog#getColor} method.
45 */
46 @Test
47 public void testGetColor() {
48 assertEquals(Color.gray, ConflictDialog.getColor());
49 }
50
51 /**
52 * Unit tests of {@link ConflictPainter} class.
53 */
54 @Test
55 public void testConflictPainter() {
56 ConflictPainter cp = new ConflictPainter(Main.map.mapView, new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
57 Node n1 = new Node(1, 1);
58 n1.setCoor(new LatLon(1, 1));
59 Node n2 = new Node(2, 1);
60 n2.setCoor(new LatLon(2, 2));
61 Way w = new Way(1, 1);
62 w.addNode(n1);
63 w.addNode(n2);
64 Relation r = new Relation(1, 1);
65 r.addMember(new RelationMember("outer", w));
66 cp.visit(n1);
67 cp.visit(n2);
68 cp.visit(w);
69 cp.visit(r);
70 }
71}
Note: See TracBrowser for help on using the repository browser.