seperate out map initialization
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3888 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,14 +3,8 @@
|
|||||||
<script src="../../lib/OpenLayers.js"></script>
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
var map;
|
var map;
|
||||||
function test_Control_DragPan_constructor (t) {
|
|
||||||
t.plan( 1 );
|
function init_map() {
|
||||||
|
|
||||||
control = new OpenLayers.Control.DragPan();
|
|
||||||
t.ok( control instanceof OpenLayers.Control.DragPan, "new OpenLayers.Control returns object" );
|
|
||||||
}
|
|
||||||
function test_Control_DragPan_drag (t) {
|
|
||||||
t.plan(4);
|
|
||||||
control = new OpenLayers.Control.DragPan();
|
control = new OpenLayers.Control.DragPan();
|
||||||
map = new OpenLayers.Map("map", {controls:[control]});
|
map = new OpenLayers.Map("map", {controls:[control]});
|
||||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
@@ -20,6 +14,18 @@
|
|||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
map.zoomIn();
|
map.zoomIn();
|
||||||
control.activate();
|
control.activate();
|
||||||
|
return [map, control];
|
||||||
|
}
|
||||||
|
function test_Control_DragPan_constructor (t) {
|
||||||
|
t.plan( 1 );
|
||||||
|
|
||||||
|
control = new OpenLayers.Control.DragPan();
|
||||||
|
t.ok( control instanceof OpenLayers.Control.DragPan, "new OpenLayers.Control returns object" );
|
||||||
|
}
|
||||||
|
function test_Control_DragPan_drag (t) {
|
||||||
|
t.plan(4);
|
||||||
|
var data = init_map();
|
||||||
|
map = data[0]; control = data[1];
|
||||||
res = map.baseLayer.resolutions[map.getZoom()];
|
res = map.baseLayer.resolutions[map.getZoom()];
|
||||||
t.eq(map.center.lat, 0, "Lat is 0 before drag");
|
t.eq(map.center.lat, 0, "Lat is 0 before drag");
|
||||||
t.eq(map.center.lon, 0, "Lon is 0 before drag");
|
t.eq(map.center.lon, 0, "Lon is 0 before drag");
|
||||||
@@ -30,6 +36,7 @@
|
|||||||
t.eq(map.getCenter().lat, res * 5, "Lat is " + (res * 5) + " after drag");
|
t.eq(map.getCenter().lat, res * 5, "Lat is " + (res * 5) + " after drag");
|
||||||
t.eq(map.getCenter().lon, res * -5, "Lon is " + (res * -5) + " after drag");
|
t.eq(map.getCenter().lon, res * -5, "Lon is " + (res * -5) + " after drag");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user