summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Format/XML/VersionedOGC.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/XML/VersionedOGC.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/XML/VersionedOGC.html')
-rw-r--r--misc/openlayers/tests/Format/XML/VersionedOGC.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Format/XML/VersionedOGC.html b/misc/openlayers/tests/Format/XML/VersionedOGC.html
new file mode 100644
index 0000000..ca96d63
--- /dev/null
+++ b/misc/openlayers/tests/Format/XML/VersionedOGC.html
@@ -0,0 +1,51 @@
+<html>
+<head>
+ <script src="../../OLLoader.js"></script>
+ <script type="text/javascript">
+
+ var snippet = '<foo version="2.0.0"></foo>';
+ var snippet2 = '<foo></foo>';
+
+ function test_Format_Versioned_constructor(t) {
+ t.plan(5);
+
+ var format = new OpenLayers.Format.XML.VersionedOGC({version: "1.0.0"});
+ t.ok(format instanceof OpenLayers.Format.XML.VersionedOGC,
+ "new OpenLayers.Format.XML.VersionedOGC returns object" );
+ t.eq(format.version, "1.0.0", "constructor sets version correctly");
+ t.eq(format.defaultVersion, null, "defaultVersion should be null if not specified");
+ t.eq(typeof format.read, "function", "format has a read function");
+ t.eq(typeof format.write, "function", "format has a read function");
+ }
+
+ function test_getVersion(t) {
+ t.plan(6);
+ var format = new OpenLayers.Format.XML.VersionedOGC();
+ // read
+ var data = new OpenLayers.Format.XML().read(snippet);
+ var root = data.documentElement;
+ var version = format.getVersion(root);
+ t.eq(version, "2.0.0", "Version taken from document");
+ format = new OpenLayers.Format.XML.VersionedOGC({version: "1.0.0"});
+ version = format.getVersion(root);
+ t.eq(version, "1.0.0", "Version taken from parser takes preference");
+ format = new OpenLayers.Format.XML.VersionedOGC({defaultVersion: "3.0.0"});
+ data = new OpenLayers.Format.XML().read(snippet2);
+ root = data.documentElement;
+ version = format.getVersion(root);
+ t.eq(version, "3.0.0", "If nothing else is set, defaultVersion should be returned");
+ // write
+ version = format.getVersion(null, {version: "1.3.0"});
+ t.eq(version, "1.3.0", "Version from options returned");
+ version = format.getVersion(null);
+ t.eq(version, "3.0.0", "defaultVersion returned if no version specified in options and no version on the format");
+ format.version = "2.1.3";
+ version = format.getVersion(null);
+ t.eq(version, "2.1.3", "version returned of the Format if no version specified in options");
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>