[OpenLayers-Commits] r2311 - in sandbox/vector-2.4/tests: . Control Layer
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 11:30:46 EST 2007
Author: euzuro
Date: 2007-03-05 11:30:45 -0500 (Mon, 05 Mar 2007)
New Revision: 2311
Added:
sandbox/vector-2.4/tests/Control/test_LayerSwitcher.html
sandbox/vector-2.4/tests/Control/test_MouseToolbar.html
sandbox/vector-2.4/tests/Control/test_OverviewMap.html
sandbox/vector-2.4/tests/Control/test_PanZoom.html
sandbox/vector-2.4/tests/Control/test_PanZoomBar.html
sandbox/vector-2.4/tests/Control/test_Permalink.html
sandbox/vector-2.4/tests/Control/test_Scale.html
sandbox/vector-2.4/tests/Layer/test_EventPane.html
sandbox/vector-2.4/tests/Layer/test_FixedZoomLevels.html
sandbox/vector-2.4/tests/Layer/test_GeoRSS.html
sandbox/vector-2.4/tests/Layer/test_Google.html
sandbox/vector-2.4/tests/Layer/test_Grid.html
sandbox/vector-2.4/tests/Layer/test_HTTPRequest.html
sandbox/vector-2.4/tests/Layer/test_Image.html
sandbox/vector-2.4/tests/Layer/test_KaMap.html
sandbox/vector-2.4/tests/Layer/test_Markers.html
sandbox/vector-2.4/tests/Layer/test_MultiMap.html
sandbox/vector-2.4/tests/Layer/test_TMS.html
sandbox/vector-2.4/tests/Layer/test_Text.html
sandbox/vector-2.4/tests/Layer/test_WMS.html
Removed:
sandbox/vector-2.4/tests/Control/test_Control_LayerSwitcher.html
sandbox/vector-2.4/tests/Control/test_Control_MouseToolbar.html
sandbox/vector-2.4/tests/Control/test_Control_OverviewMap.html
sandbox/vector-2.4/tests/Control/test_Control_PanZoom.html
sandbox/vector-2.4/tests/Control/test_Control_PanZoomBar.html
sandbox/vector-2.4/tests/Control/test_Control_Permalink.html
sandbox/vector-2.4/tests/Control/test_Control_Scale.html
sandbox/vector-2.4/tests/Layer/test_Layer_EventPane.html
sandbox/vector-2.4/tests/Layer/test_Layer_FixedZoomLevels.html
sandbox/vector-2.4/tests/Layer/test_Layer_GeoRSS.html
sandbox/vector-2.4/tests/Layer/test_Layer_Google.html
sandbox/vector-2.4/tests/Layer/test_Layer_Grid.html
sandbox/vector-2.4/tests/Layer/test_Layer_HTTPRequest.html
sandbox/vector-2.4/tests/Layer/test_Layer_Image.html
sandbox/vector-2.4/tests/Layer/test_Layer_KaMap.html
sandbox/vector-2.4/tests/Layer/test_Layer_Markers.html
sandbox/vector-2.4/tests/Layer/test_Layer_MultiMap.html
sandbox/vector-2.4/tests/Layer/test_Layer_TMS.html
sandbox/vector-2.4/tests/Layer/test_Layer_Text.html
sandbox/vector-2.4/tests/Layer/test_Layer_WMS.html
Modified:
sandbox/vector-2.4/tests/list-tests.html
Log:
simplify test file names thanks to new hierarchy
Deleted: sandbox/vector-2.4/tests/Control/test_Control_LayerSwitcher.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_LayerSwitcher.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_LayerSwitcher.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,114 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
-
- function test_01_Control_LayerSwitcher_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.LayerSwitcher();
- t.ok( control instanceof OpenLayers.Control.LayerSwitcher, "new OpenLayers.Control.LayerSwitcher returns object" );
- }
-
- function test_02_Control_LayerSwitcher_draw (t) {
- t.plan( 2 );
-
- map = new OpenLayers.Map('map');
- control = new OpenLayers.Control.LayerSwitcher();
- map.addControl(control);
-
- var div = control.draw();
- t.ok( control.div != null, "draw makes a div" );
- t.ok( div != null, "draw returns its div" );
- }
-
- function test_03_Control_LayerSwitcher_loadContents(t) {
-
- t.plan( 5 );
-
- map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.WMS("WMS",
- "http://octo.metacarta.com/cgi-bin/mapserv?",
- {map: "/mapdata/vmap_wms.map", layers: "basic"});
- map.addLayer(layer);
-
- markers = new OpenLayers.Layer.Markers("markers");
- map.addLayer(markers);
-
- control = new OpenLayers.Control.LayerSwitcher();
- map.addControl(control);
-
- t.ok(control.layersDiv != null, "correctly makes layers div");
- t.ok(control.baseLayersDiv != null, "correctly makes layers div");
- t.ok(control.dataLayersDiv != null, "correctly makes layers div");
-
- t.ok(control.maximizeDiv != null, "correctly makes resize div");
- t.ok(control.minimizeDiv != null, "correctly makes resize div");
-
-
-
- }
-
-
- function test_04_Control_LayerSwitcher_redraw (t) {
-
- t.plan( 8 );
-
- map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.WMS("WMS",
- "http://octo.metacarta.com/cgi-bin/mapserv?",
- {map: "/mapdata/vmap_wms.map", layers: "basic"});
- map.addLayer(layer);
-
- markers = new OpenLayers.Layer.Markers("markers");
- map.addLayer(markers);
-
- control = new OpenLayers.Control.LayerSwitcher();
- map.addControl(control);
-
-
- var wmsInput = $("input_" + layer.name);
- t.ok(wmsInput != null, "correctly makes an input for wms layer");
- t.eq(wmsInput.type, "radio", "wms correctly made a radio button");
- t.eq(wmsInput.name, "baseLayers", "wms correctly named");
- t.eq(wmsInput.value, layer.name, "wms correctly valued");
-
- var markersInput = $("input_" + markers.name);
- t.ok(markersInput != null, "correctly makes an input for markers layer");
- t.eq(markersInput.type, "checkbox", "wms correctly made a radio button");
- t.eq(markersInput.name, markers.name, "wms correctly named");
- t.eq(markersInput.value, markers.name, "wms correctly valued");
-
- }
- function test_05_Control_LayerSwitcher_ascendingw (t) {
-
- t.plan( 4 );
-
- map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.WMS("WMS",
- "http://octo.metacarta.com/cgi-bin/mapserv?",
- {map: "/mapdata/vmap_wms.map", layers: "basic"});
- map.addLayer(layer);
-
- markers = new OpenLayers.Layer.Markers("markers");
- map.addLayer(markers);
-
- control = new OpenLayers.Control.LayerSwitcher();
- map.addControl(control);
- control2 = new OpenLayers.Control.LayerSwitcher({'ascending':false});
- map.addControl(control2);
- t.ok(control.div.childNodes[1].childNodes[0].innerHTML.match("Base Layer"), "Base Layers first in LayerSwitcher with ascending true");
- t.ok(control.div.childNodes[1].childNodes[2].innerHTML.match("Overlays"), "Overlays in LayerSwitcher with ascending true");
- t.ok(control2.div.childNodes[1].childNodes[2].innerHTML.match("Base Layer"), "Base Layers last in LayerSwitcher with ascending false");
- t.ok(control2.div.childNodes[1].childNodes[0].innerHTML.match("Overlays"), "Base Layers last in LayerSwitcher with ascending false");
- }
-
-
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_MouseToolbar.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_MouseToolbar.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_MouseToolbar.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,58 +0,0 @@
-<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[3] === control, "map.controls contains control" );
- t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
- t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "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 );
- if ((navigator.userAgent.indexOf("compatible") == -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(), 6, "Map zoom set correctly after zoombox");
- } else {
- t.ok(true, "IE does not run this test.")
- }
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_OverviewMap.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_OverviewMap.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_OverviewMap.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,75 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
- function test_01_Control_PanZoom_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.OverviewMap();
- t.ok( control instanceof OpenLayers.Control.OverviewMap, "new OpenLayers.Control.OverviewMap returns object" );
- }
- function test_02_Control_PanZoom_addControl (t) {
- t.plan( 6 );
- map = new OpenLayers.Map('map');
- control = new OpenLayers.Control.OverviewMap();
- t.ok( control instanceof OpenLayers.Control.OverviewMap, "new OpenLayers.Control.OverviewMap 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[3] === control, "map.controls contains control" );
- t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
- t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
-
- }
- function test_03_Control_PanZoom_control_events (t) {
- t.plan( 10 );
- 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.OverviewMap();
- map.addControl(control, new OpenLayers.Pixel(20,20));
-
- var centerLL = new OpenLayers.LonLat(-71,42);
- map.setCenter(centerLL, 11);
-
- var overviewCenter = control.ovmap.getCenter();
- var overviewZoom = control.ovmap.getZoom();
- t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct");
- t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct");
- t.eq(overviewZoom, 8, "Overviewmap zoomcorrect");
-
- control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)});
-
- var cent = map.getCenter();
- t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
- t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
-
- control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1});
- control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1});
- control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1});
-
- var cent = map.getCenter();
- t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon");
- t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat");
-
- map.setCenter(new OpenLayers.LonLat(0,0), 0);
- var overviewCenter = control.ovmap.getCenter();
- var overviewZoom = control.ovmap.getZoom();
- t.eq(overviewCenter.lon, 0, "Overviewmap center lon correct -- second zoom");
- t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom");
- t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom");
-
-
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_PanZoom.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_PanZoom.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_PanZoom.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,72 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
- function test_01_Control_PanZoom_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.PanZoom();
- t.ok( control instanceof OpenLayers.Control.PanZoom, "new OpenLayers.Control.PanZoom returns object" );
- }
- function test_02_Control_PanZoom_addControl (t) {
- t.plan( 8 );
- map = new OpenLayers.Map('map');
- control = new OpenLayers.Control.PanZoom();
- t.ok( control instanceof OpenLayers.Control.PanZoom, "new OpenLayers.Control.PanZoom 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[3] === control, "map.controls contains control" );
- t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
- t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
- t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
-
- var control2 = new OpenLayers.Control.PanZoom();
- map.addControl(control2, new OpenLayers.Pixel(100,100));
- t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
- }
- function test_03_Control_PanZoom_control_events (t) {
- t.plan( 7 );
- 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.PanZoom();
- map.addControl(control, new OpenLayers.Pixel(20,20));
-
- var centerLL = new OpenLayers.LonLat(0,0);
- map.setCenter(centerLL, 5);
-
- control.buttons[0].onmousedown(evt);
- t.ok( map.getCenter().lat > centerLL.lat, "Pan up works correctly" );
-
- control.buttons[1].onmousedown(evt);
- t.ok( map.getCenter().lon < centerLL.lon, "Pan left works correctly" );
-
- control.buttons[2].onmousedown(evt);
- t.ok( map.getCenter().lon == centerLL.lon, "Pan right works correctly" );
-
- control.buttons[3].onmousedown(evt);
- t.ok( map.getCenter().lat == centerLL.lat, "Pan down works correctly" );
-
- control.buttons[4].onmousedown(evt);
- t.eq( map.getZoom(), 6, "zoomin works correctly" );
-
- control.buttons[6].onmousedown(evt);
- t.eq( map.getZoom(), 5, "zoomout works correctly" );
-
- control.buttons[5].onmousedown(evt);
- t.eq( map.getZoom(), 2, "zoomworld works correctly" );
-
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_PanZoomBar.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_PanZoomBar.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_PanZoomBar.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,39 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
- function test_01_Control_PanZoomBar_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.PanZoomBar();
- t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
- }
- function test_02_Control_PanZoomBar_addControl (t) {
- t.plan( 8 );
- 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);
- control = new OpenLayers.Control.PanZoomBar();
- t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar 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[0] === control, "map.controls contains control" );
- t.eq( parseInt(control.div.style.zIndex), 1001, "Control div zIndexed properly" );
- t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" );
- t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
-
- var control2 = new OpenLayers.Control.PanZoomBar();
- map.addControl(control2, new OpenLayers.Pixel(100,100));
- t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_Permalink.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_Permalink.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_Permalink.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,59 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
- function test_01_Control_Permalink_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.Permalink();
- t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
- }
- function test_02_Control_Permalink_updateLinks (t) {
- t.plan( 2 );
-
- control = new OpenLayers.Control.Permalink($('permalink'));
- t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
- map = new OpenLayers.Map($('map'));
- 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);
- if (!map.getCenter()) map.zoomToMaxExtent();
- map.addControl(control);
- map.pan(5, 0);
- if (/MSIE/.test(navigator.userAgent)) {
- t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2&layers=B", "Panning sets permalink");
- } else {
- t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=B", "Panning sets permalink");
- }
- }
- function test_03_Control_Permalink_updateLinksBase (t) {
- t.plan( 2 );
-
- control = new OpenLayers.Control.Permalink($('permalink'), "./edit.html" );
- t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
- map = new OpenLayers.Map($('map'));
- 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);
- if (!map.getCenter()) map.zoomToMaxExtent();
- map.addControl(control);
- map.pan(5, 0);
- $('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2&layers=B';
- t.eq($('permalink').href, $('edit_permalink').href, "Panning sets permalink with base");
- }
- function test_04_Control_Permalink_noElement (t) {
- t.plan( 2 );
- control = new OpenLayers.Control.Permalink( );
- t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
- map = new OpenLayers.Map($('map'));
- map.addControl(control);
- t.eq(map.controls[3].div.firstChild.nodeName, "A", "Permalink control creates div with 'a' inside." );
- }
- // -->
- </script>
-</head>
-<body>
- <a id="permalink" href="">Permalink</a> <br />
- <a id="edit_permalink" href="">Edit</a> <br />
- <div id="map" style="width: 1024px; height: 512px;"/>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Control/test_Control_Scale.html
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Control_Scale.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Control/test_Control_Scale.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,47 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var map;
- function test_01_Control_Scale_constructor (t) {
- t.plan( 1 );
-
- control = new OpenLayers.Control.Scale();
- t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" );
- }
- function test_02_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'));
- 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($('scale').innerHTML, "Scale = 1 : 443M", "Scale set by default." );
- map.zoomIn();
- t.eq($('scale').innerHTML, "Scale = 1 : 221M", "Zooming in changes scale" );
- map.baseLayer.resolutions = [OpenLayers.Util.getResolutionFromScale(110)];
- map.zoomTo(0);
- t.eq($('scale').innerHTML, "Scale = 1 : 110", "Scale of 100 isn't rounded" );
- }
- function test_03_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'));
- 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>
Copied: sandbox/vector-2.4/tests/Control/test_LayerSwitcher.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_LayerSwitcher.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_LayerSwitcher.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_LayerSwitcher.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,114 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+
+ function test_01_Control_LayerSwitcher_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ t.ok( control instanceof OpenLayers.Control.LayerSwitcher, "new OpenLayers.Control.LayerSwitcher returns object" );
+ }
+
+ function test_02_Control_LayerSwitcher_draw (t) {
+ t.plan( 2 );
+
+ map = new OpenLayers.Map('map');
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+
+ var div = control.draw();
+ t.ok( control.div != null, "draw makes a div" );
+ t.ok( div != null, "draw returns its div" );
+ }
+
+ function test_03_Control_LayerSwitcher_loadContents(t) {
+
+ t.plan( 5 );
+
+ map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.WMS("WMS",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(layer);
+
+ markers = new OpenLayers.Layer.Markers("markers");
+ map.addLayer(markers);
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+
+ t.ok(control.layersDiv != null, "correctly makes layers div");
+ t.ok(control.baseLayersDiv != null, "correctly makes layers div");
+ t.ok(control.dataLayersDiv != null, "correctly makes layers div");
+
+ t.ok(control.maximizeDiv != null, "correctly makes resize div");
+ t.ok(control.minimizeDiv != null, "correctly makes resize div");
+
+
+
+ }
+
+
+ function test_04_Control_LayerSwitcher_redraw (t) {
+
+ t.plan( 8 );
+
+ map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.WMS("WMS",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(layer);
+
+ markers = new OpenLayers.Layer.Markers("markers");
+ map.addLayer(markers);
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+
+
+ var wmsInput = $("input_" + layer.name);
+ t.ok(wmsInput != null, "correctly makes an input for wms layer");
+ t.eq(wmsInput.type, "radio", "wms correctly made a radio button");
+ t.eq(wmsInput.name, "baseLayers", "wms correctly named");
+ t.eq(wmsInput.value, layer.name, "wms correctly valued");
+
+ var markersInput = $("input_" + markers.name);
+ t.ok(markersInput != null, "correctly makes an input for markers layer");
+ t.eq(markersInput.type, "checkbox", "wms correctly made a radio button");
+ t.eq(markersInput.name, markers.name, "wms correctly named");
+ t.eq(markersInput.value, markers.name, "wms correctly valued");
+
+ }
+ function test_05_Control_LayerSwitcher_ascendingw (t) {
+
+ t.plan( 4 );
+
+ map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.WMS("WMS",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(layer);
+
+ markers = new OpenLayers.Layer.Markers("markers");
+ map.addLayer(markers);
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+ control2 = new OpenLayers.Control.LayerSwitcher({'ascending':false});
+ map.addControl(control2);
+ t.ok(control.div.childNodes[1].childNodes[0].innerHTML.match("Base Layer"), "Base Layers first in LayerSwitcher with ascending true");
+ t.ok(control.div.childNodes[1].childNodes[2].innerHTML.match("Overlays"), "Overlays in LayerSwitcher with ascending true");
+ t.ok(control2.div.childNodes[1].childNodes[2].innerHTML.match("Base Layer"), "Base Layers last in LayerSwitcher with ascending false");
+ t.ok(control2.div.childNodes[1].childNodes[0].innerHTML.match("Overlays"), "Base Layers last in LayerSwitcher with ascending false");
+ }
+
+
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_MouseToolbar.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_MouseToolbar.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_MouseToolbar.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_MouseToolbar.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,58 @@
+<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[3] === control, "map.controls contains control" );
+ t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
+ t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "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 );
+ if ((navigator.userAgent.indexOf("compatible") == -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(), 6, "Map zoom set correctly after zoombox");
+ } else {
+ t.ok(true, "IE does not run this test.")
+ }
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_OverviewMap.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_OverviewMap.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_OverviewMap.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_OverviewMap.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,75 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+ function test_01_Control_PanZoom_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.OverviewMap();
+ t.ok( control instanceof OpenLayers.Control.OverviewMap, "new OpenLayers.Control.OverviewMap returns object" );
+ }
+ function test_02_Control_PanZoom_addControl (t) {
+ t.plan( 6 );
+ map = new OpenLayers.Map('map');
+ control = new OpenLayers.Control.OverviewMap();
+ t.ok( control instanceof OpenLayers.Control.OverviewMap, "new OpenLayers.Control.OverviewMap 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[3] === control, "map.controls contains control" );
+ t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
+ t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
+
+ }
+ function test_03_Control_PanZoom_control_events (t) {
+ t.plan( 10 );
+ 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.OverviewMap();
+ map.addControl(control, new OpenLayers.Pixel(20,20));
+
+ var centerLL = new OpenLayers.LonLat(-71,42);
+ map.setCenter(centerLL, 11);
+
+ var overviewCenter = control.ovmap.getCenter();
+ var overviewZoom = control.ovmap.getZoom();
+ t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct");
+ t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct");
+ t.eq(overviewZoom, 8, "Overviewmap zoomcorrect");
+
+ control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)});
+
+ var cent = map.getCenter();
+ t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
+ t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
+
+ control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1});
+ control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1});
+ control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1});
+
+ var cent = map.getCenter();
+ t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon");
+ t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat");
+
+ map.setCenter(new OpenLayers.LonLat(0,0), 0);
+ var overviewCenter = control.ovmap.getCenter();
+ var overviewZoom = control.ovmap.getZoom();
+ t.eq(overviewCenter.lon, 0, "Overviewmap center lon correct -- second zoom");
+ t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom");
+ t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom");
+
+
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_PanZoom.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_PanZoom.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_PanZoom.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_PanZoom.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,72 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+ function test_01_Control_PanZoom_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.PanZoom();
+ t.ok( control instanceof OpenLayers.Control.PanZoom, "new OpenLayers.Control.PanZoom returns object" );
+ }
+ function test_02_Control_PanZoom_addControl (t) {
+ t.plan( 8 );
+ map = new OpenLayers.Map('map');
+ control = new OpenLayers.Control.PanZoom();
+ t.ok( control instanceof OpenLayers.Control.PanZoom, "new OpenLayers.Control.PanZoom 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[3] === control, "map.controls contains control" );
+ t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
+ t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
+ t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
+
+ var control2 = new OpenLayers.Control.PanZoom();
+ map.addControl(control2, new OpenLayers.Pixel(100,100));
+ t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
+ }
+ function test_03_Control_PanZoom_control_events (t) {
+ t.plan( 7 );
+ 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.PanZoom();
+ map.addControl(control, new OpenLayers.Pixel(20,20));
+
+ var centerLL = new OpenLayers.LonLat(0,0);
+ map.setCenter(centerLL, 5);
+
+ control.buttons[0].onmousedown(evt);
+ t.ok( map.getCenter().lat > centerLL.lat, "Pan up works correctly" );
+
+ control.buttons[1].onmousedown(evt);
+ t.ok( map.getCenter().lon < centerLL.lon, "Pan left works correctly" );
+
+ control.buttons[2].onmousedown(evt);
+ t.ok( map.getCenter().lon == centerLL.lon, "Pan right works correctly" );
+
+ control.buttons[3].onmousedown(evt);
+ t.ok( map.getCenter().lat == centerLL.lat, "Pan down works correctly" );
+
+ control.buttons[4].onmousedown(evt);
+ t.eq( map.getZoom(), 6, "zoomin works correctly" );
+
+ control.buttons[6].onmousedown(evt);
+ t.eq( map.getZoom(), 5, "zoomout works correctly" );
+
+ control.buttons[5].onmousedown(evt);
+ t.eq( map.getZoom(), 2, "zoomworld works correctly" );
+
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_PanZoomBar.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_PanZoomBar.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_PanZoomBar.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_PanZoomBar.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+ function test_01_Control_PanZoomBar_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.PanZoomBar();
+ t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
+ }
+ function test_02_Control_PanZoomBar_addControl (t) {
+ t.plan( 8 );
+ 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);
+ control = new OpenLayers.Control.PanZoomBar();
+ t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar 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[0] === control, "map.controls contains control" );
+ t.eq( parseInt(control.div.style.zIndex), 1001, "Control div zIndexed properly" );
+ t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" );
+ t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
+
+ var control2 = new OpenLayers.Control.PanZoomBar();
+ map.addControl(control2, new OpenLayers.Pixel(100,100));
+ t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_Permalink.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_Permalink.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Permalink.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_Permalink.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,59 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+ function test_01_Control_Permalink_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.Permalink();
+ t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
+ }
+ function test_02_Control_Permalink_updateLinks (t) {
+ t.plan( 2 );
+
+ control = new OpenLayers.Control.Permalink($('permalink'));
+ t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
+ map = new OpenLayers.Map($('map'));
+ 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);
+ if (!map.getCenter()) map.zoomToMaxExtent();
+ map.addControl(control);
+ map.pan(5, 0);
+ if (/MSIE/.test(navigator.userAgent)) {
+ t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2&layers=B", "Panning sets permalink");
+ } else {
+ t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=B", "Panning sets permalink");
+ }
+ }
+ function test_03_Control_Permalink_updateLinksBase (t) {
+ t.plan( 2 );
+
+ control = new OpenLayers.Control.Permalink($('permalink'), "./edit.html" );
+ t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
+ map = new OpenLayers.Map($('map'));
+ 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);
+ if (!map.getCenter()) map.zoomToMaxExtent();
+ map.addControl(control);
+ map.pan(5, 0);
+ $('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2&layers=B';
+ t.eq($('permalink').href, $('edit_permalink').href, "Panning sets permalink with base");
+ }
+ function test_04_Control_Permalink_noElement (t) {
+ t.plan( 2 );
+ control = new OpenLayers.Control.Permalink( );
+ t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
+ map = new OpenLayers.Map($('map'));
+ map.addControl(control);
+ t.eq(map.controls[3].div.firstChild.nodeName, "A", "Permalink control creates div with 'a' inside." );
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <a id="permalink" href="">Permalink</a> <br />
+ <a id="edit_permalink" href="">Edit</a> <br />
+ <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Control/test_Scale.html (from rev 2309, sandbox/vector-2.4/tests/Control/test_Control_Scale.html)
===================================================================
--- sandbox/vector-2.4/tests/Control/test_Scale.html (rev 0)
+++ sandbox/vector-2.4/tests/Control/test_Scale.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,47 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var map;
+ function test_01_Control_Scale_constructor (t) {
+ t.plan( 1 );
+
+ control = new OpenLayers.Control.Scale();
+ t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" );
+ }
+ function test_02_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'));
+ 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($('scale').innerHTML, "Scale = 1 : 443M", "Scale set by default." );
+ map.zoomIn();
+ t.eq($('scale').innerHTML, "Scale = 1 : 221M", "Zooming in changes scale" );
+ map.baseLayer.resolutions = [OpenLayers.Util.getResolutionFromScale(110)];
+ map.zoomTo(0);
+ t.eq($('scale').innerHTML, "Scale = 1 : 110", "Scale of 100 isn't rounded" );
+ }
+ function test_03_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'));
+ 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>
Copied: sandbox/vector-2.4/tests/Layer/test_EventPane.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_EventPane.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_EventPane.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_EventPane.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,114 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
+ var layer;
+
+ function test_01_Layer_EventPane_constructor (t) {
+ t.plan( 5 );
+
+ var layer = new OpenLayers.Layer.EventPane('Test Layer');
+
+ t.ok( layer instanceof OpenLayers.Layer.EventPane, "new OpenLayers.Layer.EventPane returns object" );
+ t.eq( layer.CLASS_NAME, "OpenLayers.Layer.EventPane", "CLASS_NAME variable set correctly");
+ t.eq( layer.name, "Test Layer", "layer.name is correct" );
+ t.eq( layer.isBaseLayer, true, "EventPane layer is always base layer" );
+ if (!isMozilla) {
+ t.ok( true, "skipping element test outside of Mozilla");
+ } else {
+ t.ok( layer.pane instanceof HTMLDivElement, "layer.pane is an HTMLDivElement" );
+ }
+ }
+
+ function test_02_Layer_EventPane_clone (t) {
+ t.plan( 1 );
+ t.ok( true, "need to actually write some tests here" );
+ return;
+
+ /// FIX ME FIX ME: fix this later
+
+ var map = new OpenLayers.Map('map');
+ var options = { chicken: 151, foo: "bar" };
+ var layer = new OpenLayers.Layer('Test Layer', options);
+ map.addLayer(layer);
+
+ // randomly assigned property
+ layer.chocolate = 5;
+
+ var clone = layer.clone();
+
+ t.ok( clone instanceof OpenLayers.Layer, "new OpenLayers.Layer returns object" );
+ t.eq( clone.name, "Test Layer", "default clone.name is correct" );
+ t.ok( ((clone.options["chicken"] == 151) && (clone.options["foo"] == "bar")), "clone.options correctly set" );
+ t.eq(clone.chocolate, 5, "correctly copied randomly assigned property");
+
+ layer.addOptions({chicken:152});
+ t.eq(clone.options["chicken"], 151, "made a clean copy of options");
+
+
+ t.ok( clone.map == null, "cloned layer has map property set to null")
+
+ }
+
+ function test_10_Layer_EventPane_setMap (t) {
+
+// MOUSEMOVE test does not seem to work...
+// t.plan( 2 );
+
+ if (!isMozilla || isOpera) {
+ t.plan(4);
+ } else {
+ t.plan(3);
+ }
+ var map = new OpenLayers.Map('map');
+
+ layer = new OpenLayers.Layer.EventPane('Test Layer');
+
+ //give dummy function so test wont bomb on layer.setMap()
+ layer.loadMapObject = function() { };
+ layer.getWarningHTML = function() { this.warning = true; return ""; };
+ map.addLayer(layer);
+ t.eq( parseInt(layer.pane.style.zIndex) - parseInt(layer.div.style.zIndex),
+ 1, "layer pane is 1 z-level above its div" );
+
+ t.ok( layer.warning, "warning correctly registered on no mapObject load" );
+
+ layer2 = new OpenLayers.Layer.EventPane('Test Layer');
+
+ //give dummy function so test wont bomb on layer.setMap()
+ layer2.loadMapObject = function() { this.mapObject = new Object(); };
+ layer2.getWarningHTML = function() { this.warning = true; return ""; }
+
+ map.addLayer(layer2);
+ t.ok( !layer2.warning, "warning not registered on mapObject load" );
+
+ map.events.register("mousemove", map, function () {
+ t.ok(true, "got mouse move");
+ });
+
+ if( document.createEvent ) { // Mozilla
+ var evObj = document.createEvent('MouseEvents');
+ evObj.initEvent( 'mousemove', true, false );
+ layer.pane.dispatchEvent(evObj);
+ } else if( document.createEventObject ) { // IE
+ layer.pane.fireEvent('onmousemove');
+ }
+ }
+
+ function test_20_Layer_EventPane_setVisibility (t) {
+ t.plan( 2 );
+ layer = new OpenLayers.Layer.EventPane('Test Layer');
+ layer.setVisibility(false);
+ t.eq(layer.visibility, false, "layer pane is now invisible");
+ layer.setVisibility(true);
+ t.eq(layer.visibility, true, "layer pane is now visible");
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="height:500px;width:500px"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_FixedZoomLevels.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_FixedZoomLevels.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_FixedZoomLevels.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_FixedZoomLevels.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,97 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var layer;
+
+ function test_01_Layer_FixedZoomLevels (t) {
+ t.plan( 36 );
+
+ var layer = { 'MIN_ZOOM_LEVEL': 5,
+ 'MAX_ZOOM_LEVEL': 10 };
+
+
+ //defaults
+
+ layer = p_createLayer(layer);
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "nothing specified");
+
+
+ //layer.options
+
+ // min,num
+ layer = p_createLayer(layer, {}, { minZoomLevel: 3, numZoomLevels: 12});
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "min too low num too high(layer.options)");
+
+ layer = p_createLayer(layer, {}, { minZoomLevel: 6, numZoomLevels: 3 });
+ p_minMaxNum(t, layer, 6, 8, "valid min,num(layer.options)");
+
+
+ // max
+ layer = p_createLayer(layer, {}, { maxZoomLevel: 9 });
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 9, "valid max(layer.options)");
+
+ layer = p_createLayer(layer, {}, { maxZoomLevel: 12 });
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "invalid max(layer.options)");
+
+
+
+ //map
+
+ // min,num
+ layer = p_createLayer(layer, { minZoomLevel: 3, numZoomLevels: 12});
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "min too low num too high(map)");
+
+ layer = p_createLayer(layer, { minZoomLevel: 6, numZoomLevels: 3 });
+ p_minMaxNum(t, layer, 6, 8, "valid min,num(map)");
+
+
+ // max
+ layer = p_createLayer(layer, { maxZoomLevel: 9 });
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 9, "valid max(map)");
+
+ layer = p_createLayer(layer, { maxZoomLevel: 12 });
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "invalid max(map)");
+
+ //map vs. options
+
+ layer = p_createLayer(layer, {minZoomLevel: 6, numZoomLevels: 2}, { minZoomLevel: 7, numZoomLevels: 3});
+ p_minMaxNum(t, layer, 7, 9, "min,num(layer.options) wins over (map)");
+
+ layer = p_createLayer(layer, {minZoomLevel: 6, maxZoomLevel: 8}, { minZoomLevel: 7, maxZoomLevel: 9});
+ p_minMaxNum(t, layer, 7, 9, "min,max(layer.options) wins over (map)");
+
+
+ // numZoomLevels vs. maxZoomLevel
+
+ layer = p_createLayer(layer, {maxZoomLevel: 8, numZoomLevels: 6});
+ p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 10, "min,max(layer.options) wins over (map)");
+
+
+
+ }
+
+ function p_createLayer(layer, mapOptions, layerOptions) {
+
+ layer.map = mapOptions || {};
+ layer.options = layerOptions || {};
+ OpenLayers.Layer.FixedZoomLevels.prototype.initResolutions.apply(layer);
+
+ return layer;
+ }
+
+ function p_minMaxNum(t, layer, min, max, msg) {
+
+ t.eq( layer.minZoomLevel, min, "min zoom level inherited from layer constant: " + msg);
+ t.eq( layer.maxZoomLevel, max, "max zoom level inherited from layer constant: " + msg);
+ t.eq( layer.numZoomLevels, max - min + 1, "num zoom levels correctly calcuated: " + msg);
+
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_GeoRSS.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_GeoRSS.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_GeoRSS.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_GeoRSS.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,89 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
+ var layer;
+
+ function test_01_Layer_GeoRSS_constructor (t) {
+ t.plan( 5 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./georss.txt" );
+ t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
+ t.eq( layer.location, "./georss.txt", "layer.location is correct" );
+ var markers;
+ t.delay_call( 1, function() {
+ t.eq( layer.markers.length, 40, "marker length is correct" );
+ var ll = new OpenLayers.LonLat(-71.142197, 42.405696);
+ t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
+ t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." );
+ } );
+ }
+
+ function test_01_Layer_GeoRSS_AtomParsing (t) {
+ t.plan( 6 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./atom-1.0.xml" );
+ t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
+ t.eq( layer.location, "./atom-1.0.xml", "layer.location is correct" );
+ var markers;
+ t.delay_call( 1, function() {
+ t.eq( layer.markers.length, 2, "marker length is correct" );
+ var ll = new OpenLayers.LonLat(29.9805, 36.7702);
+ t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
+ t.like( layer.features[0].data['popupContentHTML'], '<a class="link" href="http://pleiades.stoa.org/places/638896" target="_blank">Unnamed Tumulus</a>', "Link is correct.");
+ t.eq( layer.name, "tumulus", "Layer name is correct." );
+ } );
+ }
+
+ function test_02_Layer_GeoRSS_draw (t) {
+// t.plan(5);
+ t.plan( 2 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
+ t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
+ var map = new OpenLayers.Map('map');
+ var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(baseLayer);
+ map.addLayer(layer);
+ t.delay_call( 1, function() {
+ map.setCenter(new OpenLayers.LonLat(0,0),0);
+ t.eq( map.layers[1].name, layer.name, "Layer name is correct" );
+
+ });;
+ }
+ function test_03_Layer_GeoRSS_events (t) {
+ t.plan( 4 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
+ var map = new OpenLayers.Map('map');
+ var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(baseLayer);
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0,0),0);
+ var event = {};
+ t.delay_call( 1, function() {
+ t.ok(layer.markers[0].events, "First marker has an events object");
+ t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object");
+ layer.markers[0].events.triggerEvent('click', event);
+ t.eq(map.popups.length, 1, "Popup opened correctly");
+ layer.markers[1].events.triggerEvent('click', event);
+ t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
+ });
+ }
+
+ function test_99_Layer_GeoRSS_destroy (t) {
+ t.plan( 1 );
+ layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
+ var map = new OpenLayers.Map('map');
+ map.addLayer(layer);
+ layer.destroy();
+ t.eq( layer.map, null, "layer.map is null after destroy" );
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width:500px; height:500px"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_Google.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_Google.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Google.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_Google.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,156 @@
+<html>
+<head>
+ <!-- this gmaps key generated for http://openlayers.org/dev/ -->
+ <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghSPUCi5aRYVveCcVYxzezM4iaj_gxQ9t-UajFL70jfcpquH5l1IJ-Zyyw'></script>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var layer;
+
+ function test_01_Layer_Google_constructor (t) {
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+ map.addLayer(layer);
+
+
+ t.ok( layer instanceof OpenLayers.Layer.Google, "new OpenLayers.Layer.Google returns object" );
+ t.eq( layer.CLASS_NAME, "OpenLayers.Layer.Google", "CLASS_NAME variable set correctly");
+
+ t.eq( layer.name, "Goog Layer", "layer.name is correct" );
+
+ t.ok ( layer.gmap != null, "GMap2 Object correctly loaded");
+ }
+
+ function test_02_Layer_Google_isBaseLayer (t) {
+ t.plan(1);
+
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+
+ t.ok(layer.isBaseLayer, "a default load of google layer responds as a base layer");
+ }
+
+ function test_03_Layer_Google_Translation_zoom (t) {
+
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+ map.addLayer(layer);
+
+ // these two lines specify an appropriate translation.
+ // the code afterwards works by itself to test that translation
+ // works correctly both ways.
+ var gZoom = 5;
+ var correspondingOLZoom = 5;
+
+
+ olZoom = layer.getOLZoomFromGZoom(gZoom);
+ t.eq(olZoom, correspondingOLZoom, "Translation from GZoom to OL Zoom works");
+ t.eq(layer.getGZoomFromOLZoom(olZoom), gZoom, "Translation from OL Zoom to GZoom works");
+
+ t.ok( layer.getGZoomFromOLZoom(null) == null, "getGZoomFromOLZoom(null) returns null");
+ t.ok( layer.getOLZoomFromGZoom(null) == null, "getOLZoomFromGZoom(null) returns null");
+ }
+
+ function test_04_Layer_Google_Translation_lonlat (t) {
+
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+ map.addLayer(layer);
+
+ // these two lines specify an appropriate translation.
+ // the code afterwards works by itself to test that translation
+ // works correctly both ways.
+ var gLatLng = new GLatLng(50,100);
+ var correspondingOLLonLat = new OpenLayers.LonLat(100,50);
+
+
+ olLonLat = layer.getOLLonLatFromGLatLng(gLatLng);
+ t.ok(olLonLat.equals(correspondingOLLonLat), "Translation from GLatLng to OpenLayers.LonLat works");
+
+ var transGLatLng = layer.getGLatLngFromOLLonLat(olLonLat);
+ t.ok( transGLatLng.equals(gLatLng), "Translation from OpenLayers.LonLat to GLatLng works");
+
+ t.ok( layer.getGLatLngFromOLLonLat(null) == null, "getGLatLngFromOLLonLat(null) returns null");
+ t.ok( layer.getOLLonLatFromGLatLng(null) == null, "getOLLonLatFromGLatLng(null) returns null");
+ }
+
+ function test_05_Layer_Google_Translation_pixel (t) {
+
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+ map.addLayer(layer);
+
+ // these two lines specify an appropriate translation.
+ // the code afterwards works by itself to test that translation
+ // works correctly both ways.
+ var gPoint = new GPoint(50,100);
+ var correspondingOLPixel = new OpenLayers.Pixel(50, 100);
+
+
+ olPixel = layer.getOLPixelFromGPoint(gPoint);
+ t.ok( olPixel.equals(correspondingOLPixel), "Translation from GPoint to OpenLayers.Pixel works");
+
+ var transGPoint = layer.getGPointFromOLPixel(olPixel);
+ t.ok( transGPoint.equals(gPoint), "Translation from OpenLayers.Pixel to GPoint works");
+
+ t.ok( layer.getGPointFromOLPixel(null) == null, "getGPointFromOLPixel(null) returns null");
+ t.ok( layer.getOLPixelFromGPoint(null) == null, "getOLPixelFromGPoint(null) returns null");
+ }
+
+ function test_06_Layer_Google_Translation_bounds (t) {
+
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.Google('Goog Layer');
+ map.addLayer(layer);
+
+ // these two lines specify an appropriate translation.
+ // the code afterwards works by itself to test that translation
+ // works correctly both ways.
+ var sw = new GLatLng(10,20);
+ var ne = new GLatLng(50,40)
+ var gBounds = new GLatLngBounds(sw, ne);
+ var correspondingOLBounds = new OpenLayers.Bounds(20, 10, 40, 50);
+
+
+ olBounds = layer.getOLBoundsFromGLatLngBounds(gBounds);
+
+ t.ok(olBounds.equals(correspondingOLBounds), "Translation from GLatLngBounds to OpenLayers.Bounds works");
+
+ var transGBounds = layer.getGLatLngBoundsFromOLBounds(olBounds);
+ t.ok( transGBounds.equals(gBounds), "Translation from OpenLayers.Bounds to GLatLngBounds works");
+
+ t.ok( layer.getGLatLngBoundsFromOLBounds(null) == null, "getGLatLngBoundsFromOLBounds(null) returns null");
+ t.ok( layer.getOLBoundsFromGLatLngBounds(null) == null, "getOLBoundsFromGLatLngBounds(null) returns null");
+ }
+
+ function test_99_Layer_destroy (t) {
+ t.plan( 5 );
+
+ var map = new OpenLayers.Map('map');
+
+ layer = new OpenLayers.Layer.Google('Test Layer');
+ map.addLayer(layer);
+
+ layer.destroy();
+
+ t.eq( layer.name, null, "layer.name is null after destroy" );
+ t.eq( layer.div, null, "layer.div is null after destroy" );
+ t.eq( layer.map, null, "layer.map is null after destroy" );
+ t.eq( layer.options, null, "layer.options is null after destroy" );
+ t.eq( layer.gmap, null, "layer.gmap is null after destroy" );
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_Grid.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_Grid.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Grid.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_Grid.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,206 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
+ var layer;
+
+ var name = 'Test Layer';
+ var url = "http://octo.metacarta.com/cgi-bin/mapserv";
+ var params = { map: '/mapdata/vmap_wms.map',
+ layers: 'basic',
+ format: 'image/png'};
+
+ /**
+ * NOTE TO READER:
+ *
+ * Some of the tests on the Grid class actually use the WMS class.
+ * This is because WMS is a subclass of Grid and it implements the
+ * core functions which are necessary to test the tile-generation
+ * mechanism.
+ *
+ */
+
+
+ function test_01_Layer_Grid_constructor (t) {
+ t.plan( 1 );
+
+ layer = new OpenLayers.Layer.Grid(name, url, params, null);
+ t.ok( layer instanceof OpenLayers.Layer.Grid, "returns OpenLayers.Layer.Grid object" );
+ }
+
+
+ function test_02_Layer_Grid_inittiles (t) {
+ t.plan( 2 );
+ var map = new OpenLayers.Map($('map'));
+ layer = new OpenLayers.Layer.WMS(name, url, params);
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0,0),5);
+ t.eq( layer.grid.length, 7, "Grid rows is correct." );
+ t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
+
+ }
+
+ function test_03_Layer_Grid_clearTiles (t) {
+ t.plan(1);
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.WMS(name, url, params);
+ map.addLayer(layer);
+
+ map.setCenter(new OpenLayers.LonLat(0,0));
+
+
+ //grab a reference to one of the tiles
+ var tile = layer.grid[0][0];
+
+ layer.clearGrid();
+
+ t.ok( layer.grid != null, "layer.grid does not get nullified" );
+ }
+
+
+ function test_04_Layer_Grid_getGridBounds(t) {
+ t.plan( 1 );
+
+ layer = new OpenLayers.Layer.WMS(name, url, params);
+
+ var bl = { bounds: new OpenLayers.Bounds(1,2,0,0)};
+ var tr = { bounds: new OpenLayers.Bounds(0,0,3,4)};
+ layer.grid = [ [6, tr],
+ [bl, 7]];
+
+ var bounds = layer.getGridBounds();
+
+ var testBounds = new OpenLayers.Bounds(1,2,3,4);
+
+ t.ok( bounds.equals(testBounds), "getGridBounds() returns correct bounds")
+
+ layer.grid = null;
+ }
+
+ function test_05_Layer_Grid_getResolution(t) {
+ t.plan( 1 );
+
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.WMS(name, url, params);
+ map.addLayer(layer);
+
+ map.zoom = 5;
+
+ t.eq( layer.getResolution(), 0.0439453125, "getResolution() returns correct value");
+ }
+
+ function test_06_Layer_Grid_getZoomForExtent(t) {
+ t.plan( 2 );
+ var bounds, zoom;
+
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.WMS(name, url, params);
+ map.addLayer(layer);
+
+ bounds = new OpenLayers.Bounds(10,10,12,12);
+ zoom = layer.getZoomForExtent(bounds);
+
+ t.eq( zoom, 8, "getZoomForExtent() returns correct value");
+
+ bounds = new OpenLayers.Bounds(10,10,100,100);
+ zoom = layer.getZoomForExtent(bounds);
+
+ t.eq( zoom, 2, "getZoomForExtent() returns correct value");
+ }
+
+
+ /** THIS WOULD BE WHERE THE TESTS WOULD GO FOR
+ *
+ * -moveTo
+ * -insertColumn
+ * -insertRow
+
+ function 07_Layer_Grid_moveTo(t) {
+ }
+
+ function 08_Layer_Grid_insertColumn(t) {
+ }
+
+ function 09_Layer_Grid_insertRow(t) {
+ }
+
+ *
+ */
+
+ function test_10_Layer_Grid_clone(t) {
+ t.plan(5);
+
+ var options = {tileSize: new OpenLayers.Size(500,50)};
+ var map = new OpenLayers.Map('map', options);
+ layer = new OpenLayers.Layer.Grid(name, url, params);
+ map.addLayer(layer);
+
+ layer.grid = [ [6, 7],
+ [8, 9]];
+
+ var clone = layer.clone();
+
+ t.ok( clone.grid != layer.grid, "clone does not copy grid");
+ t.ok( clone.grid.length == 0, "clone creates a new array instead");
+
+ t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
+
+ layer.tileSize.w += 40;
+
+ t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
+
+ t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
+
+ layer.grid = null;
+ }
+
+ function test_11_Layer_Grid_setMap(t) {
+
+ t.plan(2);
+
+ var options = {tileSize: new OpenLayers.Size(500,50)};
+ var map = new OpenLayers.Map('map', options);
+ layer = new OpenLayers.Layer.Grid(name, url, params);
+
+
+ layer.setMap(map);
+
+ t.ok( layer.tileSize != null, "tileSize has been set");
+ t.ok( (layer.tileSize.h == 50) && (layer.tileSize.w == 500), "tileSize has been set correctly");
+ }
+
+
+ function test_99_Layer_Grid_destroy (t) {
+
+ 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.tileSize, null, "layer.tileSize is null after destroy" );
+
+
+ //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];
+
+ layer.destroy();
+
+ t.ok( layer.grid == null, "tiles appropriately destroyed")
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+<div id="map" style="width:500px;height:550px;display:none"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_HTTPRequest.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_HTTPRequest.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_HTTPRequest.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_HTTPRequest.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,183 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var layer;
+
+ var name = "Test Layer";
+ var url = "http://octo.metacarta.com/cgi-bin/mapserv";
+ var params = { map: '/mapdata/vmap_wms.map',
+ layers: 'basic',
+ format: 'image/png'};
+ var options = { chicken: 151, foo: "bar" };
+
+ function test_01_Layer_HTTPRequest_constructor (t) {
+ t.plan( 5 );
+
+ layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
+
+ t.ok( layer instanceof OpenLayers.Layer.HTTPRequest, "new OpenLayers.Layer.HTTPRequest returns correctly typed object" );
+
+ // correct bubbling up to Layer.initialize()
+ t.eq( layer.name, name, "layer.name is correct" );
+ t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly set" );
+
+ // HTTPRequest-specific properties
+ t.eq( layer.url, url, "layer.name is correct" );
+ t.ok( ((layer.params["map"] == '/mapdata/vmap_wms.map') &&
+ (layer.params["layers"] == "basic") &&
+ (layer.params["format"] == "image/png")), "layer.params correctly set" );
+
+
+ }
+
+ function test_02_Layer_HTTPRequest_clone (t) {
+ t.plan( 6 );
+
+ var toClone = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
+ toClone.chocolate = 5;
+
+ var layer = toClone.clone();
+
+ t.eq(layer.chocolate, 5, "correctly copied randomly assigned property");
+
+ t.ok( layer instanceof OpenLayers.Layer.HTTPRequest, "new OpenLayers.Layer.HTTPRequest returns correctly typed object" );
+
+ // correct bubbling up to Layer.initialize()
+ t.eq( layer.name, name, "layer.name is correct" );
+ t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly set" );
+
+ // HTTPRequest-specific properties
+ t.eq( layer.url, url, "layer.name is correct" );
+ t.ok( ((layer.params["map"] == '/mapdata/vmap_wms.map') &&
+ (layer.params["layers"] == "basic") &&
+ (layer.params["format"] == "image/png")), "layer.params correctly set" );
+
+ }
+
+ function test_03_Layer_HTTPRequest_setUrl (t) {
+ t.plan( 1 );
+
+ layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
+
+ layer.setUrl("foo");
+ t.eq( layer.url, "foo", "setUrl() works");
+ }
+
+ function test_05_Layer_HTTPRequest_mergeNewParams (t) {
+ t.plan( 3 );
+
+ layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
+
+ var newParams = { layers: 'sooper',
+ chickpeas: 'image/png'};
+
+ layer.mergeNewParams(newParams);
+
+ t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
+ t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
+
+ newParams.chickpeas = 151;
+
+ t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hash");
+
+
+ }
+
+ function test_06_Layer_HTTPRequest_getFullRequestString (t) {
+
+ tParams = { layers: 'basic',
+ format: 'image/png'};
+
+ t.plan( 9 );
+
+ // without ?
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?");
+
+
+ // with ?
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?";
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?");
+
+ // with ?param1=5
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5";
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5");
+
+ // with ?param1=5&
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&format=image/jpeg";
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString({'layers':'basic'}), "getFullRequestString() doesn't override already-existing params in URL");
+
+
+ // with ?param1=5&
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&";
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5&");
+
+
+
+ // passing in new params
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
+ str = layer.getFullRequestString( { chicken: 6,
+ layers:"road" } );
+ t.eq(str, tUrl + OpenLayers.Util.getParameterString({layers: 'road', format: "image/png", chicken: 6}), "getFullRequestString() works for passing in new params");
+
+ // layer with null params
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
+ str = layer.getFullRequestString();
+ t.eq(str, tUrl + OpenLayers.Util.getParameterString({}), "getFullRequestString() works for layer with null params");
+
+ // layer with null params passing in new params
+ layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
+ str = layer.getFullRequestString( { chicken: 6,
+ layers:"road" } );
+ t.eq(str, tUrl + OpenLayers.Util.getParameterString({chicken: 6, layers: "road"}), "getFullRequestString() works for layer with null params passing in new params");
+
+ // with specified altUrl parameter
+ tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
+ layer = new OpenLayers.Layer.HTTPRequest(name, "chicken", tParams, null);
+ str = layer.getFullRequestString(null, tUrl);
+ t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?");
+
+ }
+
+ function test_99_Layer_HTTPRequest_destroy (t) {
+ t.plan( 6 );
+
+ var map = new OpenLayers.Map('map');
+
+ layer = new OpenLayers.Layer.HTTPRequest("Test Layer",
+ "http://www.openlayers.org",
+ { foo: 2, bar: 3},
+ { opt1: 8, opt2: 9});
+
+ map.addLayer(layer);
+ layer.destroy();
+
+ // Ensure Layer.destroy() is called
+ t.eq( layer.name, null, "layer.name is null after destroy" );
+ t.eq( layer.div, null, "layer.div is null after destroy" );
+ t.eq( layer.map, null, "layer.map is null after destroy" );
+ t.eq( layer.options, null, "layer.options is null after destroy" );
+
+
+ // Specific to HTTPRequest
+ t.eq( layer.url, null, "layer.url is null after destroy" );
+ t.eq( layer.params, null, "layer.params is null after destroy" );
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_Image.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_Image.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Image.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_Image.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,96 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var layer;
+
+ function test_01_Layer_Image_constructor (t) {
+ t.plan( 13 );
+
+ var options = { chicken: 151, foo: "bar", projection: "none" };
+ var layer = new OpenLayers.Layer.Image('Test Layer',
+ 'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
+ new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
+ new OpenLayers.Size(580, 288), options);
+
+ t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
+ t.eq( layer.CLASS_NAME, "OpenLayers.Layer.Image", "CLASS_NAME variable set correctly");
+
+ t.eq( layer.name, "Test Layer", "layer.name is correct" );
+ t.ok( layer.id != null, "Layer is given an id");
+ t.ok( layer.projection, "none", "default layer projection correctly set");
+ t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
+ t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
+
+ options.chicken = 552;
+
+ t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" );
+
+ t.eq( layer.isBaseLayer, true, "Default img layer is base layer" );
+
+ layer = new OpenLayers.Layer.Image('Test Layer',
+ 'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
+ new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
+ new OpenLayers.Size(580, 288));
+ t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
+ t.eq( layer.name, "Test Layer", "layer.name is correct" );
+ t.ok( layer.projection == null, "default layer projection correctly set");
+ t.ok( layer.options instanceof Object, "layer.options correctly initialized as a non-null Object" );
+ }
+
+ function test_50_Layer_Image_tileTests (t) {
+ t.plan(4);
+ var map = new OpenLayers.Map('map');
+
+ layer = new OpenLayers.Layer.Image('Test Layer',
+ 'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
+ new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
+ new OpenLayers.Size(580, 288));
+
+ map.addLayer(layer);
+ map.zoomToMaxExtent();
+ t.eq(layer.tile.position.x,-40, "Tile x positioned correctly at maxextent");
+ t.eq(layer.tile.position.y,107, "Tile y positioned correctly at maxextent");
+ t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
+ map.zoomIn();
+ t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
+ }
+/******
+ *
+ *
+ * HERE IS WHERE SOME TESTS SHOULD BE PUT TO CHECK ON THE LONLAT-PX TRANSLATION
+ * FUNCTIONS AND RESOLUTION AND GETEXTENT GETZOOMLEVEL, ETC
+ *
+ *
+ */
+
+
+ function test_99_Layer_Image_destroy (t) {
+ t.plan( 4 );
+
+ var map = new OpenLayers.Map('map');
+
+ layer = new OpenLayers.Layer.Image('Test Layer',
+ 'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
+ new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
+ new OpenLayers.Size(580, 288));
+
+ map.addLayer(layer);
+ map.zoomToMaxExtent();
+
+ layer.destroy();
+
+ t.eq( layer.name, null, "layer.name is null after destroy" );
+ t.eq( layer.div, null, "layer.div is null after destroy" );
+ t.eq( layer.map, null, "layer.map is null after destroy" );
+ t.eq( layer.options, null, "layer.options is null after destroy" );
+
+ }
+ // -->
+ </script>
+</head>
+<body>
+ <div id="map" style="width:500px;height:500px"></div>
+ <div id="map2" style="width:100px;height:100px"></div>
+</body>
+</html>
Copied: sandbox/vector-2.4/tests/Layer/test_KaMap.html (from rev 2309, sandbox/vector-2.4/tests/Layer/test_Layer_KaMap.html)
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_KaMap.html (rev 0)
+++ sandbox/vector-2.4/tests/Layer/test_KaMap.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -0,0 +1,220 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
+ var layer;
+
+ var name = 'Test Layer';
+ var url = "http://boston.freemap.in/tile.php?";
+ var params = {
+ 'map':'boston-new',
+ 'g':'border,water,roads,openspace',
+ 'i':'JPEG'
+ };
+ var units = "meters";
+
+
+
+ function test_01_Layer_KaMap_constructor (t) {
+ t.plan( 1 );
+
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ t.ok( layer instanceof OpenLayers.Layer.KaMap, "returns OpenLayers.Layer.KaMap object" );
+ }
+
+
+ function test_02_Layer_KaMap_inittiles (t) {
+ t.plan( 2 );
+ var map = new OpenLayers.Map($('map'));
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0,0),5);
+ t.eq( layer.grid.length, 6, "KaMap rows is correct." );
+ t.eq( layer.grid[0].length, 4, "KaMap cols is correct." );
+
+ }
+
+ function test_03_Layer_KaMap_clearTiles (t) {
+ t.plan( 1 );
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ map.addLayer(layer);
+
+ map.setCenter(new OpenLayers.LonLat(0,0));
+
+ //grab a reference to one of the tiles
+ var tile = layer.grid[0][0];
+
+ layer.clearGrid();
+
+ t.ok( layer.grid != null, "layer.grid does not get nullified" );
+ }
+
+
+ function test_04_Layer_KaMap_getKaMapBounds(t) {
+ t.plan( 1 );
+
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+
+ var bl = { bounds: new OpenLayers.Bounds(1,2,0,0)};
+ var tr = { bounds: new OpenLayers.Bounds(0,0,3,4)};
+ layer.grid = [ [6, tr],
+ [bl, 7]];
+
+ var bounds = layer.getGridBounds();
+
+ var testBounds = new OpenLayers.Bounds(1,2,3,4);
+
+ t.ok( bounds.equals(testBounds), "getKaMapBounds() returns correct bounds")
+
+ layer.grid = null;
+ }
+
+ function test_05_Layer_KaMap_getResolution(t) {
+ t.plan( 1 );
+
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ map.addLayer(layer);
+
+ map.zoom = 5;
+
+ t.eq( layer.getResolution(), 0.0439453125, "getResolution() returns correct value");
+ }
+
+ function test_06_Layer_KaMap_getZoomForExtent(t) {
+ t.plan( 2 );
+ var bounds, zoom;
+
+ var map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ map.addLayer(layer);
+
+ bounds = new OpenLayers.Bounds(10,10,12,12);
+ zoom = layer.getZoomForExtent(bounds);
+
+ t.eq( zoom, 8, "getZoomForExtent() returns correct value");
+
+ bounds = new OpenLayers.Bounds(10,10,100,100);
+ zoom = layer.getZoomForExtent(bounds);
+
+ t.eq( zoom, 2, "getZoomForExtent() returns correct value");
+ }
+
+ function test_06_Layer_kaMap_mergeNewParams (t) {
+ t.plan( 5 );
+
+ var map = new OpenLayers.Map("map");
+ var url = "http://octo.metacarta.com/cgi-bin/mapserv";
+ layer = new OpenLayers.Layer.KaMap(name, url, params);
+
+ var newParams = { layers: 'sooper',
+ chickpeas: 'image/png'};
+
+ map.addLayer(layer);
+ map.zoomToMaxExtent();
+ t.ok( !layer.grid[0][0].url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
+
+ layer.mergeNewParams(newParams);
+
+ t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
+ t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
+ t.ok( layer.grid[0][0].url.match("chickpeas"), "CHICKPEAS is in URL of first tile in grid" );
+
+ newParams.chickpeas = 151;
+
+ t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
+ }
+
+
+ /** THIS WOULD BE WHERE THE TESTS WOULD GO FOR
+ *
+ * -moveTo
+ * -insertColumn
+ * -insertRow
+
+ function 07_Layer_KaMap_moveTo(t) {
+ }
+
+ function 08_Layer_KaMap_insertColumn(t) {
+ }
+
+ function 09_Layer_KaMap_insertRow(t) {
+ }
+
+ *
+ */
+
+ function test_10_Layer_KaMap_clone(t) {
+ t.plan(4);
+
+ var options = {tileSize: new OpenLayers.Size(500,50)};
+ var map = new OpenLayers.Map('map', options);
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+ map.addLayer(layer);
+
+ layer.grid = [ [6, 7],
+ [8, 9]];
+
+ var clone = layer.clone();
+
+ t.ok( clone.grid != layer.grid, "clone does not copy grid");
+
+ t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
+
+ layer.tileSize.w += 40;
+
+ t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
+
+ t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
+
+ layer.grid = null;
+ }
+
+ function test_11_Layer_KaMap_setMap(t) {
+
+ t.plan(2);
+
+ var options = {tileSize: new OpenLayers.Size(500,50)};
+ var map = new OpenLayers.Map('map', options);
+ layer = new OpenLayers.Layer.KaMap(name, url, params, units);
+
+
+ layer.setMap(map);
+
+ t.ok( layer.tileSize != null, "tileSize has been set");
+ t.ok( (layer.tileSize.h == 50) && (layer.tileSize.w == 500), "tileSize has been set correctly");
+ }
+
+ function test_99_Layer_KaMap_destroy (t) {
+
+ 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.tileSize, null, "layer.tileSize is null after destroy" );
+
+
+ //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];
+
+ layer.destroy();
+
+ t.ok( layer.grid == null, "tiles appropriately destroyed");
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+<div id="map" style="width:500px;height:550px;display:none"></div>
+</body>
+</html>
Deleted: sandbox/vector-2.4/tests/Layer/test_Layer_EventPane.html
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Layer_EventPane.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Layer/test_Layer_EventPane.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,114 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
- var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
- var layer;
-
- function test_01_Layer_EventPane_constructor (t) {
- t.plan( 5 );
-
- var layer = new OpenLayers.Layer.EventPane('Test Layer');
-
- t.ok( layer instanceof OpenLayers.Layer.EventPane, "new OpenLayers.Layer.EventPane returns object" );
- t.eq( layer.CLASS_NAME, "OpenLayers.Layer.EventPane", "CLASS_NAME variable set correctly");
- t.eq( layer.name, "Test Layer", "layer.name is correct" );
- t.eq( layer.isBaseLayer, true, "EventPane layer is always base layer" );
- if (!isMozilla) {
- t.ok( true, "skipping element test outside of Mozilla");
- } else {
- t.ok( layer.pane instanceof HTMLDivElement, "layer.pane is an HTMLDivElement" );
- }
- }
-
- function test_02_Layer_EventPane_clone (t) {
- t.plan( 1 );
- t.ok( true, "need to actually write some tests here" );
- return;
-
- /// FIX ME FIX ME: fix this later
-
- var map = new OpenLayers.Map('map');
- var options = { chicken: 151, foo: "bar" };
- var layer = new OpenLayers.Layer('Test Layer', options);
- map.addLayer(layer);
-
- // randomly assigned property
- layer.chocolate = 5;
-
- var clone = layer.clone();
-
- t.ok( clone instanceof OpenLayers.Layer, "new OpenLayers.Layer returns object" );
- t.eq( clone.name, "Test Layer", "default clone.name is correct" );
- t.ok( ((clone.options["chicken"] == 151) && (clone.options["foo"] == "bar")), "clone.options correctly set" );
- t.eq(clone.chocolate, 5, "correctly copied randomly assigned property");
-
- layer.addOptions({chicken:152});
- t.eq(clone.options["chicken"], 151, "made a clean copy of options");
-
-
- t.ok( clone.map == null, "cloned layer has map property set to null")
-
- }
-
- function test_10_Layer_EventPane_setMap (t) {
-
-// MOUSEMOVE test does not seem to work...
-// t.plan( 2 );
-
- if (!isMozilla || isOpera) {
- t.plan(4);
- } else {
- t.plan(3);
- }
- var map = new OpenLayers.Map('map');
-
- layer = new OpenLayers.Layer.EventPane('Test Layer');
-
- //give dummy function so test wont bomb on layer.setMap()
- layer.loadMapObject = function() { };
- layer.getWarningHTML = function() { this.warning = true; return ""; };
- map.addLayer(layer);
- t.eq( parseInt(layer.pane.style.zIndex) - parseInt(layer.div.style.zIndex),
- 1, "layer pane is 1 z-level above its div" );
-
- t.ok( layer.warning, "warning correctly registered on no mapObject load" );
-
- layer2 = new OpenLayers.Layer.EventPane('Test Layer');
-
- //give dummy function so test wont bomb on layer.setMap()
- layer2.loadMapObject = function() { this.mapObject = new Object(); };
- layer2.getWarningHTML = function() { this.warning = true; return ""; }
-
- map.addLayer(layer2);
- t.ok( !layer2.warning, "warning not registered on mapObject load" );
-
- map.events.register("mousemove", map, function () {
- t.ok(true, "got mouse move");
- });
-
- if( document.createEvent ) { // Mozilla
- var evObj = document.createEvent('MouseEvents');
- evObj.initEvent( 'mousemove', true, false );
- layer.pane.dispatchEvent(evObj);
- } else if( document.createEventObject ) { // IE
- layer.pane.fireEvent('onmousemove');
- }
- }
-
- function test_20_Layer_EventPane_setVisibility (t) {
- t.plan( 2 );
- layer = new OpenLayers.Layer.EventPane('Test Layer');
- layer.setVisibility(false);
- t.eq(layer.visibility, false, "layer pane is now invisible");
- layer.setVisibility(true);
- t.eq(layer.visibility, true, "layer pane is now visible");
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="height:500px;width:500px"></div>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Layer/test_Layer_FixedZoomLevels.html
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Layer_FixedZoomLevels.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Layer/test_Layer_FixedZoomLevels.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,97 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var layer;
-
- function test_01_Layer_FixedZoomLevels (t) {
- t.plan( 36 );
-
- var layer = { 'MIN_ZOOM_LEVEL': 5,
- 'MAX_ZOOM_LEVEL': 10 };
-
-
- //defaults
-
- layer = p_createLayer(layer);
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "nothing specified");
-
-
- //layer.options
-
- // min,num
- layer = p_createLayer(layer, {}, { minZoomLevel: 3, numZoomLevels: 12});
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "min too low num too high(layer.options)");
-
- layer = p_createLayer(layer, {}, { minZoomLevel: 6, numZoomLevels: 3 });
- p_minMaxNum(t, layer, 6, 8, "valid min,num(layer.options)");
-
-
- // max
- layer = p_createLayer(layer, {}, { maxZoomLevel: 9 });
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 9, "valid max(layer.options)");
-
- layer = p_createLayer(layer, {}, { maxZoomLevel: 12 });
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "invalid max(layer.options)");
-
-
-
- //map
-
- // min,num
- layer = p_createLayer(layer, { minZoomLevel: 3, numZoomLevels: 12});
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "min too low num too high(map)");
-
- layer = p_createLayer(layer, { minZoomLevel: 6, numZoomLevels: 3 });
- p_minMaxNum(t, layer, 6, 8, "valid min,num(map)");
-
-
- // max
- layer = p_createLayer(layer, { maxZoomLevel: 9 });
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 9, "valid max(map)");
-
- layer = p_createLayer(layer, { maxZoomLevel: 12 });
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, layer.MAX_ZOOM_LEVEL, "invalid max(map)");
-
- //map vs. options
-
- layer = p_createLayer(layer, {minZoomLevel: 6, numZoomLevels: 2}, { minZoomLevel: 7, numZoomLevels: 3});
- p_minMaxNum(t, layer, 7, 9, "min,num(layer.options) wins over (map)");
-
- layer = p_createLayer(layer, {minZoomLevel: 6, maxZoomLevel: 8}, { minZoomLevel: 7, maxZoomLevel: 9});
- p_minMaxNum(t, layer, 7, 9, "min,max(layer.options) wins over (map)");
-
-
- // numZoomLevels vs. maxZoomLevel
-
- layer = p_createLayer(layer, {maxZoomLevel: 8, numZoomLevels: 6});
- p_minMaxNum(t, layer, layer.MIN_ZOOM_LEVEL, 10, "min,max(layer.options) wins over (map)");
-
-
-
- }
-
- function p_createLayer(layer, mapOptions, layerOptions) {
-
- layer.map = mapOptions || {};
- layer.options = layerOptions || {};
- OpenLayers.Layer.FixedZoomLevels.prototype.initResolutions.apply(layer);
-
- return layer;
- }
-
- function p_minMaxNum(t, layer, min, max, msg) {
-
- t.eq( layer.minZoomLevel, min, "min zoom level inherited from layer constant: " + msg);
- t.eq( layer.maxZoomLevel, max, "max zoom level inherited from layer constant: " + msg);
- t.eq( layer.numZoomLevels, max - min + 1, "num zoom levels correctly calcuated: " + msg);
-
- }
-
- // -->
- </script>
-</head>
-<body>
- <div id="map"></div>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Layer/test_Layer_GeoRSS.html
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Layer_GeoRSS.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Layer/test_Layer_GeoRSS.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,89 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
- var layer;
-
- function test_01_Layer_GeoRSS_constructor (t) {
- t.plan( 5 );
- layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./georss.txt" );
- t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
- t.eq( layer.location, "./georss.txt", "layer.location is correct" );
- var markers;
- t.delay_call( 1, function() {
- t.eq( layer.markers.length, 40, "marker length is correct" );
- var ll = new OpenLayers.LonLat(-71.142197, 42.405696);
- t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
- t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." );
- } );
- }
-
- function test_01_Layer_GeoRSS_AtomParsing (t) {
- t.plan( 6 );
- layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./atom-1.0.xml" );
- t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
- t.eq( layer.location, "./atom-1.0.xml", "layer.location is correct" );
- var markers;
- t.delay_call( 1, function() {
- t.eq( layer.markers.length, 2, "marker length is correct" );
- var ll = new OpenLayers.LonLat(29.9805, 36.7702);
- t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
- t.like( layer.features[0].data['popupContentHTML'], '<a class="link" href="http://pleiades.stoa.org/places/638896" target="_blank">Unnamed Tumulus</a>', "Link is correct.");
- t.eq( layer.name, "tumulus", "Layer name is correct." );
- } );
- }
-
- function test_02_Layer_GeoRSS_draw (t) {
-// t.plan(5);
- t.plan( 2 );
- layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
- t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
- var map = new OpenLayers.Map('map');
- var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
- "http://octo.metacarta.com/cgi-bin/mapserv?",
- {map: "/mapdata/vmap_wms.map", layers: "basic"});
- map.addLayer(baseLayer);
- map.addLayer(layer);
- t.delay_call( 1, function() {
- map.setCenter(new OpenLayers.LonLat(0,0),0);
- t.eq( map.layers[1].name, layer.name, "Layer name is correct" );
-
- });;
- }
- function test_03_Layer_GeoRSS_events (t) {
- t.plan( 4 );
- layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
- var map = new OpenLayers.Map('map');
- var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
- "http://octo.metacarta.com/cgi-bin/mapserv?",
- {map: "/mapdata/vmap_wms.map", layers: "basic"});
- map.addLayer(baseLayer);
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(0,0),0);
- var event = {};
- t.delay_call( 1, function() {
- t.ok(layer.markers[0].events, "First marker has an events object");
- t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object");
- layer.markers[0].events.triggerEvent('click', event);
- t.eq(map.popups.length, 1, "Popup opened correctly");
- layer.markers[1].events.triggerEvent('click', event);
- t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
- });
- }
-
- function test_99_Layer_GeoRSS_destroy (t) {
- t.plan( 1 );
- layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
- var map = new OpenLayers.Map('map');
- map.addLayer(layer);
- layer.destroy();
- t.eq( layer.map, null, "layer.map is null after destroy" );
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map" style="width:500px; height:500px"></div>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Layer/test_Layer_Google.html
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Layer_Google.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Layer/test_Layer_Google.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,156 +0,0 @@
-<html>
-<head>
- <!-- this gmaps key generated for http://openlayers.org/dev/ -->
- <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghSPUCi5aRYVveCcVYxzezM4iaj_gxQ9t-UajFL70jfcpquH5l1IJ-Zyyw'></script>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var layer;
-
- function test_01_Layer_Google_constructor (t) {
- t.plan( 4 );
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google('Goog Layer');
- map.addLayer(layer);
-
-
- t.ok( layer instanceof OpenLayers.Layer.Google, "new OpenLayers.Layer.Google returns object" );
- t.eq( layer.CLASS_NAME, "OpenLayers.Layer.Google", "CLASS_NAME variable set correctly");
-
- t.eq( layer.name, "Goog Layer", "layer.name is correct" );
-
- t.ok ( layer.gmap != null, "GMap2 Object correctly loaded");
- }
-
- function test_02_Layer_Google_isBaseLayer (t) {
- t.plan(1);
-
- var layer = new OpenLayers.Layer.Google('Goog Layer');
-
- t.ok(layer.isBaseLayer, "a default load of google layer responds as a base layer");
- }
-
- function test_03_Layer_Google_Translation_zoom (t) {
-
- t.plan( 4 );
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google('Goog Layer');
- map.addLayer(layer);
-
- // these two lines specify an appropriate translation.
- // the code afterwards works by itself to test that translation
- // works correctly both ways.
- var gZoom = 5;
- var correspondingOLZoom = 5;
-
-
- olZoom = layer.getOLZoomFromGZoom(gZoom);
- t.eq(olZoom, correspondingOLZoom, "Translation from GZoom to OL Zoom works");
- t.eq(layer.getGZoomFromOLZoom(olZoom), gZoom, "Translation from OL Zoom to GZoom works");
-
- t.ok( layer.getGZoomFromOLZoom(null) == null, "getGZoomFromOLZoom(null) returns null");
- t.ok( layer.getOLZoomFromGZoom(null) == null, "getOLZoomFromGZoom(null) returns null");
- }
-
- function test_04_Layer_Google_Translation_lonlat (t) {
-
- t.plan( 4 );
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google('Goog Layer');
- map.addLayer(layer);
-
- // these two lines specify an appropriate translation.
- // the code afterwards works by itself to test that translation
- // works correctly both ways.
- var gLatLng = new GLatLng(50,100);
- var correspondingOLLonLat = new OpenLayers.LonLat(100,50);
-
-
- olLonLat = layer.getOLLonLatFromGLatLng(gLatLng);
- t.ok(olLonLat.equals(correspondingOLLonLat), "Translation from GLatLng to OpenLayers.LonLat works");
-
- var transGLatLng = layer.getGLatLngFromOLLonLat(olLonLat);
- t.ok( transGLatLng.equals(gLatLng), "Translation from OpenLayers.LonLat to GLatLng works");
-
- t.ok( layer.getGLatLngFromOLLonLat(null) == null, "getGLatLngFromOLLonLat(null) returns null");
- t.ok( layer.getOLLonLatFromGLatLng(null) == null, "getOLLonLatFromGLatLng(null) returns null");
- }
-
- function test_05_Layer_Google_Translation_pixel (t) {
-
- t.plan( 4 );
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google('Goog Layer');
- map.addLayer(layer);
-
- // these two lines specify an appropriate translation.
- // the code afterwards works by itself to test that translation
- // works correctly both ways.
- var gPoint = new GPoint(50,100);
- var correspondingOLPixel = new OpenLayers.Pixel(50, 100);
-
-
- olPixel = layer.getOLPixelFromGPoint(gPoint);
- t.ok( olPixel.equals(correspondingOLPixel), "Translation from GPoint to OpenLayers.Pixel works");
-
- var transGPoint = layer.getGPointFromOLPixel(olPixel);
- t.ok( transGPoint.equals(gPoint), "Translation from OpenLayers.Pixel to GPoint works");
-
- t.ok( layer.getGPointFromOLPixel(null) == null, "getGPointFromOLPixel(null) returns null");
- t.ok( layer.getOLPixelFromGPoint(null) == null, "getOLPixelFromGPoint(null) returns null");
- }
-
- function test_06_Layer_Google_Translation_bounds (t) {
-
- t.plan( 4 );
-
- var map = new OpenLayers.Map('map');
- var layer = new OpenLayers.Layer.Google('Goog Layer');
- map.addLayer(layer);
-
- // these two lines specify an appropriate translation.
- // the code afterwards works by itself to test that translation
- // works correctly both ways.
- var sw = new GLatLng(10,20);
- var ne = new GLatLng(50,40)
- var gBounds = new GLatLngBounds(sw, ne);
- var correspondingOLBounds = new OpenLayers.Bounds(20, 10, 40, 50);
-
-
- olBounds = layer.getOLBoundsFromGLatLngBounds(gBounds);
-
- t.ok(olBounds.equals(correspondingOLBounds), "Translation from GLatLngBounds to OpenLayers.Bounds works");
-
- var transGBounds = layer.getGLatLngBoundsFromOLBounds(olBounds);
- t.ok( transGBounds.equals(gBounds), "Translation from OpenLayers.Bounds to GLatLngBounds works");
-
- t.ok( layer.getGLatLngBoundsFromOLBounds(null) == null, "getGLatLngBoundsFromOLBounds(null) returns null");
- t.ok( layer.getOLBoundsFromGLatLngBounds(null) == null, "getOLBoundsFromGLatLngBounds(null) returns null");
- }
-
- function test_99_Layer_destroy (t) {
- t.plan( 5 );
-
- var map = new OpenLayers.Map('map');
-
- layer = new OpenLayers.Layer.Google('Test Layer');
- map.addLayer(layer);
-
- layer.destroy();
-
- t.eq( layer.name, null, "layer.name is null after destroy" );
- t.eq( layer.div, null, "layer.div is null after destroy" );
- t.eq( layer.map, null, "layer.map is null after destroy" );
- t.eq( layer.options, null, "layer.options is null after destroy" );
- t.eq( layer.gmap, null, "layer.gmap is null after destroy" );
- }
- // -->
- </script>
-</head>
-<body>
- <div id="map"></div>
-</body>
-</html>
Deleted: sandbox/vector-2.4/tests/Layer/test_Layer_Grid.html
===================================================================
--- sandbox/vector-2.4/tests/Layer/test_Layer_Grid.html 2007-03-05 16:29:46 UTC (rev 2310)
+++ sandbox/vector-2.4/tests/Layer/test_Layer_Grid.html 2007-03-05 16:30:45 UTC (rev 2311)
@@ -1,206 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
- var layer;
-
- var name = 'Test Layer';
- var url = "http://octo.metacarta.com/cgi-bin/mapserv";
- var params = { map: '/mapdata/vmap_wms.map',
- layers: 'basic',
- format: 'image/png'};
-
- /**
- * NOTE TO READER:
- *
- * Some of the tests on the Grid class actually use the WMS class.
- * This is because WMS is a subclass of Grid and it implements the
- * core functions which are necessary to test the tile-generation
- * mechanism.
- *
- */
-
-
- function test_01_Layer_Grid_constructor (t) {
- t.plan( 1 );
-
- layer = new OpenLayers.Layer.Grid(name, url, params, null);
- t.ok( layer instanceof OpenLayers.Layer.Grid, "returns OpenLayers.Layer.Grid object" );
- }
-
-
- function test_02_Layer_Grid_inittiles (t) {
- t.plan( 2 );
- var map = new OpenLayers.Map($('map'));
- layer = new OpenLayers.Layer.WMS(name, url, params);
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(0,0),5);
- t.eq( layer.grid.length, 7, "Grid rows is correct." );
- t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
-
- }
-
- function test_03_Layer_Grid_clearTiles (t) {
- t.plan(1);
-