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
This commit is contained in:
+13
-3
@@ -127,7 +127,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Style_context(t) {
|
function test_Style_context(t) {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
var rule = new OpenLayers.Rule({
|
var rule = new OpenLayers.Rule({
|
||||||
symbolizer: {"Point": {externalGraphic: "${img1}"}},
|
symbolizer: {"Point": {externalGraphic: "${img1}"}},
|
||||||
filter: new OpenLayers.Filter.Comparison({
|
filter: new OpenLayers.Filter.Comparison({
|
||||||
@@ -145,8 +145,18 @@
|
|||||||
feature.attributes = {size: 10};
|
feature.attributes = {size: 10};
|
||||||
var styleHash = style.createSymbolizer(feature);
|
var styleHash = style.createSymbolizer(feature);
|
||||||
t.eq(styleHash.externalGraphic, "myImage.png", "correctly evaluated rule and calculated property styles from a custom context");
|
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) {
|
function test_Style_findPropertyStyles(t) {
|
||||||
t.plan(4);
|
t.plan(4);
|
||||||
var rule1 = new OpenLayers.Rule({symbolizer: {
|
var rule1 = new OpenLayers.Rule({symbolizer: {
|
||||||
|
|||||||
Reference in New Issue
Block a user