Ignore:
Timestamp:
2014-08-01T21:05:34+02:00 (10 years ago)
Author:
Don-vip
Message:

see #10206 - update Groovy tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy

    r7170 r7357  
    77import org.openstreetmap.josm.JOSMFixture
    88import org.openstreetmap.josm.Main
    9 import org.openstreetmap.josm.TestUtils
    109import org.openstreetmap.josm.data.coor.LatLon
    1110import org.openstreetmap.josm.data.osm.DataSet
     11import org.openstreetmap.josm.data.osm.OsmUtils
    1212import org.openstreetmap.josm.data.osm.Way
    1313import org.openstreetmap.josm.gui.mappaint.Environment
     
    1919
    2020    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))
    2222    }
    2323
     
    6767        assert css.getErrors().isEmpty()
    6868        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);
    7070        assert "green".equals(mc1.getCascade("default").get("text-color", null, String.class))
    7171        assert "brown".equals(mc1.getCascade("default").get("color", null, String.class))
    7272        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);
    7474        assert "orange".equals(mc2.getCascade("default").get("color", null, String.class))
    7575        assert mc2.getCascade("default").get("text-color", null, String.class) == null
    7676        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);
    7878        assert ColorHelper.html2color("#FF6644").equals(mc3.getCascade("default").get("color", null, Color.class))
    7979    }
     
    192192    public void testNRegexKeyConditionSelector() throws Exception {
    193193        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")))
    196196        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")))
    200200    }
    201201
     
    226226        sheet.loadStyleSource()
    227227        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)
    229229        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)
    231231        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)
    233233        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)
    235235        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15
    236236    }
     
    242242        sheet.loadStyleSource()
    243243        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)
    245245        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)
    247247        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)
    249249        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 Foo"
    250250
     
    252252                "*[rcn_ref], *[name] {text: join(\" - \", tag(rcn_ref), tag(ref), tag(name)); }")
    253253        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)
    255255        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 - 1.5 - Foo"
    256256    }
     
    358358        def mc = new MultiCascade()
    359359
    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)
    361361        assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", Float.NaN, Float.class) == 4.0f
    362362        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", Float.NaN, Float.class) == 8.0f
    363363
    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)
    365365        assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class) == 4
    366366        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class) == 6
Note: See TracChangeset for help on using the changeset viewer.