diff options
Diffstat (limited to 'misc/openlayers/tests/deprecated/Layer/WMS/Post.html')
-rw-r--r-- | misc/openlayers/tests/deprecated/Layer/WMS/Post.html | 89 |
1 files changed, 89 insertions, 0 deletions
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> |