- Timestamp:
- 2007-02-17T17:09:49+01:00 (18 years ago)
- Location:
- test/org/openstreetmap/josm/data
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
test/org/openstreetmap/josm/data/osm/DataSetTest.java
r146 r203 77 77 public void testFireSelectionChanged() { 78 78 TestSelectionChangeListener l = new TestSelectionChangeListener(); 79 ds. addSelectionChangedListener(l);79 ds.listeners.add(l); 80 80 ds.setSelected(segment); 81 81 assertNotNull(l.called); … … 84 84 } 85 85 86 public void testAddRemoveSelectionChangedListener() {87 TestSelectionChangeListener l = new TestSelectionChangeListener();88 ds.addSelectionChangedListener(l);89 ds.removeSelectionChangedListener(l);90 ds.setSelected(way);91 assertNull(l.called);92 }93 94 86 public void testAddAllSelectionListener() { 95 87 DataSet ds2 = new DataSet(); 96 88 TestSelectionChangeListener l1 = new TestSelectionChangeListener(); 97 89 TestSelectionChangeListener l2 = new TestSelectionChangeListener(); 98 ds2. addSelectionChangedListener(l1);99 ds2. addSelectionChangedListener(l2);100 ds. addAllSelectionListener(ds2);101 ds2. removeSelectionChangedListener(l1);90 ds2.listeners.add(l1); 91 ds2.listeners.add(l2); 92 ds.listeners.addAll(ds2.listeners); 93 ds2.listeners.remove(l1); 102 94 ds.setSelected(node2); 103 95 assertNotNull(l1.called); 104 96 assertNotNull(l2.called); 105 97 } 106 107 public void testRealEqual() {108 Collection<OsmPrimitive> all = new LinkedList<OsmPrimitive>();109 all.add(new Node(node1));110 all.add(new Node(node2));111 all.add(new Node(node3));112 all.add(createSegment(segment.id, node1, node2));113 all.add(createWay(way.id, way.segments.iterator().next()));114 assertTrue(ds.realEqual(all));115 }116 98 } -
test/org/openstreetmap/josm/data/osm/NodeTest.java
r146 r203 21 21 public void testCloneFromRealEqual() { 22 22 Node node2 = createNode(23,3,4); 23 assertFalse(node2.realEqual(node ));24 assertFalse(node.realEqual(node2 ));23 assertFalse(node2.realEqual(node, false)); 24 assertFalse(node.realEqual(node2, false)); 25 25 node.cloneFrom(node2); 26 assertTrue(node2.realEqual(node ));27 assertTrue(node.realEqual(node2 ));26 assertTrue(node2.realEqual(node, false)); 27 assertTrue(node.realEqual(node2, false)); 28 28 } 29 29 30 30 public void testNodeNode() { 31 31 Node node2 = new Node(node); 32 assertTrue(node2.realEqual(node ));32 assertTrue(node2.realEqual(node, false)); 33 33 } 34 34 -
test/org/openstreetmap/josm/data/osm/SegmentTest.java
r146 r203 21 21 Segment s2 = createSegment(23, createNode(1,2,3), createNode(2,3,4)); 22 22 segment.cloneFrom(s2); 23 assertTrue(segment.realEqual(s2 ));24 assertTrue(s2.realEqual(segment ));23 assertTrue(segment.realEqual(s2, false)); 24 assertTrue(s2.realEqual(segment, false)); 25 25 assertSame(segment.from, s2.from); 26 26 assertSame(segment.to, s2.to); … … 29 29 public void testSegmentSegment() { 30 30 Segment s = new Segment(segment); 31 assertTrue(s.realEqual(segment ));31 assertTrue(s.realEqual(segment, false)); 32 32 } 33 33 -
test/org/openstreetmap/josm/data/osm/WayTest.java
r146 r203 21 21 Way w2 = createWay(42); 22 22 way.cloneFrom(w2); 23 assertTrue(way.realEqual(w2 ));23 assertTrue(way.realEqual(w2, false)); 24 24 assertEquals(w2.segments.size(), way.segments.size()); 25 25 } … … 28 28 Way w = new Way(way); 29 29 assertEquals(way.id, w.id); 30 assertTrue(way.realEqual(w ));30 assertTrue(way.realEqual(w, false)); 31 31 } 32 32 -
test/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r198 r203 197 197 s2.timestamp = new Date(); 198 198 v.visit(s2); 199 assertTrue(s1.realEqual(s2 ));199 assertTrue(s1.realEqual(s2, false)); 200 200 } 201 201 /** … … 312 312 assertEquals(1, ds.segments.size()); 313 313 } 314 314 315 /** 316 * The merger should auto-resolve items, that have not changed but are marked as 317 * changed. In the case where an unmodified newer item is merged over an modified 318 * older, the modified-flag should be removed and the newer timestamp is used. 319 */ 320 public void testMergeModifiedWithOlderTimestampOverUnmodifiedNewerDoesNotConflict() throws Exception { 321 DataSet ds = new DataSet(); 322 323 Node oldNode = createNodes(ds, 1)[0]; 324 oldNode.modified = true; 325 oldNode.timestamp = new Date(); 326 327 Node newNode = new Node(oldNode); 328 Date date = new Date(oldNode.timestamp.getTime()+10000); 329 newNode.modified = false; 330 newNode.timestamp = new Date(date.getTime()); 331 332 MergeVisitor v = new MergeVisitor(ds); 333 v.visit(newNode); 334 335 assertEquals(0, v.conflicts.size()); 336 assertEquals(date, ds.nodes.iterator().next().timestamp); 337 assertFalse(ds.nodes.iterator().next().modified); 338 } 315 339 }
Note:
See TracChangeset
for help on using the changeset viewer.