Changeset 7357 in josm for trunk/test/unit/org
- Timestamp:
- 2014-08-01T21:05:34+02:00 (10 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy
r7081 r7357 1 1 package org.openstreetmap.josm.data.validation.tests 2 2 3 import org.openstreetmap.josm. TestUtils3 import org.openstreetmap.josm.data.osm.OsmUtils 4 4 5 5 class LanesTest extends GroovyTestCase { … … 22 22 23 23 void test1() { 24 lanes.check( TestUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes"))24 lanes.check(OsmUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes")) 25 25 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent" 26 26 } 27 27 28 28 void test2() { 29 lanes.check( TestUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated"))29 lanes.check(OsmUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated")) 30 30 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent in forward direction" 31 31 } 32 32 33 33 void test3() { 34 lanes.check( TestUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left"))34 lanes.check(OsmUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left")) 35 35 assert lanes.errors.isEmpty() 36 36 } 37 37 38 38 void test4() { 39 lanes.check( TestUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3"))39 lanes.check(OsmUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3")) 40 40 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent in forward direction" 41 41 } 42 42 43 43 void test5() { 44 lanes.check( TestUtils.createPrimitive("way lanes:forward=5 turn:lanes:forward=left|right"))44 lanes.check(OsmUtils.createPrimitive("way lanes:forward=5 turn:lanes:forward=left|right")) 45 45 assert lanes.errors.get(0).getMessage() == "Number of lanes:forward greater than *:lanes:forward" 46 46 } 47 47 48 48 void test6() { 49 lanes.check( TestUtils.createPrimitive("way lanes:forward=foo|bar turn:lanes:forward=foo+bar"))49 lanes.check(OsmUtils.createPrimitive("way lanes:forward=foo|bar turn:lanes:forward=foo+bar")) 50 50 assert lanes.errors.isEmpty() 51 51 } 52 52 53 53 void test7() { 54 lanes.check( TestUtils.createPrimitive("way lanes=3 lanes:forward=3 lanes:backward=7"))54 lanes.check(OsmUtils.createPrimitive("way lanes=3 lanes:forward=3 lanes:backward=7")) 55 55 assert lanes.errors.get(0).getMessage() == "Number of lanes:forward+lanes:backward greater than lanes" 56 56 } 57 57 58 58 void test8() { 59 lanes.check( TestUtils.createPrimitive("way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none"))59 lanes.check(OsmUtils.createPrimitive("way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none")) 60 60 assert lanes.errors.isEmpty() 61 61 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.groovy
r7254 r7357 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.validation.tests 3 4 import static org.openstreetmap.josm.data.osm.OsmUtils.createPrimitive 3 5 4 6 import org.openstreetmap.josm.JOSMFixture … … 8 10 import org.openstreetmap.josm.data.validation.TestError 9 11 import org.openstreetmap.josm.gui.tagging.TaggingPresets 10 11 import static org.openstreetmap.josm.TestUtils.createPrimitive12 12 13 13 class RelationCheckerTest extends GroovyTestCase { -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy
r7170 r7357 7 7 import org.openstreetmap.josm.JOSMFixture 8 8 import org.openstreetmap.josm.Main 9 import org.openstreetmap.josm.TestUtils10 9 import org.openstreetmap.josm.data.coor.LatLon 11 10 import org.openstreetmap.josm.data.osm.DataSet 11 import org.openstreetmap.josm.data.osm.OsmUtils 12 12 import org.openstreetmap.josm.data.osm.Way 13 13 import org.openstreetmap.josm.gui.mappaint.Environment … … 19 19 20 20 protected static Environment getEnvironment(String key, String value) { 21 return new Environment().withPrimitive( TestUtils.createPrimitive("way " + key + "=" + value))21 return new Environment().withPrimitive(OsmUtils.createPrimitive("way " + key + "=" + value)) 22 22 } 23 23 … … 67 67 assert css.getErrors().isEmpty() 68 68 def mc1 = new MultiCascade() 69 css.apply(mc1, TestUtils.createPrimitive("way highway=path"), 1, null, false);69 css.apply(mc1, OsmUtils.createPrimitive("way highway=path"), 1, null, false); 70 70 assert "green".equals(mc1.getCascade("default").get("text-color", null, String.class)) 71 71 assert "brown".equals(mc1.getCascade("default").get("color", null, String.class)) 72 72 def mc2 = new MultiCascade() 73 css.apply(mc2, TestUtils.createPrimitive("way highway=residential"), 1, null, false);73 css.apply(mc2, OsmUtils.createPrimitive("way highway=residential"), 1, null, false); 74 74 assert "orange".equals(mc2.getCascade("default").get("color", null, String.class)) 75 75 assert mc2.getCascade("default").get("text-color", null, String.class) == null 76 76 def mc3 = new MultiCascade() 77 css.apply(mc3, TestUtils.createPrimitive("way highway=footway"), 1, null, false);77 css.apply(mc3, OsmUtils.createPrimitive("way highway=footway"), 1, null, false); 78 78 assert ColorHelper.html2color("#FF6644").equals(mc3.getCascade("default").get("color", null, Color.class)) 79 79 } … … 192 192 public void testNRegexKeyConditionSelector() throws Exception { 193 193 def s1 = getParser("*[sport][tourism != hotel]").selector() 194 assert s1.matches(new Environment().withPrimitive( TestUtils.createPrimitive("node sport=foobar")))195 assert !s1.matches(new Environment().withPrimitive( TestUtils.createPrimitive("node sport=foobar tourism=hotel")))194 assert s1.matches(new Environment().withPrimitive(OsmUtils.createPrimitive("node sport=foobar"))) 195 assert !s1.matches(new Environment().withPrimitive(OsmUtils.createPrimitive("node sport=foobar tourism=hotel"))) 196 196 def s2 = getParser("*[sport][tourism != hotel][leisure !~ /^(sports_centre|stadium|)\$/]").selector() 197 assert s2.matches(new Environment().withPrimitive( TestUtils.createPrimitive("node sport=foobar")))198 assert !s2.matches(new Environment().withPrimitive( TestUtils.createPrimitive("node sport=foobar tourism=hotel")))199 assert !s2.matches(new Environment().withPrimitive( TestUtils.createPrimitive("node sport=foobar leisure=stadium")))197 assert s2.matches(new Environment().withPrimitive(OsmUtils.createPrimitive("node sport=foobar"))) 198 assert !s2.matches(new Environment().withPrimitive(OsmUtils.createPrimitive("node sport=foobar tourism=hotel"))) 199 assert !s2.matches(new Environment().withPrimitive(OsmUtils.createPrimitive("node sport=foobar leisure=stadium"))) 200 200 } 201 201 … … 226 226 sheet.loadStyleSource() 227 227 def mc = new MultiCascade() 228 sheet.apply(mc, TestUtils.createPrimitive("way foo=bar"), 20, null, false)228 sheet.apply(mc, OsmUtils.createPrimitive("way foo=bar"), 20, null, false) 229 229 assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 5 230 sheet.apply(mc, TestUtils.createPrimitive("way keyA=true"), 20, null, false)230 sheet.apply(mc, OsmUtils.createPrimitive("way keyA=true"), 20, null, false) 231 231 assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15 232 sheet.apply(mc, TestUtils.createPrimitive("way keyB=true"), 20, null, false)232 sheet.apply(mc, OsmUtils.createPrimitive("way keyB=true"), 20, null, false) 233 233 assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15 234 sheet.apply(mc, TestUtils.createPrimitive("way keyA=true keyB=true"), 20, null, false)234 sheet.apply(mc, OsmUtils.createPrimitive("way keyA=true keyB=true"), 20, null, false) 235 235 assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15 236 236 } … … 242 242 sheet.loadStyleSource() 243 243 def mc = new MultiCascade() 244 sheet.apply(mc, TestUtils.createPrimitive("way name=Foo"), 20, null, false)244 sheet.apply(mc, OsmUtils.createPrimitive("way name=Foo"), 20, null, false) 245 245 assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == " Foo" 246 sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15"), 20, null, false)246 sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15"), 20, null, false) 247 247 assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 " 248 sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15 name=Foo"), 20, null, false)248 sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15 name=Foo"), 20, null, false) 249 249 assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 Foo" 250 250 … … 252 252 "*[rcn_ref], *[name] {text: join(\" - \", tag(rcn_ref), tag(ref), tag(name)); }") 253 253 sheet.loadStyleSource() 254 sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15 ref=1.5 name=Foo"), 20, null, false)254 sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15 ref=1.5 name=Foo"), 20, null, false) 255 255 assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 - 1.5 - Foo" 256 256 } … … 358 358 def mc = new MultiCascade() 359 359 360 sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6 z=8 u=100"), 20, null, false)360 sheet.apply(mc, OsmUtils.createPrimitive("way x=4 y=6 z=8 u=100"), 20, null, false) 361 361 assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", Float.NaN, Float.class) == 4.0f 362 362 assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", Float.NaN, Float.class) == 8.0f 363 363 364 sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6 widths=1;2;8;56;3;a"), 20, null, false)364 sheet.apply(mc, OsmUtils.createPrimitive("way x=4 y=6 widths=1;2;8;56;3;a"), 20, null, false) 365 365 assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class) == 4 366 366 assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class) == 6
Note:
See TracChangeset
for help on using the changeset viewer.