summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Format/SLD.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Format/SLD.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Format/SLD.html')
-rw-r--r--misc/openlayers/tests/Format/SLD.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Format/SLD.html b/misc/openlayers/tests/Format/SLD.html
new file mode 100644
index 0000000..bc4bd82
--- /dev/null
+++ b/misc/openlayers/tests/Format/SLD.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+ <script src="../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ var test_content = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>TestLayer</sld:Name><sld:UserStyle><sld:Name>foo</sld:Name><sld:FeatureTypeStyle><sld:Rule><sld:Name>bar</sld:Name><ogc:Filter></ogc:Filter><sld:PolygonSymbolizer><sld:Fill><sld:CssParameter name="fill"><ogc:Literal>blue</ogc:Literal></sld:CssParameter></sld:Fill></sld:PolygonSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
+
+ function test_Format_SLD_constructor(t) {
+ t.plan(3);
+
+ var options = {'foo': 'bar'};
+ var format = new OpenLayers.Format.SLD(options);
+ t.ok(format instanceof OpenLayers.Format.SLD,
+ "new OpenLayers.Format.SLD returns object" );
+ t.eq(format.foo, "bar", "constructor sets options correctly");
+ t.eq(typeof format.read, "function", "format has a read function");
+ }
+
+ function test_Format_SLD_read(t) {
+ t.plan(4);
+ var sld = new OpenLayers.Format.SLD().read(this.test_content);
+
+ var testLayer = sld.namedLayers["TestLayer"];
+ var userStyles = testLayer.userStyles;
+
+ t.eq(userStyles[0].name, "foo", "SLD correctly reads a UserStyle named 'foo'");
+ t.eq(userStyles[0].rules.length, 1, "The number of rules for the UserStyle is correct");
+ t.eq(userStyles[0].rules[0].name, "bar", "The first rule's name is 'bar'");
+ t.eq(userStyles[0].rules[0].symbolizer.Polygon.fillColor, "blue", "The fillColor for the Polygon symbolizer is correct");
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>