Changeset 8874 in josm for trunk/test/unit/org
- Timestamp:
- 2015-10-14T22:56:14+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy
r8415 r8874 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 4 import static org.junit.Assert.*5 3 6 4 import org.junit.* … … 9 7 import org.openstreetmap.josm.data.osm.DataSet 10 8 import org.openstreetmap.josm.data.osm.Node 9 import org.openstreetmap.josm.data.osm.OsmUtils 11 10 import org.openstreetmap.josm.data.osm.Relation 12 11 import org.openstreetmap.josm.data.osm.RelationMember … … 14 13 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context 15 14 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op 15 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser 16 16 17 17 … … 86 86 assert cond.applies(e) 87 87 } 88 89 @Test 90 public void testKeyRegexValueRegex() throws Exception { 91 def selPos = new MapCSSParser(new StringReader("*[/^source/ =~ /.*,.*/]")).selector() 92 def selNeg = new MapCSSParser(new StringReader("*[/^source/ !~ /.*,.*/]")).selector() 93 assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way foo=bar"))) 94 assert selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1,2"))) 95 assert selPos.matches(new Environment(OsmUtils.createPrimitive("way source_foo_bar=1,2"))) 96 assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1"))) 97 assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1"))) 98 assert !selNeg.matches(new Environment(OsmUtils.createPrimitive("way source=1,2"))) 99 assert !selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar source=1,2"))) 100 assert selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar source=baz"))) 101 assert selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar src=1,2"))) 102 } 88 103 }
Note:
See TracChangeset
for help on using the changeset viewer.