Changeset 17743 in josm for trunk


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

see #20739 - Add MapCSSParserTest.testLayerMatching

File:
1 edited

Legend:

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

    r17742 r17743  
    1919import org.junit.jupiter.api.Test;
    2020import org.junit.jupiter.api.extension.RegisterExtension;
     21import org.junit.jupiter.params.ParameterizedTest;
     22import org.junit.jupiter.params.provider.ValueSource;
    2123import org.openstreetmap.josm.TestUtils;
    2224import org.openstreetmap.josm.data.coor.LatLon;
     
    119121    }
    120122
     123    @ParameterizedTest
     124    @ValueSource(strings = {
     125            "way[railway][bridge=yes]::bridges { z-index: 1; casting-width: 4; casing-color: #797979 }",
     126            "way[bridge=yes]::bridges { set .bridge }\nway[railway].bridge::bridges { z-index: 1; casting-width: 4; casing-color: #797979 }",
     127            // FIXME "way[bridge=yes] { set .bridge }\nway[railway].bridge::bridges { z-index: 1; casting-width: 4; casing-color: #797979 }",
     128    })
     129    void testLayerMatching(String cssString) {
     130        MapCSSStyleSource css = new MapCSSStyleSource(cssString);
     131        css.loadStyleSource();
     132        assertTrue(css.getErrors().isEmpty());
     133        MultiCascade mc1 = new MultiCascade();
     134        css.apply(mc1, OsmUtils.createPrimitive("way railway=rail bridge=yes"), 1, false);
     135        assertNull(mc1.getCascade(null).get("casing-color", null, String.class));
     136        assertEquals("#797979", mc1.getCascade("bridges").get("casing-color", null, String.class));
     137    }
     138
    121139    @Test
    122140    void testEqualCondition() throws Exception {
Note: See TracChangeset for help on using the changeset viewer.