Merge 2.0 branch to trunk.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1369 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-25 18:17:06 +00:00
parent 282d9d6047
commit 104e509eb9
47 changed files with 840 additions and 483 deletions
+1
View File
@@ -22,6 +22,7 @@
<li>test_Tile.html</li>
<li>test_Tile_Image.html</li>
<li>test_Control.html</li>
<li>test_Control_MouseToolbar.html</li>
<li>test_Control_LayerSwitcher.html</li>
<li>test_Control_PanZoom.html</li>
<li>test_Control_PanZoomBar.html</li>
+55
View File
@@ -0,0 +1,55 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var map;
function test_01_Control_MouseToolbar_constructor (t) {
t.plan( 1 );
control = new OpenLayers.Control.MouseToolbar();
t.ok( control instanceof OpenLayers.Control.MouseToolbar, "new OpenLayers.Control.MouseToolbar returns object" );
}
function test_02_Control_MouseToolbar_addControl (t) {
t.plan( 7 );
map = new OpenLayers.Map('map');
control = new OpenLayers.Control.MouseToolbar();
t.ok( control instanceof OpenLayers.Control.MouseToolbar, "new OpenLayers.Control.MouseToolbar returns object" );
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
map.addControl(control);
t.ok( control.map === map, "Control.map is set to the map object" );
t.ok( map.controls[2] === control, "map.controls contains control" );
t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 3, "Control div zIndexed properly" );
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 3, "Viewport div contains control div" );
t.eq( control.div.style.top, "6px", "Control div top located correctly by default");
}
function test_03_Control_MouseToolbar_control_events (t) {
t.plan( 1 );
var evt = {which: 1}; // control expects left-click
map = new OpenLayers.Map('map');
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);
control = new OpenLayers.Control.MouseToolbar();
map.addControl(control);
var centerLL = new OpenLayers.LonLat(0,0);
map.setCenter(centerLL, 5);
evt.shiftKey = true;
evt.xy = new OpenLayers.Size(5,5);
control.defaultMouseDown(evt);
evt.xy = new OpenLayers.Size(15,15);
control.defaultMouseUp(evt);
t.eq(map.getZoom(), 5, "Map zoom set correctly after zoombox");
}
// -->
</script>
</head>
<body>
<div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>
+5 -1
View File
@@ -20,7 +20,11 @@
if (!map.getCenter()) map.zoomToMaxExtent();
map.addControl(control);
map.pan(5, 0);
t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
if (/MSIE/.test(navigator.userAgent)) {
t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
} else {
t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
}
}
function test_03_Control_Permalink_updateLinksBase (t) {
t.plan( 2 );
+4 -7
View File
@@ -89,19 +89,17 @@
function test_04_Layer_StandardOptionsAccessors (t) {
t.plan( 5 );
t.plan( 4 );
var projection = "chicken";
var maxExtent = new OpenLayers.Bounds(50,50,100,100);
var maxResolution = 1.5726;
var minZoomLevel = 5;
var maxZoomLevel = 15;
var numZoomLevels = 11;
var options = { projection: projection,
maxExtent: maxExtent,
maxResolution: maxResolution,
minZoomLevel: minZoomLevel,
maxZoomLevel: maxZoomLevel
numZoomLevels: numZoomLevels
};
var layer = new OpenLayers.Layer('Test Layer', options);
@@ -109,8 +107,7 @@
t.eq(layer.getProjection(), projection, "getProjection() works");
t.ok(layer.getMaxExtent().equals(maxExtent), "getMaxExtent() works");
t.eq(layer.getMaxResolution(), maxResolution, "getMaxResolution() works");
t.eq(layer.getMinZoomLevel(), minZoomLevel, "getMinZoomLevel() works");
t.eq(layer.getMaxZoomLevel(), maxZoomLevel, "getMaxZoomLevel() works");
t.eq(layer.getNumZoomLevels(), numZoomLevels, "getNumZoomLevels() works");
}
function test_05_Layer_visibility(t) {
+5 -1
View File
@@ -56,7 +56,11 @@
// MOUSEMOVE test does not seem to work...
// t.plan( 2 );
t.plan(1);
if (document.createEventObject) {
t.plan(3);
} else {
t.plan(1);
}
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.EventPane('Test Layer');
+4 -30
View File
@@ -114,13 +114,13 @@
* -insertColumn
* -insertRow
function test_07_Layer_Grid_moveTo(t) {
function 07_Layer_Grid_moveTo(t) {
}
function test_08_Layer_Grid_insertColumn(t) {
function 08_Layer_Grid_insertColumn(t) {
}
function test_09_Layer_Grid_insertRow(t) {
function 09_Layer_Grid_insertRow(t) {
}
*
@@ -166,41 +166,15 @@
}
function test_11_Layer_Grid_getTile(t) {
t.plan(2);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
//test with tile creation
layer = new OpenLayers.Layer.WMS(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
var gotTile = layer.getTile(tile.id);
t.ok( gotTile == tile, "got right tile");
gotTile = layer.getTile("chicken");
t.ok( gotTile == null, "getTile() of bogus id returns null");
}
function test_99_Layer_Grid_destroy (t) {
t.plan( 4 );
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Grid(name, url, params);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.alpha, null, "layer.alpha is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );
+4 -31
View File
@@ -107,13 +107,13 @@
* -insertColumn
* -insertRow
function test_07_Layer_KaMap_moveTo(t) {
function 07_Layer_KaMap_moveTo(t) {
}
function test_08_Layer_KaMap_insertColumn(t) {
function 08_Layer_KaMap_insertColumn(t) {
}
function test_09_Layer_KaMap_insertRow(t) {
function 09_Layer_KaMap_insertRow(t) {
}
*
@@ -158,42 +158,15 @@
t.ok( (layer.tileSize.h == 50) && (layer.tileSize.w == 500), "tileSize has been set correctly");
}
function test_11_Layer_KaMap_getTile(t) {
t.plan(2);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
//test with tile creation
layer = new OpenLayers.Layer.KaMap(name, url, params, units);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
var gotTile = layer.getTile(tile.id);
t.ok( gotTile == tile, "got right tile");
gotTile = layer.getTile("chicken");
t.ok( gotTile == null, "getTile() of bogus id returns null");
}
function test_99_Layer_KaMap_destroy (t) {
t.plan( 4 );
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.KaMap(name, url, params, units);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.alpha, null, "layer.alpha is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );
+4 -12
View File
@@ -27,7 +27,7 @@
t.ok( map.controls instanceof Array, "map.controls is an Array" );
t.ok( map.events instanceof OpenLayers.Events, "map.events is an OpenLayers.Events" );
t.ok( map.getMaxExtent() instanceof OpenLayers.Bounds, "map.maxExtent is an OpenLayers.Bounds" );
t.ok( map.getMaxZoomLevel() > 0, "map.maxZoomLevel is set" );
t.ok( map.getNumZoomLevels() > 0, "map has a default numZoomLevels" );
}
function test_02_Map_center(t) {
t.plan(3);
@@ -63,8 +63,8 @@
}
function test_04_Map_options(t) {
t.plan(2);
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: 3.14159});
t.eq( map.maxZoomLevel, 5, "map.maxZoomLevel set correctly via options hashtable" );
map = new OpenLayers.Map($('map'), {numZoomLevels: 6, maxResolution: 3.14159});
t.eq( map.numZoomLevels, 6, "map.numZoomLevels set correctly via options hashtable" );
t.eq( map.maxResolution, 3.14159, "map.maxResolution set correctly via options hashtable" );
}
function test_05_Map_center(t) {
@@ -151,18 +151,10 @@
}
t.ok(!found, "popup.div successfully removed from the map's viewPort");
}
function test_10_Map_auto_res(t) {
t.plan(2);
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: 'auto'});
t.eq( map.maxResolution, 1/3, "map.maxResolution set correctly via auto" );
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: null});
t.eq( map.maxResolution, 1/3, "map.maxResolution set correctly via null" );
}
/*** THIS IS A GOOD TEST, BUT IT SHOULD BE MOVED TO WMS.
* Also, it won't work until we figure out the viewSize bug
function test_08_Map_px_lonlat_translation (t) {
function 08_Map_px_lonlat_translation (t) {
t.plan( 6 );
map = new OpenLayers.Map($('map'));
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",