Changeset 6801 in josm for trunk/test/unit/org/openstreetmap/josm
- Timestamp:
- 2014-02-02T20:13:06+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
r6776 r6801 175 175 176 176 APIDataSet apiDataSet = new APIDataSet(); 177 apiDataSet.init(ds); 177 // add r1 first to test functionality of APIDataSet#adjustRelationUploadOrder() 178 apiDataSet.getPrimitivesToDelete().add(r1); 179 apiDataSet.getPrimitivesToDelete().add(r2); 180 apiDataSet.getPrimitivesToDelete().add(r3); 181 apiDataSet.getPrimitivesToDelete().add(r4); 178 182 try { 179 183 apiDataSet.adjustRelationUploadOrder(); … … 186 190 assertEquals(true, toDelete.indexOf(r2) < toDelete.indexOf(r1)); 187 191 assertEquals(true, toDelete.indexOf(r3) < toDelete.indexOf(r1)); 188 assertEquals(true, toDelete.indexOf(r3) < toDelete.indexOf(r1)); 192 } 193 194 @Test // for ticket #9656 195 public void deleteWay() { 196 DataSet ds = new DataSet(); 197 final Way way = new Way(1, 2); 198 way.put("highway", "unclassified"); 199 ds.addPrimitive(way); 200 201 final Node n1 = new Node(2); 202 ds.addPrimitive(n1); 203 way.addNode(n1); 204 205 final Node n2 = new Node(3); 206 ds.addPrimitive(n2); 207 way.addNode(n2); 208 209 Relation r1 = new Relation(4, 2); 210 ds.addPrimitive(r1); 211 r1.put("name", "r1"); 212 r1.addMember(new RelationMember("foo", way)); 213 214 215 r1.setDeleted(true); 216 way.setDeleted(true); 217 n1.setDeleted(true); 218 n2.setDeleted(true); 219 220 APIDataSet apiDataSet = new APIDataSet(); 221 apiDataSet.init(ds); 222 try { 223 apiDataSet.adjustRelationUploadOrder(); 224 } catch (CyclicUploadDependencyException e) { 225 fail("unexpected exception:" + e); 226 } 227 List<OsmPrimitive> toDelete = apiDataSet.getPrimitivesToDelete(); 228 229 assertEquals(4, toDelete.size()); 230 assertEquals(true, toDelete.indexOf(way) < toDelete.indexOf(n1)); 231 assertEquals(true, toDelete.indexOf(way) < toDelete.indexOf(n2)); 232 assertEquals(true, toDelete.indexOf(r1) < toDelete.indexOf(way)); 189 233 } 190 234
Note:
See TracChangeset
for help on using the changeset viewer.