Changeset 15102 in josm for trunk/test/unit
- Timestamp:
- 2019-05-21T10:04:36+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java
r15034 r15102 187 187 } 188 188 189 /** 190 * Test inside/contains selectors (spatial test) 191 */ 189 192 @Test 190 193 public void testContains() throws Exception { 191 194 ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get("data_nodist/amenity-in-amenity.osm")), null); 192 195 ChildOrParentSelector css = parse("node[tag(\"amenity\") = parent_tag(\"amenity\")] ∈ *[amenity] {}"); 196 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.NODE)))); 193 197 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.WAY)))); 194 198 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.RELATION)))); 199 css = parse("node[tag(\"amenity\") = parent_tag(\"amenity\")] ⊆ *[amenity] {}"); 200 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.NODE)))); 201 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.WAY)))); 202 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.RELATION)))); 203 css = parse("node[tag(\"amenity\") = parent_tag(\"amenity\")] ⊈ *[amenity] {}"); 204 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.NODE)))); 205 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.WAY)))); 206 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.RELATION)))); 207 css = parse("*[tag(\"amenity\") = parent_tag(\"amenity\")] ⊇ *[amenity] {}"); 208 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.NODE)))); 209 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.WAY)))); 210 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.RELATION)))); 211 css = parse("*[tag(\"amenity\") = parent_tag(\"amenity\")] ⊉ *[amenity] {}"); 212 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.NODE)))); 213 assertFalse(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.WAY)))); 214 assertTrue(css.matches(new Environment(ds.getPrimitiveById(123, OsmPrimitiveType.RELATION)))); 195 215 } 196 216 }
Note:
See TracChangeset
for help on using the changeset viewer.