diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Control/Graticule.html | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Control/Graticule.html')
-rw-r--r-- | misc/openlayers/tests/Control/Graticule.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Control/Graticule.html b/misc/openlayers/tests/Control/Graticule.html new file mode 100644 index 0000000..4aa867f --- /dev/null +++ b/misc/openlayers/tests/Control/Graticule.html @@ -0,0 +1,66 @@ +<html> +<head> + <script src="../OLLoader.js"></script> + <script src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js"></script> + <script type="text/javascript"> + + function test_initialize(t) { + t.plan(2); + var options = {}; + var map = new OpenLayers.Map("map",{projection:"EPSG:4326"}); + var layer = new OpenLayers.Layer.WMS(); + map.addLayers([layer]); + + var control = new OpenLayers.Control.Graticule(options); + map.addControl(control); + map.zoomToMaxExtent(); + + t.ok(control.gratLayer instanceof OpenLayers.Layer.Vector, + "constructor sets layer correctly"); + t.ok(control.gratLayer.features.length > 0, + "graticule has features"); + control.destroy(); + } + + function test_activate(t) { + t.plan(7); + var map = new OpenLayers.Map("map",{projection:"EPSG:4326"}); + var layer = new OpenLayers.Layer.WMS(); + map.addLayers([layer]); + + var control = new OpenLayers.Control.Graticule({}); + map.addControl(control); + map.zoomToMaxExtent(); + + t.ok(control.gratLayer.visibility, "Graticule layer is visible by default"); + control.deactivate(); + t.ok(control.gratLayer.map == null, + "Graticule layer is not in map when control is deactivated"); + control.destroy(); + + var control2 = new OpenLayers.Control.Graticule({autoActivate:false}); + map.addControl(control2); + t.ok(control2.gratLayer.map == null, + "Graticule layer is not in map when autoActivate:false"); + t.ok(control2.gratLayer.features.length == 0, + "Graticule layer is empty when autoActivate:false"); + control2.activate(); + t.ok(control2.gratLayer.map != null, + "Graticule layer is on map when control is activated"); + t.ok(control2.gratLayer.features.length > 0, + "Graticule features refreshed after control is activated"); + control2.gratLayer.setVisibility(false); + + control2.destroy(); + t.ok(control2.gratLayer == null, + "Graticule layer is destroyed when control is destroyed"); + + map.destroy(); + } + + </script> +</head> +<body> + <div id="map" style="width: 400px; height: 250px;"/> +</body> +</html> |