Changeset 8899 in josm for trunk/test
- Timestamp:
- 2015-10-18T18:56:56+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
r8859 r8899 16 16 import org.openstreetmap.josm.data.osm.Node; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 18 19 import org.openstreetmap.josm.data.osm.Relation; 19 20 import org.openstreetmap.josm.data.osm.RelationData; 20 21 import org.openstreetmap.josm.data.osm.RelationMember; 22 import org.openstreetmap.josm.data.osm.User; 21 23 import org.openstreetmap.josm.data.osm.Way; 22 24 import org.openstreetmap.josm.data.osm.WayData; … … 325 327 } 326 328 } 329 330 /** 331 * Search for node objects. 332 * @throws ParseError if an error has been encountered while compiling 333 */ 334 @Test 335 public void testTypeNode() throws ParseError { 336 final SearchContext sc = new SearchContext("type:node"); 337 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { 338 sc.match(p, OsmPrimitiveType.NODE.equals(p.getType())); 339 } 340 } 341 342 /** 343 * Search for way objects. 344 * @throws ParseError if an error has been encountered while compiling 345 */ 346 @Test 347 public void testTypeWay() throws ParseError { 348 final SearchContext sc = new SearchContext("type:way"); 349 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { 350 sc.match(p, OsmPrimitiveType.WAY.equals(p.getType())); 351 } 352 } 353 354 /** 355 * Search for relation objects. 356 * @throws ParseError if an error has been encountered while compiling 357 */ 358 @Test 359 public void testTypeRelation() throws ParseError { 360 final SearchContext sc = new SearchContext("type:relation"); 361 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { 362 sc.match(p, OsmPrimitiveType.RELATION.equals(p.getType())); 363 } 364 } 365 366 /** 367 * Search for users. 368 * @throws ParseError if an error has been encountered while compiling 369 */ 370 @Test 371 public void testUser() throws ParseError { 372 final SearchContext foobar = new SearchContext("user:foobar"); 373 foobar.n1.setUser(User.createLocalUser("foobar")); 374 foobar.match(foobar.n1, true); 375 foobar.match(foobar.n2, false); 376 final SearchContext anonymous = new SearchContext("user:anonymous"); 377 anonymous.n1.setUser(User.createLocalUser("foobar")); 378 anonymous.match(anonymous.n1, false); 379 anonymous.match(anonymous.n2, true); 380 } 327 381 }
Note:
See TracChangeset
for help on using the changeset viewer.