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/Scale.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/Scale.html')
-rw-r--r-- | misc/openlayers/tests/Control/Scale.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Control/Scale.html b/misc/openlayers/tests/Control/Scale.html new file mode 100644 index 0000000..1d43b25 --- /dev/null +++ b/misc/openlayers/tests/Control/Scale.html @@ -0,0 +1,54 @@ +<html> +<head> + <script src="../OLLoader.js"></script> + <script type="text/javascript"> + OpenLayers.Lang.setCode('en'); + var map; + function test_Control_Scale_constructor (t) { + t.plan( 2 ); + + control = new OpenLayers.Control.Scale(); + t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" ); + t.eq( control.displayClass, "olControlScale", "displayClass is correct" ); + } + function test_Control_Scale_initwithelem (t) { + t.plan( 1 ); + + control = new OpenLayers.Control.Scale(OpenLayers.Util.getElement('scale')); + t.ok(true, "If this happens, then we passed. (FF throws an error above otherwise)"); + } + function test_Control_Scale_updateScale (t) { + t.plan( 4 ); + + control = new OpenLayers.Control.Scale('scale'); + t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" ); + map = new OpenLayers.Map('map', {zoomMethod: null}); + layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); + map.addLayer(layer); + map.zoomTo(0); + map.addControl(control); + t.eq(OpenLayers.Util.getElement('scale').innerHTML, "Scale = 1 : 443M", "Scale set by default." ); + map.zoomIn(); + t.eq(OpenLayers.Util.getElement('scale').innerHTML, "Scale = 1 : 221M", "Zooming in changes scale" ); + map.baseLayer.resolutions = [OpenLayers.Util.getResolutionFromScale(110)]; + map.zoomTo(0); + t.eq(OpenLayers.Util.getElement('scale').innerHTML, "Scale = 1 : 110", "Scale of 100 isn't rounded" ); + } + function test_Control_Scale_internalScale (t) { + t.plan(2); + control = new OpenLayers.Control.Scale(); + t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" ); + map = new OpenLayers.Map('map', {zoomMethod: null}); + layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); + map.addLayer(layer); + map.zoomTo(0); + map.addControl(control); + t.eq(control.div.firstChild.innerHTML, "Scale = 1 : 443M", "Internal scale displayed properly."); + } + </script> +</head> +<body> + <a id="scale" href="">Scale</a> <br /> + <div id="map" style="width: 1024px; height: 512px;"/> +</body> +</html> |