Adding unit tests.
This commit is contained in:
@@ -33,6 +33,31 @@
|
||||
map.addControl(control2, new OpenLayers.Pixel(100,100));
|
||||
t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
|
||||
}
|
||||
|
||||
function test_draw(t) {
|
||||
t.plan(3);
|
||||
map = new OpenLayers.Map('map', {controls:[]});
|
||||
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
control = new OpenLayers.Control.PanZoomBar();
|
||||
map.addControl(control);
|
||||
t.eq(control.zoombarDiv.style.height, '176px', "Bar's height is correct.");
|
||||
|
||||
map.baseLayer.wrapDateLine = true;
|
||||
|
||||
control.redraw();
|
||||
t.eq(control.zoombarDiv.style.height, '154px', "Bar's height is correct after minZoom restriction.");
|
||||
|
||||
map.div.style.width = "512px";
|
||||
map.updateSize();
|
||||
t.eq(control.zoombarDiv.style.height, '165px', "Bar's height is correct after resize and minZoom restriction.");
|
||||
|
||||
map.div.style.width = "1024px";
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Control_PanZoomBar_clearDiv(t) {
|
||||
t.plan(2);
|
||||
|
||||
@@ -2047,7 +2047,7 @@
|
||||
}
|
||||
|
||||
function test_adjustZoom(t) {
|
||||
t.plan(4);
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map({
|
||||
div: 'map',
|
||||
layers: [
|
||||
@@ -2062,6 +2062,9 @@
|
||||
|
||||
t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
|
||||
t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width");
|
||||
|
||||
map.fractionalZoom = true;
|
||||
t.eq(map.adjustZoom(1).toPrecision(3), "1.29", "zoom adjusted to match world width");
|
||||
|
||||
map.moveTo([16, 48], 0);
|
||||
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
|
||||
|
||||
Reference in New Issue
Block a user