Support for basic literal/propertyname combinations in SLD. r=elemoine (closes http://trac.osgeo.org/openlayers/ticket/3506)
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
'</PolygonSymbolizer>' +
|
||||
'<TextSymbolizer>' +
|
||||
'<Label>' +
|
||||
'<ogc:PropertyName>FOO</ogc:PropertyName>' +
|
||||
'A <ogc:PropertyName>FOO</ogc:PropertyName> label' +
|
||||
'</Label>' +
|
||||
'<Font>' +
|
||||
'<CssParameter name="font-family">Arial</CssParameter>' +
|
||||
@@ -121,6 +121,7 @@
|
||||
'<CssParameter name="stroke-width">2</CssParameter>' +
|
||||
'</Stroke>' +
|
||||
'</Mark>' +
|
||||
'<Size><ogc:PropertyName>SIZE</ogc:PropertyName></Size>' +
|
||||
'</Graphic>' +
|
||||
'</PointSymbolizer>' +
|
||||
'</Rule>' +
|
||||
@@ -130,7 +131,7 @@
|
||||
'</StyledLayerDescriptor>';
|
||||
|
||||
function test_read(t) {
|
||||
t.plan(22);
|
||||
t.plan(23);
|
||||
|
||||
var xml = new OpenLayers.Format.XML();
|
||||
var sldxml = xml.read(sld);
|
||||
@@ -173,7 +174,7 @@
|
||||
t.eq(poly.fillColor, "#ffffff", "(AAA161) first rule has proper fill");
|
||||
t.eq(poly.strokeColor, "#000000", "(AAA161) first rule has proper stroke");
|
||||
var text = symbolizer["Text"];
|
||||
t.eq(text.label, "${FOO}", "(AAA161) first rule has proper text label");
|
||||
t.eq(text.label, "A ${FOO} label", "(AAA161) first rule has proper text label");
|
||||
t.eq(layer.userStyles[0].propertyStyles["label"], true, "label added to propertyStyles");
|
||||
t.eq(text.fontFamily, "Arial", "(AAA161) first rule has proper font family");
|
||||
t.eq(text.fillColor, "#000000", "(AAA161) first rule has proper text fill");
|
||||
@@ -203,6 +204,12 @@
|
||||
t.ok(typeof rule.maxScaleDenominator == "number", "MaxScaleDenominator is a number");
|
||||
t.eq(rule.evaluate(feature), true, "numeric filter comparison evaluates correctly");
|
||||
|
||||
// check for PropertyName size
|
||||
layer = obj.namedLayers["Second Layer"];
|
||||
style = layer.userStyles[0];
|
||||
rule = style.rules[0];
|
||||
t.eq(rule.symbolizer["Point"].graphicWidth, "${SIZE}", "dynamic size correctly set on graphicWidth");
|
||||
|
||||
// etc. I'm convinced read works, really wanted to test write (since examples don't test that)
|
||||
// I'll add more tests here later.
|
||||
|
||||
@@ -211,7 +218,7 @@
|
||||
function test_write(t) {
|
||||
t.plan(3);
|
||||
|
||||
// read first - testing that write produces the SLD aboce
|
||||
// read first - testing that write produces the SLD above
|
||||
var parser = new OpenLayers.Format.SLD.v1_0_0();
|
||||
var xml = new OpenLayers.Format.XML();
|
||||
var sldxml = xml.read(sld);
|
||||
|
||||
Reference in New Issue
Block a user