- Timestamp:
- 2006-09-30T19:05:43+02:00 (18 years ago)
- Location:
- test/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r135 r143 11 11 import org.openstreetmap.josm.data.osm.Segment; 12 12 import org.openstreetmap.josm.data.osm.Way; 13 import org.openstreetmap.josm.data.osm.visitor.MergeVisitor;14 13 import org.openstreetmap.josm.testframework.Bug; 15 14 import org.openstreetmap.josm.testframework.DataSetTestCaseHelper; … … 267 266 /** 268 267 * Deleted segments should be deleted when merged over unchanged segments. 269 * Deleted segments should also raise an conflict when merged over changed segments. 270 */ 271 //TODO 272 268 */ 269 public void testMergeDeletedOverUnchangedDeletes() { 270 DataSet ds = new DataSet(); 271 Segment oldSegment = createSegment(ds, false, false, 23); 272 Segment s = createSegment(null, false, true, 23); 273 274 MergeVisitor v = new MergeVisitor(ds); 275 v.visit(s); 276 v.fixReferences(); 277 278 assertEquals(true, oldSegment.deleted); 279 } 280 281 282 /** 283 * Deleted segments should raise an conflict when merged over changed segments. 284 */ 285 public void testMergeDeletedOverChangedConflict() { 286 DataSet ds = new DataSet(); 287 createSegment(ds, false, false, 23).modified = true; 288 Segment s = createSegment(null, false, true, 23); 289 290 MergeVisitor v = new MergeVisitor(ds); 291 v.visit(s); 292 v.fixReferences(); 293 294 assertEquals(1, v.conflicts.size()); 295 } 296 297 298 private Segment createSegment(DataSet ds, boolean incomplete, boolean deleted, int id) { 299 Node n1 = DataSetTestCaseHelper.createNode(ds); 300 Node n2 = DataSetTestCaseHelper.createNode(ds); 301 Segment s = DataSetTestCaseHelper.createSegment(ds, n1, n2); 302 s.incomplete = incomplete; 303 s.id = id; 304 s.deleted = deleted; 305 return s; 306 } 307 273 308 /** 274 309 * Create that amount of nodes and add them to the dataset. The id will be 1,2,3,4... -
test/org/openstreetmap/josm/testframework/DataSetTestCaseHelper.java
r135 r143 44 44 Way t = new Way(); 45 45 t.segments.addAll(Arrays.asList(segments)); 46 ds.ways.add(t); 46 if (ds != null) 47 ds.ways.add(t); 47 48 return t; 48 49 } … … 53 54 public static Segment createSegment(DataSet ds, Node n1, Node n2) { 54 55 Segment ls = new Segment(n1, n2); 55 ds.segments.add(ls); 56 if (ds != null) 57 ds.segments.add(ls); 56 58 return ls; 57 59 }
Note:
See TracChangeset
for help on using the changeset viewer.