From 0af3b4ef1b127f2f7c2740503dc417ff949de088 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 28 Apr 2008 19:01:10 +0000 Subject: [PATCH] added an additional test to show that the example given by tschaub for #1526 works without modifications (references #1526) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7023 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/Style.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/Style.html b/tests/Style.html index 790c0b640e..e0260b8e4f 100644 --- a/tests/Style.html +++ b/tests/Style.html @@ -127,7 +127,7 @@ } function test_Style_context(t) { - t.plan(1); + t.plan(2); var rule = new OpenLayers.Rule({ symbolizer: {"Point": {externalGraphic: "${img1}"}}, filter: new OpenLayers.Filter.Comparison({ @@ -145,8 +145,18 @@ feature.attributes = {size: 10}; var styleHash = style.createSymbolizer(feature); t.eq(styleHash.externalGraphic, "myImage.png", "correctly evaluated rule and calculated property styles from a custom context"); - } - + + // same as above, but without rule (#1526) + style = new OpenLayers.Style( + {externalGraphic: "${getExternalGraphic}"}, + {context: { + getExternalGraphic: function(feature) { + return "foo" + feature.attributes.size + ".png"; + } + }}); + t.eq(style.createSymbolizer(feature).externalGraphic, "foo10.png", "correctly evaluated symbolizer without rule"); + }; + function test_Style_findPropertyStyles(t) { t.plan(4); var rule1 = new OpenLayers.Rule({symbolizer: {