Changeset 6736 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2014-01-19T17:46:33+01:00 (11 years ago)
Author:
simon04
Message:

fix #8568 - MapCSS rule applied several times if several selectors applies

File:
1 edited

Legend:

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

    r6561 r6736  
    33import org.junit.Before
    44import org.junit.Test
     5import org.openstreetmap.TestUtils
    56import org.openstreetmap.josm.Main
    67import org.openstreetmap.josm.data.Preferences
     
    181182        assert !c2.applies(new Environment().withPrimitive(w2))
    182183    }
     184
     185    @Test
     186    public void testTicket8568() throws Exception {
     187        def sheet = new MapCSSStyleSource("")
     188        getParser("" +
     189                "way { width: 5; }\n" +
     190                "way[keyA], way[keyB] { width: eval(prop(width)+10); }").sheet(sheet)
     191        def mc = new MultiCascade()
     192        sheet.apply(mc, TestUtils.createPrimitive("way foo=bar"), 20, null, false)
     193        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 5
     194        sheet.apply(mc, TestUtils.createPrimitive("way keyA=true"), 20, null, false)
     195        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15
     196        sheet.apply(mc, TestUtils.createPrimitive("way keyB=true"), 20, null, false)
     197        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15
     198        sheet.apply(mc, TestUtils.createPrimitive("way keyA=true keyB=true"), 20, null, false)
     199        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15
     200    }
    183201}
Note: See TracChangeset for help on using the changeset viewer.