Changeset 6740 in josm for trunk/test/unit


Ignore:
Timestamp:
2014-01-19T20:30:57+01:00 (10 years ago)
Author:
simon04
Message:

fix #9191 - MapCSS: Add option to include colour preferences of external styles

The syntax is the same as for the XML styles: name#123456

File:
1 edited

Legend:

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

    r6737 r6740  
    1111import org.openstreetmap.josm.gui.mappaint.MultiCascade
    1212import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
     13import org.openstreetmap.josm.tools.ColorHelper
    1314import org.openstreetmap.josm.tools.Utils
    1415
     
    8182        def mc3 = new MultiCascade()
    8283        css.apply(mc3, getPrimitive("highway", "footway"), 1, null, false);
    83         assert Utils.hexToColor("#FF6644").equals(mc3.getCascade("default").get("color", null, Color.class))
     84        assert ColorHelper.html2color("#FF6644").equals(mc3.getCascade("default").get("color", null, Color.class))
    8485    }
    8586
     
    217218        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 - 1.5 - Foo"
    218219    }
     220
     221    @Test
     222    public void testColorNameTicket9191() throws Exception {
     223        def e = new Environment(null, new MultiCascade(), Environment.DEFAULT_LAYER, null)
     224        getParser("{color: testcolour1#88DD22}").declaration().get(0).execute(e)
     225        def expected = new Color(0x88DD22)
     226        assert e.getCascade(Environment.DEFAULT_LAYER).get("color") == expected
     227        assert Main.pref.getDefaultColor("MapCSS.testcolour1") == expected
     228    }
    219229}
Note: See TracChangeset for help on using the changeset viewer.