Changeset 17742 in josm


Ignore:
Timestamp:
2021-04-11T12:35:11+02:00 (4 years ago)
Author:
simon04
Message:

Simplify MapCSSParserTest

File:
1 edited

Legend:

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

    r17604 r17742  
    108108        MultiCascade mc1 = new MultiCascade();
    109109        css.apply(mc1, OsmUtils.createPrimitive("way highway=path"), 1, false);
    110         assertEquals("green", mc1.getCascade("default").get("text-color", null, String.class));
    111         assertEquals("brown", mc1.getCascade("default").get("color", null, String.class));
     110        assertEquals("green", mc1.getCascade(null).get("text-color", null, String.class));
     111        assertEquals("brown", mc1.getCascade(null).get("color", null, String.class));
    112112        MultiCascade mc2 = new MultiCascade();
    113113        css.apply(mc2, OsmUtils.createPrimitive("way highway=residential"), 1, false);
    114         assertEquals("orange", mc2.getCascade("default").get("color", null, String.class));
    115         assertNull(mc2.getCascade("default").get("text-color", null, String.class));
     114        assertEquals("orange", mc2.getCascade(null).get("color", null, String.class));
     115        assertNull(mc2.getCascade(null).get("text-color", null, String.class));
    116116        MultiCascade mc3 = new MultiCascade();
    117117        css.apply(mc3, OsmUtils.createPrimitive("way highway=footway"), 1, false);
    118         assertEquals(ColorHelper.html2color("#FF6644"), mc3.getCascade("default").get("color", null, Color.class));
     118        assertEquals(ColorHelper.html2color("#FF6644"), mc3.getCascade(null).get("color", null, Color.class));
    119119    }
    120120
     
    350350        MultiCascade mc = new MultiCascade();
    351351        sheet.apply(mc, OsmUtils.createPrimitive("way foo=bar"), 20, false);
    352         assertEquals(Float.valueOf(5f), mc.getCascade(Environment.DEFAULT_LAYER).get("width"));
     352        assertEquals(Float.valueOf(5f), mc.getCascade(null).get("width"));
    353353        sheet.apply(mc, OsmUtils.createPrimitive("way keyA=true"), 20, false);
    354         assertEquals(Float.valueOf(15f), mc.getCascade(Environment.DEFAULT_LAYER).get("width"));
     354        assertEquals(Float.valueOf(15f), mc.getCascade(null).get("width"));
    355355        sheet.apply(mc, OsmUtils.createPrimitive("way keyB=true"), 20, false);
    356         assertEquals(Float.valueOf(15f), mc.getCascade(Environment.DEFAULT_LAYER).get("width"));
     356        assertEquals(Float.valueOf(15f), mc.getCascade(null).get("width"));
    357357        sheet.apply(mc, OsmUtils.createPrimitive("way keyA=true keyB=true"), 20, false);
    358         assertEquals(Float.valueOf(15f), mc.getCascade(Environment.DEFAULT_LAYER).get("width"));
     358        assertEquals(Float.valueOf(15f), mc.getCascade(null).get("width"));
    359359    }
    360360
     
    366366        MultiCascade mc = new MultiCascade();
    367367        sheet.apply(mc, OsmUtils.createPrimitive("way name=Foo"), 20, false);
    368         assertEquals(" Foo", mc.getCascade(Environment.DEFAULT_LAYER).get("text"));
     368        assertEquals(" Foo", mc.getCascade(null).get("text"));
    369369        sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15"), 20, false);
    370         assertEquals("15 ", mc.getCascade(Environment.DEFAULT_LAYER).get("text"));
     370        assertEquals("15 ", mc.getCascade(null).get("text"));
    371371        sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15 name=Foo"), 20, false);
    372         assertEquals("15 Foo", mc.getCascade(Environment.DEFAULT_LAYER).get("text"));
     372        assertEquals("15 Foo", mc.getCascade(null).get("text"));
    373373
    374374        sheet = new MapCSSStyleSource("" +
     
    376376        sheet.loadStyleSource();
    377377        sheet.apply(mc, OsmUtils.createPrimitive("way rcn_ref=15 ref=1.5 name=Foo"), 20, false);
    378         assertEquals("15 - 1.5 - Foo", mc.getCascade(Environment.DEFAULT_LAYER).get("text"));
     378        assertEquals("15 - 1.5 - Foo", mc.getCascade(null).get("text"));
    379379    }
    380380
     
    384384        getParser("{color: testcolour1#88DD22}").declaration().instructions.get(0).execute(e);
    385385        Color expected = new Color(0x88DD22);
    386         assertEquals(expected, e.getCascade(Environment.DEFAULT_LAYER).get("color"));
     386        assertEquals(expected, e.getCascade(null).get("color"));
    387387    }
    388388
     
    392392        getParser("{color: testcolour2#12345678}").declaration().instructions.get(0).execute(e);
    393393        Color expected = new Color(0x12, 0x34, 0x56, 0x78);
    394         assertEquals(expected, e.getCascade(Environment.DEFAULT_LAYER).get("color"));
     394        assertEquals(expected, e.getCascade(null).get("color"));
    395395    }
    396396
     
    457457        assertTrue(source.rules.get(0).matches(e));
    458458        source.rules.get(0).declaration.execute(e);
    459         assertEquals("x2;x10", e.getCascade(Environment.DEFAULT_LAYER).get("refs", null, String.class));
     459        assertEquals("x2;x10", e.getCascade(null).get("refs", null, String.class));
    460460    }
    461461
     
    472472        assertTrue(source.rules.get(0).matches(e));
    473473        source.rules.get(0).declaration.execute(e);
    474         assertEquals(Functions.join(",", "Alpha", "Beta"), e.getCascade(Environment.DEFAULT_LAYER).get("sorted", null, String.class));
     474        assertEquals(Functions.join(",", "Alpha", "Beta"), e.getCascade(null).get("sorted", null, String.class));
    475475
    476476        source = new MapCSSStyleSource("way[ref] {sorted: join_list(\",\", sort_list(split(\";\", tag(\"ref\"))));}");
     
    479479        assertTrue(source.rules.get(0).matches(e));
    480480        source.rules.get(0).declaration.execute(e);
    481         assertEquals(Functions.join(",", "A8", "A9"), e.getCascade(Environment.DEFAULT_LAYER).get("sorted", null, String.class));
     481        assertEquals(Functions.join(",", "A8", "A9"), e.getCascade(null).get("sorted", null, String.class));
    482482    }
    483483
     
    537537        assertTrue(source.rules.get(0).matches(e));
    538538        source.rules.get(0).declaration.execute(e);
    539         assertEquals((Integer) 1, e.getCascade(Environment.DEFAULT_LAYER).get("roles", null, Integer.class));
     539        assertEquals((Integer) 1, e.getCascade(null).get("roles", null, Integer.class));
    540540    }
    541541
     
    589589
    590590        sheet.apply(mc, OsmUtils.createPrimitive("way x=4 y=6 z=8 u=100"), 20, false);
    591         assertEquals(Float.valueOf(4.0f), mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", Float.NaN, Float.class));
    592         assertEquals(Float.valueOf(8.0f), mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", Float.NaN, Float.class));
     591        assertEquals(Float.valueOf(4.0f), mc.getCascade(null).get("min_value", Float.NaN, Float.class));
     592        assertEquals(Float.valueOf(8.0f), mc.getCascade(null).get("max_value", Float.NaN, Float.class));
    593593
    594594        sheet.apply(mc, OsmUtils.createPrimitive("way x=4 y=6 widths=1;2;8;56;3;a"), 20, false);
    595         assertEquals(Float.valueOf(4f), mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class));
    596         assertEquals(Float.valueOf(6f), mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class));
    597         assertEquals(Float.valueOf(56f), mc.getCascade(Environment.DEFAULT_LAYER).get("max_split", -777f, Float.class));
     595        assertEquals(Float.valueOf(4f), mc.getCascade(null).get("min_value", -777f, Float.class));
     596        assertEquals(Float.valueOf(6f), mc.getCascade(null).get("max_value", -777f, Float.class));
     597        assertEquals(Float.valueOf(56f), mc.getCascade(null).get("max_split", -777f, Float.class));
    598598    }
    599599
Note: See TracChangeset for help on using the changeset viewer.