diff options
Diffstat (limited to 'misc/openlayers/tests/deprecated/Layer')
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/GML.html | 61 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/MapServer.html | 59 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/MapServer/Untiled.html | 158 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/WFS.html | 178 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/WMS.html | 60 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/WMS/Post.html | 89 | ||||
-rwxr-xr-x | misc/openlayers/tests/deprecated/Layer/Yahoo.html | 121 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/mice.xml | 156 | ||||
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/owls.xml | 156 |
9 files changed, 1038 insertions, 0 deletions
diff --git a/misc/openlayers/tests/deprecated/Layer/GML.html b/misc/openlayers/tests/deprecated/Layer/GML.html new file mode 100644 index 0000000..daf5917 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/GML.html @@ -0,0 +1,61 @@ +<html> +<head> + <script src="../../OLLoader.js"></script> + <script src="../../../lib/deprecated.js"></script> + <script type="text/javascript"> + + var name = "GML Layer"; + + var gml = "./owls.xml"; + var gml2 = "./mice.xml"; + + // if this test is running online, different rules apply + var isMSIE = (navigator.userAgent.indexOf("MSIE") > -1); + if (isMSIE) { + gml = "." + gml; + gml2 = "." + gml2; + } + + function test_Layer_GML_constructor(t) { + t.plan(3); + + var layer = new OpenLayers.Layer.GML(name); + t.ok(layer instanceof OpenLayers.Layer.GML, "new OpenLayers.Layer.GML returns correct object" ); + t.eq(layer.name, name, "layer name is correctly set"); + t.ok(layer.renderer.CLASS_NAME, "layer has a renderer"); + + } + function test_Layer_GML_events(t) { + t.plan(3); + + var layer = new OpenLayers.Layer.GML(name, gml, {isBaseLayer: true}); + layer.events.register("loadstart", layer, function() { + t.ok(true, "loadstart called.") + }); + layer.events.register("loadend", layer, function() { + t.ok(true, "loadend called.") + }); + var map = new OpenLayers.Map("map"); + map.addLayer(layer); + map.zoomToMaxExtent(); + t.delay_call(3, function() { + t.ok(true, "waited for 3s"); + }); + + } + function test_GML_setUrl(t) { + t.plan(2); + var layer = new OpenLayers.Layer.GML(name, gml); + var map = new OpenLayers.Map("map"); + map.addLayer(layer); + t.eq(layer.url, gml, "layer has correct original url"); + layer.setUrl(gml2); + t.eq(layer.url, gml2, "layer has correctly changed url"); + } + </script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> + diff --git a/misc/openlayers/tests/deprecated/Layer/MapServer.html b/misc/openlayers/tests/deprecated/Layer/MapServer.html new file mode 100644 index 0000000..d65fef6 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/MapServer.html @@ -0,0 +1,59 @@ +<html> +<head> +<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> + +<script src="../../OLLoader.js"></script> +<script src="../../../lib/deprecated.js"></script> +<script type="text/javascript"> + var isMozilla = (navigator.userAgent.indexOf("compatible") == -1); + var layer; + + var name = 'Test Layer'; + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + var params = { map: '/mapdata/vmap_wms.map', + layers: 'basic'}; + + function test_Layer_MapServer_Reproject (t) { + var validkey = (window.location.protocol == "file:") || + (window.location.host == "localhost") || + (window.location.host == "openlayers.org"); + + if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") { + t.plan(1); + t.debug_print("Can't test google reprojection in Opera or Safari."); + } else if(validkey) { + t.plan(5); + var map = new OpenLayers.Map('map', {tileManager: null}); + var layer = new OpenLayers.Layer.Google("Google"); + map.addLayer(layer); + layer = new OpenLayers.Layer.MapServer(name, url, params, {reproject: true, isBaseLayer: false, buffer: 2}); + layer.isBaseLayer=false; + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(0,0), 5); + var tile = layer.grid[0][0]; + t.eq( tile.bounds.left, -22.5, "left side matches" ); + t.eq( tile.bounds.right, -11.25, "right side matches" ); + t.eq( tile.bounds.bottom.toFixed(6), '11.781325', "bottom side matches" ); + t.eq( tile.bounds.top.toFixed(6), '22.512557', "top side matches" ); + map.destroy(); + } else { + t.plan(1); + t.debug_print("can't test google layer from " + + window.location.host); + } + + var map = new OpenLayers.Map('map', {tileManager: null}); + layer = new OpenLayers.Layer.MapServer(name, url, params, {buffer:2}); + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(0,0), 5); + var tile = layer.grid[0][0]; + t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay"); + map.destroy(); + } + +</script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/MapServer/Untiled.html b/misc/openlayers/tests/deprecated/Layer/MapServer/Untiled.html new file mode 100644 index 0000000..f235492 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/MapServer/Untiled.html @@ -0,0 +1,158 @@ +<html> +<head> + + <script src="../../../OLLoader.js"></script> + <script src="../../../../lib/deprecated.js"></script> + <script type="text/javascript"> + + var isMozilla = (navigator.userAgent.indexOf("compatible") == -1); + var layer; + + var name = 'Test Layer'; + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + var params = { map: '/mapdata/vmap_wms.map', + layers: 'basic'}; + + function test_Layer_MapServer_Untiled_constructor (t) { + t.plan( 4 ); + + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params); + t.ok( layer instanceof OpenLayers.Layer.MapServer.Untiled, "new OpenLayers.Layer.MapServer returns object" ); + t.eq( layer.url, "http://labs.metacarta.com/cgi-bin/mapserv", "layer.url is correct (HTTPRequest inited)" ); + + t.eq( layer.params.mode, "map", "default mode param correctly copied"); + t.eq( layer.params.map_imagetype, "png", "default imagetype correctly copied"); + + + } + + function test_Layer_MapServer_Untiled_clone (t) { + t.plan(3); + + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + var map = new OpenLayers.Map('map', {}); + layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params); + map.addLayer(layer); + + var clone = layer.clone(); + layer.tile = [[1,2],[3,4]]; + + t.ok( clone.tile != layer.tile, "clone does not copy tile"); + + layer.ratio += 1; + + t.eq( clone.ratio, 1.5, "changing layer.ratio does not change clone.ratio -- a fresh copy was made, not just copied reference"); + + t.eq( clone.alpha, layer.alpha, "alpha copied correctly"); + + layer.tile = null; + map.destroy(); + } + + function test_Layer_MapServer_Untiled_isBaseLayer(t) { + t.plan(3); + + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params); + t.ok( layer.isBaseLayer, "baselayer is true by default"); + + var newParams = OpenLayers.Util.extend({}, params); + newParams.transparent = "true"; + layer = new OpenLayers.Layer.MapServer.Untiled(name, url, newParams); + t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true"); + + layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params, {isBaseLayer: false}); + t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" ); + } + + function test_Layer_MapServer_Untiled_mergeNewParams (t) { + t.plan( 5 ); + + var map = new OpenLayers.Map("map", {tileManager: null}); + var url = "http://labs.metacarta.com/cgi-bin/mapserv"; + layer = new OpenLayers.Layer.MapServer.Untiled(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"); + map.destroy(); + } + + function test_Layer_MapServer_Untiled_getFullRequestString (t) { + + + t.plan( 1 ); + var map = new OpenLayers.Map('map'); + tUrl = "http://labs.metacarta.com/cgi-bin/mapserv"; + tParams = { layers: 'basic', + format: 'png'}; + var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams); + map.addLayer(tLayer); + str = tLayer.getFullRequestString(); + var tParams = { + layers: 'basic', + format: 'png', + mode: 'map', + map_imagetype: 'png' + }; + + var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams); + sStr = sStr.replace(/,/g, "+"); + + t.eq(str, sStr , "getFullRequestString() works"); + map.destroy(); + + } + + // DEPRECATED -- REMOVE IN 3.0 + function test_Layer_Untiled_MapServer(t) { + t.plan(1); + + var layer = new OpenLayers.Layer.MapServer.Untiled(); + + var clone = layer.clone(); + + t.ok(clone.singleTile, "regression test: clone works. this is for #1013"); + } + + function test_Layer_MapServer_Untiled_destroy (t) { + + t.plan( 1 ); + + var map = new OpenLayers.Map('map'); + layer = new OpenLayers.Layer.MapServer.Untiled(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.tile; + + layer.destroy(); + + // checks to make sure superclass (grid) destroy() was called + + t.ok( layer.tile == null, "tile set to null"); + map.destroy(); + } + + </script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/WFS.html b/misc/openlayers/tests/deprecated/Layer/WFS.html new file mode 100644 index 0000000..09b6a54 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/WFS.html @@ -0,0 +1,178 @@ +<html> +<head> + <script src="../../OLLoader.js"></script> + <script src="../../../lib/deprecated.js"></script> + <script type="text/javascript"> + + var name = "Vector Layer"; + + function test_Layer_WFS_constructor(t) { + t.plan(3); + + var layer = new OpenLayers.Layer.WFS(name, "url", {}); + t.ok(layer instanceof OpenLayers.Layer.WFS, "new OpenLayers.Layer.Vector returns correct object" ); + t.eq(layer.name, name, "layer name is correctly set"); + t.ok(layer.renderer.CLASS_NAME, "layer has a renderer"); + + } + + function test_Layer_WFS_getDataExtent(t) { + t.plan(1); + + var layer = new OpenLayers.Layer.WFS(name, "url", {}); + layer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0, 0))); + layer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0, 1))); + t.eq(layer.getDataExtent().toBBOX(), "0,0,0,1", "bbox is correctly pulled from vectors."); + + } + + function test_Layer_WFS_setOpacity(t) { + t.plan(3); + + var layer = new OpenLayers.Layer.WFS(name, "url", {}); + layer.setOpacity(.5); + t.eq(layer.opacity, 0.5, "vector setOpacity didn't fail"); + var layer = new OpenLayers.Layer.WFS(name, "url", {}, {'featureClass': OpenLayers.Feature.WFS}); + var marker = new OpenLayers.Marker(new OpenLayers.LonLat(0,0)); + marker.setOpacity = function() { + t.ok(true, "Marker setOpacity was called"); + } + layer.addMarker(marker); + layer.setOpacity(.6); + t.eq(layer.opacity, 0.6, "setOpacity didn't fail on markers"); + } + + function test_Layer_WFS_destroy(t) { + t.plan(13); + + var tVectorDestroy = OpenLayers.Layer.Vector.prototype.destroy; + OpenLayers.Layer.Vector.prototype.destroy = function() { + g_VectorDestroyed = true; + } + + var tMarkersDestroy = OpenLayers.Layer.Markers.prototype.destroy; + OpenLayers.Layer.Markers.prototype.destroy = function() { + g_MarkersDestroyed = true; + } + + var layer = { + 'vectorMode': true, + 'tile': { + 'destroy': function() { + t.ok(true, "wfs layer's tile is destroyed"); + } + }, + 'ratio': {}, + 'featureClass': {}, + 'format': {}, + 'formatObject': { + 'destroy': function() { + t.ok(true, "wfs layer's format object is destroyed"); + } + }, + 'formatOptions': {}, + 'encodeBBOX': {}, + 'extractAttributes': {} + }; + + //this call should set off two tests (destroys for tile and format object) + g_VectorDestroyed = null; + g_MarkersDestroyed = null; + OpenLayers.Layer.WFS.prototype.destroy.apply(layer, []); + + t.ok(g_VectorDestroyed && !g_MarkersDestroyed, "when vector mode is set to true, the default vector layer's destroy() method is called"); + t.eq(layer.vectorMode, null, "'vectorMode' property nullified"); + t.eq(layer.tile, null, "'tile' property nullified"); + t.eq(layer.ratio, null, "'ratio' property nullified"); + t.eq(layer.featureClass, null, "'featureClass' property nullified"); + t.eq(layer.format, null, "'format' property nullified"); + t.eq(layer.formatObject, null, "'formatObject' property nullified"); + t.eq(layer.formatOptions, null, "'formatOptions' property nullified"); + t.eq(layer.encodeBBOX, null, "'encodeBBOX' property nullified"); + t.eq(layer.extractAttributes, null, "'extractAttributes' property nullified"); + + layer.vectorMode = false; + + //this call will *not* set off two tests (tile and format object are null) + g_VectorDestroyed = null; + g_MarkersDestroyed = null; + OpenLayers.Layer.WFS.prototype.destroy.apply(layer, []); + t.ok(!g_VectorDestroyed && g_MarkersDestroyed, "when vector mode is set to false, the default markers layer's destroy() method is called"); + + OpenLayers.Layer.Vector.prototype.destroy = tVectorDestroy; + OpenLayers.Layer.Markers.prototype.destroy = tMarkersDestroy; + } + + function test_Layer_WFS_mapresizevector(t) { + t.plan(2); + + var map = new OpenLayers.Map("map"); + map.addLayer(new OpenLayers.Layer.WMS("WMS", "url", {})); + var layer = new OpenLayers.Layer.WFS(name, "url", {}); + t.ok(layer.renderer.CLASS_NAME, "layer has a renderer"); + map.addLayer(layer); + setSize = false; + layer.renderer.setSize = function() { setSize = true; } + layer.onMapResize(); + t.eq(setSize, true, "Renderer resize called on map size change."); + map.destroy(); + + } + function test_Layer_WFS_drawmap(t) { + t.plan(2); + var map = new OpenLayers.Map('map'); + layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", + "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); + map.addLayer(layer); + + layer = new OpenLayers.Layer.WFS( "Owl Survey", + "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?", + {typename: "OWLS", maxfeatures: 10}, + { featureClass: OpenLayers.Feature.WFS}); + map.addLayer(layer); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + try { + map.setCenter(new OpenLayers.LonLat(-100, 60), 3); + } catch (Exception) { + } + t.eq(layer.tile.url, "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?TYPENAME=OWLS&MAXFEATURES=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-187.890625,-36.6796875,-12.109375,156.6796875", "Tile URL is set correctly when not encoded"); + map.destroy(); + var map = new OpenLayers.Map('map'); + layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", + "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} + ); + map.addLayer(layer); + + layer = new OpenLayers.Layer.WFS( "Owl Survey", + "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?", + {typename: "OWLS", maxfeatures: 10}, + { featureClass: OpenLayers.Feature.WFS, 'encodeBBOX': true}); + map.addLayer(layer); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + try { + map.setCenter(new OpenLayers.LonLat(-100, 60), 3); + } catch (Exception) { + } + t.eq(layer.tile.url, "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?TYPENAME=OWLS&MAXFEATURES=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-187.890625%2C-36.679687%2C-12.109375%2C156.679688", "Tile URL is set correctly when not encoded"); + map.destroy(); + } + function test_projection_srs(t) { + t.plan(1); + var map = new OpenLayers.Map('map'); + map.addLayer(new OpenLayers.Layer("",{isBaseLayer: true} )); + // we use an empty moveTo function because we don't want to request tiles + var layer = new OpenLayers.Layer.WFS("","/wfs",{},{'projection': new OpenLayers.Projection("EPSG:900913"), + moveTo: function() {}}); + map.addLayer(layer); + map.zoomToMaxExtent(); + var params = OpenLayers.Util.getParameters(layer.getFullRequestString()); + t.eq(params.SRS, "EPSG:900913", "SRS represents projection of WFS layer, instead of map (#1537)"); + } + + + </script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/WMS.html b/misc/openlayers/tests/deprecated/Layer/WMS.html new file mode 100644 index 0000000..43977c8 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/WMS.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<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="../../OLLoader.js"></script> + <script src="../../../lib/deprecated.js"></script> + <script type="text/javascript"> + + var name = 'Test Layer'; + var url = "http://octo.metacarta.com/cgi-bin/mapserv"; + var params = { map: '/mapdata/vmap_wms.map', + layers: 'basic', + format: 'image/jpeg'}; + + function test_Layer_WMS_Reproject (t) { + var validkey = (window.location.protocol == "file:") || + (window.location.host == "localhost") || + (window.location.host == "openlayers.org"); + if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") { + t.plan(1); + t.debug_print("Can't test google reprojection in Opera or Safari."); + } else if(validkey) { + t.plan(5); + + var map = new OpenLayers.Map('map', {tileManager: null}); + var layer = new OpenLayers.Layer.Google("Google"); + map.addLayer(layer); + var wmslayer = new OpenLayers.Layer.WMS(name, url, params, + {isBaseLayer: false, reproject:true, buffer: 2}); + wmslayer.isBaseLayer=false; + map.addLayer(wmslayer); + map.setCenter(new OpenLayers.LonLat(0,0), 5); + var tile = wmslayer.grid[0][0]; + t.eq( tile.bounds.left, -22.5, "left side matches" ); + t.eq( tile.bounds.right, -11.25, "right side matches" ); + t.eq( tile.bounds.bottom.toFixed(6), '11.781325', "bottom side matches" ); + t.eq( tile.bounds.top.toFixed(6), '22.512557', "top side matches" ); + map.destroy(); + } else { + t.plan(1); + t.debug_print("can't test google layer from " + + window.location.host); + } + + var map = new OpenLayers.Map('map', {tileManager: null}); + layer = new OpenLayers.Layer.WMS(name, url, params, {buffer: 2}); + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(0,0), 5); + var tile = layer.grid[0][0]; + t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay"); + + map.destroy(); + } + </script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/WMS/Post.html b/misc/openlayers/tests/deprecated/Layer/WMS/Post.html new file mode 100644 index 0000000..d79aec5 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/WMS/Post.html @@ -0,0 +1,89 @@ +<html> +<head> + <script src="../../../OLLoader.js"></script> + <script src="../../../../lib/deprecated.js"></script> + <script type="text/javascript"> + var isMozilla = (navigator.userAgent.indexOf("compatible") == -1); + var isOpera = (navigator.userAgent.indexOf("Opera") != -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/jpeg'}; + + function test_Layer_WMS_Post_constructor (t) { + t.plan( 2 ); + + var url = "http://octo.metacarta.com/cgi-bin/mapserv"; + var options = {unsupportedBrowsers: []}; + layer = new OpenLayers.Layer.WMS.Post(name, url, params, options); + + t.eq( + layer.usePost, true, + "Supported browsers use IFrame tiles."); + + layer.destroy(); + + var options = { unsupportedBrowsers: [OpenLayers.BROWSER_NAME]}; + layer = new OpenLayers.Layer.WMS.Post(name, url, params, options); + t.eq( + layer.usePost, false, + "unsupported browsers use Image tiles."); + layer.destroy(); + } + + function test_Layer_WMS_Post_addtile (t) { + t.plan( 3 ); + + layer = new OpenLayers.Layer.WMS.Post(name, url, params); + var map = new OpenLayers.Map('map'); + map.addLayer(layer); + var bounds = new OpenLayers.Bounds(1,2,3,4); + var pixel = new OpenLayers.Pixel(5,6); + var tile = layer.addTile(bounds, pixel); + + if(isMozilla || isOpera) { + t.ok( + tile instanceof OpenLayers.Tile.Image, + "tile is an instance of OpenLayers.Tile.Image"); + } + else { + t.ok( + tile.useIFrame !== undefined, + "tile is created with the OpenLayers.Tile.Image.IFrame mixin"); + } + map.destroy(); + + // test the unsupported browser + layer = new OpenLayers.Layer.WMS.Post(name, url, params, { + unsupportedBrowsers: [OpenLayers.BROWSER_NAME] + }); + map = new OpenLayers.Map('map'); + map.addLayer(layer); + tile = layer.addTile(bounds, pixel); + t.ok( + tile instanceof OpenLayers.Tile.Image, + "unsupported browser: tile is an instance of Tile.Image"); + layer.destroy(); + + // test a supported browser + layer = new OpenLayers.Layer.WMS.Post(name, url, params, { + unsupportedBrowsers: [] + }); + map.addLayer(layer); + var tile2 = layer.addTile(bounds, pixel); + tile2.draw(); + t.eq( + tile2.useIFrame, true, + "supported browser: tile is created with the Tile.Image.IFrame mixin"); + map.destroy(); + } + + </script> +</head> +<body> +<div id="map" style="width:500px;height:550px"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/Yahoo.html b/misc/openlayers/tests/deprecated/Layer/Yahoo.html new file mode 100755 index 0000000..f7c67c0 --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/Yahoo.html @@ -0,0 +1,121 @@ +<html> +<head> + <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script> + <script src="../../OLLoader.js"></script> + <script src="../../../lib/deprecated.js"></script> + <script type="text/javascript"> + var layer; + + function test_Layer_Yahoo_constructor (t) { + t.plan( 4 ); + + var tempEventPane = OpenLayers.Layer.EventPane.prototype.initialize; + OpenLayers.Layer.EventPane.prototype.initialize = function(name, options) { + t.ok(name == g_Name, "EventPane initialize() called with correct name"); + t.ok(options == g_Options, "EventPane initialize() called with correct options"); + } + + var tempFixedZoomLevels = OpenLayers.Layer.FixedZoomLevels.prototype.initialize; + OpenLayers.Layer.FixedZoomLevels.prototype.initialize = function(name, options) { + t.ok(name == g_Name, "FixedZoomLevels initialize() called with correct name"); + t.ok(options == g_Options, "FixedZoomLevels initialize() called with correct options"); + } + + + g_Name = {}; + g_Options = {}; + var l = new OpenLayers.Layer.Yahoo(g_Name, g_Options); + + OpenLayers.Layer.EventPane.prototype.initialize = tempEventPane; + OpenLayers.Layer.FixedZoomLevels.prototype.initialize = tempFixedZoomLevels; + } + + function test_Layer_Yahoo_loadMapObject(t) { + t.plan(5); + + var temp = YMap; + YMap = OpenLayers.Class({ + initialize: function(div, type, size) { + t.ok(div == g_Div, "correct div passed to YMap constructor"); + t.ok(type == g_Type, "correct type passed to YMap constructor"); + t.ok(size == g_YMapSize, "correct size passed to YMap constructor"); + }, + disableKeyControls: function() { + t.ok(true, "disableKeyControls called on map object"); + } + }); + + g_Div = {}; + g_Type = {}; + g_MapSize = {}; + g_YMapSize = {}; + + var l = new OpenLayers.Layer.Yahoo(); + l.div = g_Div; + l.type = g_Type; + l.map = { + 'getSize': function() { + return g_MapSize; + } + }; + l.getMapObjectSizeFromOLSize = function(mapSize) { + t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize"); + return g_YMapSize; + }; + + l.loadMapObject(); + + YMap = temp; + } + + function test_Layer_Yahoo_onMapResize(t) { + t.plan(2); + + g_MapSize = {}; + g_YMapSize = {}; + + var l = new OpenLayers.Layer.Yahoo(); + l.mapObject = { + 'resizeTo': function(size) { + t.ok(size == g_YMapSize, "correct YSize passed to reiszeTo on map object"); + } + } + l.map = { + 'getSize': function() { + return g_MapSize; + } + }; + l.getMapObjectSizeFromOLSize = function(mapSize) { + t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize"); + return g_YMapSize; + }; + + l.onMapResize(); + } + + function test_Layer_Yahoo_getMapObjectSizeFromOLSize(t) { + t.plan(2); + + var temp = YSize; + YSize = function(w, h) { + t.ok(w == g_Size.w, "correct width passed to YSize constructor"); + t.ok(h == g_Size.h, "correct height passed to YSize constructor"); + } + + g_Size = { + 'w': {}, + 'h': {} + }; + + OpenLayers.Layer.Yahoo.prototype.getMapObjectSizeFromOLSize(g_Size); + + YSize = temp; + } + + + </script> +</head> +<body> + <div id="map"></div> +</body> +</html> diff --git a/misc/openlayers/tests/deprecated/Layer/mice.xml b/misc/openlayers/tests/deprecated/Layer/mice.xml new file mode 100644 index 0000000..4a001ec --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/mice.xml @@ -0,0 +1,156 @@ +<?xml version='1.0' encoding="ISO-8859-1" ?> +<wfs:FeatureCollection + xmlns:bsc="http://www.bsc-eoc.org/bsc" + xmlns:wfs="http://www.opengis.net/wfs" + xmlns:gml="http://www.opengis.net/gml" + xmlns:ogc="http://www.opengis.net/ogc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd + http://www.bsc-eoc.org/bsc http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=OWLS&OUTPUTFORMAT=XMLSCHEMA"> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-89.817223,45.005555 -74.755001,51.701388</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <gml:featureMember><bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-79.771668,45.891110 -79.771668,45.891110</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-79.771668,45.891110</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.755834,46.365277 -83.755834,46.365277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:owlname>owl</bsc:owlname> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.755834,46.365277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.808612,46.175277 -83.808612,46.175277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.808612,46.175277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-84.111112,46.309166 -84.111112,46.309166</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-84.111112,46.309166</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.678612,46.821110 -83.678612,46.821110</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.678612,46.821110</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.664445,46.518888 -83.664445,46.518888</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.664445,46.518888</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-80.613334,46.730277 -80.613334,46.730277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-80.613334,46.730277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-79.676946,45.428054 -79.676946,45.428054</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-79.676946,45.428054</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.853056,46.236944 -83.853056,46.236944</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.853056,46.236944</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-82.289167,45.896388 -82.289167,45.896388</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-82.289167,45.896388</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> +</wfs:FeatureCollection> + diff --git a/misc/openlayers/tests/deprecated/Layer/owls.xml b/misc/openlayers/tests/deprecated/Layer/owls.xml new file mode 100644 index 0000000..4a001ec --- /dev/null +++ b/misc/openlayers/tests/deprecated/Layer/owls.xml @@ -0,0 +1,156 @@ +<?xml version='1.0' encoding="ISO-8859-1" ?> +<wfs:FeatureCollection + xmlns:bsc="http://www.bsc-eoc.org/bsc" + xmlns:wfs="http://www.opengis.net/wfs" + xmlns:gml="http://www.opengis.net/gml" + xmlns:ogc="http://www.opengis.net/ogc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd + http://www.bsc-eoc.org/bsc http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=OWLS&OUTPUTFORMAT=XMLSCHEMA"> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-89.817223,45.005555 -74.755001,51.701388</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <gml:featureMember><bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-79.771668,45.891110 -79.771668,45.891110</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-79.771668,45.891110</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.755834,46.365277 -83.755834,46.365277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:owlname>owl</bsc:owlname> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.755834,46.365277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.808612,46.175277 -83.808612,46.175277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.808612,46.175277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-84.111112,46.309166 -84.111112,46.309166</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-84.111112,46.309166</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.678612,46.821110 -83.678612,46.821110</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.678612,46.821110</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.664445,46.518888 -83.664445,46.518888</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.664445,46.518888</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-80.613334,46.730277 -80.613334,46.730277</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-80.613334,46.730277</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-79.676946,45.428054 -79.676946,45.428054</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-79.676946,45.428054</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-83.853056,46.236944 -83.853056,46.236944</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-83.853056,46.236944</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> + <gml:featureMember> + <bsc:OWLS> + <gml:boundedBy> + <gml:Box srsName="EPSG:4326"> + <gml:coordinates>-82.289167,45.896388 -82.289167,45.896388</gml:coordinates> + </gml:Box> + </gml:boundedBy> + <bsc:msGeometry> + <gml:Point srsName="EPSG:4326"> + <gml:coordinates>-82.289167,45.896388</gml:coordinates> + </gml:Point> + </bsc:msGeometry> + </bsc:OWLS> + </gml:featureMember> +</wfs:FeatureCollection> + |