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/Zoom.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/Zoom.html')
-rw-r--r-- | misc/openlayers/tests/Control/Zoom.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Control/Zoom.html b/misc/openlayers/tests/Control/Zoom.html new file mode 100644 index 0000000..cfeb082 --- /dev/null +++ b/misc/openlayers/tests/Control/Zoom.html @@ -0,0 +1,83 @@ +<!DOCTYPE html> +<html> +<head> + <script src="../OLLoader.js"></script> + <script type="text/javascript"> + + function test_constructor(t) { + t.plan(5); + + var control = new OpenLayers.Control.Zoom(); + t.ok(control instanceof OpenLayers.Control, "instance of Control"); + t.ok(control instanceof OpenLayers.Control.Zoom, "instance of Zoom"); + t.eq(control.displayClass, "olControlZoom", "displayClass"); + control.destroy(); + + control = new OpenLayers.Control.Zoom({ + zoomInText: "zoom in!", + zoomOutText: "zoom out!" + }); + t.eq(control.zoomInText, "zoom in!", "zoomInText"); + t.eq(control.zoomOutText, "zoom out!", "zoomOutText"); + control.destroy(); + } + + function test_addControl(t) { + t.plan(3); + var map = new OpenLayers.Map("map"); + var control = new OpenLayers.Control.Zoom(); + map.addControl(control); + t.ok(control.map === map, "Control.map set"); + t.ok(!!~OpenLayers.Util.indexOf(map.controls, control), "map.controls contains control"); + + control = new OpenLayers.Control.Zoom({zoomInId: "in", zoomOutId: "out"}); + map.addControl(control); + var eventsEl = document.getElementById("out").parentNode; + t.ok(control.events.element === eventsEl, "Events instance listens to custom div's parentNode"); + + map.destroy(); + } + + function test_zoomIn(t) { + t.plan(2); + + var map = new OpenLayers.Map({ + div: "map", + layers: [new OpenLayers.Layer(null, {isBaseLayer: true})], + zoomMethod: null + }); + var control = new OpenLayers.Control.Zoom(); + map.addControl(control); + map.setCenter([0, 0], 0); + + t.eq(map.getZoom(), 0, "initial center"); + map.events.triggerEvent("buttonclick", {buttonElement: control.zoomInLink}); + t.eq(map.getZoom(), 1, "after zoom in"); + map.destroy(); + } + + function test_zoomOut(t) { + t.plan(2); + + var map = new OpenLayers.Map({ + div: "map", + layers: [new OpenLayers.Layer(null, {isBaseLayer: true})], + zoomMethod: null + }); + var control = new OpenLayers.Control.Zoom(); + map.addControl(control); + map.setCenter([0, 0], 1); + + t.eq(map.getZoom(), 1, "initial center"); + map.events.triggerEvent("buttonclick", {buttonElement: control.zoomOutLink}); + t.eq(map.getZoom(), 0, "after zoom out"); + map.destroy(); + } + + </script> +</head> +<body> + <div id="map" style="width: 512px; height: 256px;"/> + <div id="in">in</div><div id="out">out</out> +</body> +</html> |