Changeset 8774 in josm for trunk/test


Ignore:
Timestamp:
2015-09-21T20:42:21+02:00 (9 years ago)
Author:
simon04
Message:

see #11592 - Add test case for MapCSS index() function

File:
1 edited

Legend:

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

    r8415 r8774  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.gui.mappaint.mapcss;
     2package org.openstreetmap.josm.gui.mappaint.mapcss
     3
     4import org.openstreetmap.josm.gui.mappaint.MultiCascade;
    35
    46import static org.junit.Assert.*
     
    121123    public void matches_5() {
    122124        def css = """
    123            way <[role != "my_role"] relation {}
     125           way <[role != "my_role"] relation {text: index();}
    124126        """
    125127        ChildOrParentSelector selector = parse(css)
     
    139141        r.addMember(new RelationMember("my_role", w2))
    140142        r.addMember(new RelationMember("another role", w3))
     143        r.addMember(new RelationMember("yet another role", w3))
    141144
    142         Environment e = new Environment(r)
     145        Environment e = new Environment(r, new MultiCascade(), Environment.DEFAULT_LAYER, null)
    143146        assert selector.matches(e)
     147
     148        MapCSSStyleSource source = new MapCSSStyleSource(css)
     149        source.loadStyleSource()
     150        source.rules[0].declaration.execute(e)
     151        assert Float.valueOf(3f).equals(e.getCascade(Environment.DEFAULT_LAYER).get("text", null, Float.class))
    144152    }
    145153
Note: See TracChangeset for help on using the changeset viewer.