diff options
author | Chris Schlaeger <chris@linux.com> | 2015-10-17 21:36:38 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2015-10-17 21:36:38 +0200 |
commit | e30f267181d990947e67909de4809fa941698c85 (patch) | |
tree | 46e9f94c2b3699ed378963b420b8a8d361286ea1 /misc/openlayers/tests/deprecated | |
parent | e763ceb183f389fcd314a4a6a712d87c9d4cdb32 (diff) | |
download | postrunner-e30f267181d990947e67909de4809fa941698c85.zip |
Upgrading openlayers to 3.x
Diffstat (limited to 'misc/openlayers/tests/deprecated')
20 files changed, 0 insertions, 2594 deletions
diff --git a/misc/openlayers/tests/deprecated/Ajax.html b/misc/openlayers/tests/deprecated/Ajax.html deleted file mode 100644 index e73e80c..0000000 --- a/misc/openlayers/tests/deprecated/Ajax.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> -<head> - <script src="../OLLoader.js"></script> - <script src="../../lib/deprecated.js"></script> - <script type="text/javascript"> - - function test_Ajax_loadUrl(t) { - t.plan(5); - var _get = OpenLayers.Request.GET; - var caller = {}; - var onComplete = function() {}; - var onFailure = function() {}; - var params = {}; - OpenLayers.Request.GET = function(config) { - t.eq(config.url, "http://example.com/?format=image+kml", "correct url") - t.eq(config.params, params, "correct params"); - t.eq(config.scope, caller, "correct scope"); - t.ok(config.success === onComplete, "correct success callback"); - t.ok(config.failure === onFailure, "correct failure callback"); - }; - OpenLayers.loadURL("http://example.com/?format=image+kml", params, caller, onComplete, onFailure); - OpenLayers.Request.GET = _get; - } - </script> -</head> -<body> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/BaseTypes/Class.html b/misc/openlayers/tests/deprecated/BaseTypes/Class.html deleted file mode 100644 index 572765d..0000000 --- a/misc/openlayers/tests/deprecated/BaseTypes/Class.html +++ /dev/null @@ -1,142 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - // remove this next line at 3.0 - var isMozilla = (navigator.userAgent.indexOf("compatible") == -1); - - // Remove this at 3.0 - function test_Class_backwards(t) { - t.plan(4); - // test that a new style class supports old style inheritance - var NewClass = OpenLayers.Class({ - newProp: "new", - initialize: function() { - t.ok(false, "the base class is never instantiated"); - }, - toString: function() { - return "new style"; - } - }); - - var OldClass = OpenLayers.Class.create(); - OldClass.prototype = OpenLayers.Class.inherit(NewClass, { - oldProp: "old", - initialize: function() { - t.ok(true, "only the child class constructor is called"); - } - }); - - var oldObj = new OldClass(); - t.eq(oldObj.oldProp, "old", - "old style classes can still be instantiated"); - t.eq(oldObj.newProp, "new", - "old style inheritance of properties works with new style base"); - t.eq(oldObj.toString(), "new style", - "toString inheritance works with backwards style"); - - } - - // Remove this at 3.0 - function test_Class_create (t) { - t.plan( 3 ); - var cls = OpenLayers.Class.create(); - cls.prototype = { - initialize: function () { - if (isMozilla) - t.ok(this instanceof cls, - "initialize is called on the right class"); - else - t.ok(true, "initialize is called"); - } - }; - var obj = new cls(); - t.eq(typeof obj, "object", "obj is an object"); - if (isMozilla) - t.ok(obj instanceof cls, - "object is of the right class"); - else - t.ok(true, "this test doesn't work in IE"); - } - - // Remove this at 3.0 - function test_Class_inherit (t) { - t.plan( 20 ); - var A = OpenLayers.Class.create(); - var initA = 0; - A.prototype = { - count: 0, - mixed: false, - initialize: function () { - initA++; - this.count++; - } - }; - - var B = OpenLayers.Class.create(); - var initB = 0; - B.prototype = OpenLayers.Class.inherit( A, { - initialize: function () { - A.prototype.initialize.apply(this, arguments); - initB++; - this.count++; - } - }); - - var mixin = OpenLayers.Class.create() - mixin.prototype = { - mixed: true - }; - - t.eq( initA, 0, "class A not inited" ); - t.eq( initB, 0, "class B not inited" ); - - var objA = new A(); - t.eq( objA.count, 1, "object A init" ); - t.eq( initA, 1, "class A init" ); - if (isMozilla) - t.ok( objA instanceof A, "obj A isa A" ); - else - t.ok( true, "IE sucks" ); - - var objB = new B(); - t.eq( initA, 2, "class A init" ); - t.eq( initB, 1, "class B init" ); - t.eq( objB.count, 2, "object B init twice" ); - if (isMozilla) { - t.ok( objB instanceof A, "obj B isa A" ); - t.ok( objB instanceof B, "obj B isa B" ); - } else { - t.ok( true, "IE sucks" ); - t.ok( true, "IE sucks" ); - } - - var C = OpenLayers.Class.create(); - C.prototype = OpenLayers.Class.inherit( B, mixin, {count: 0} ); - t.eq( initA, 2, "class A init unchanged" ); - t.eq( initB, 1, "class B init unchanged" ); - - var objC = new C(); - t.eq( initA, 3, "class A init changed" ); - t.eq( initB, 2, "class B init changed" ); - t.eq( objC.count, 2, "object C init changed" ); - if (isMozilla) { - t.ok( objC instanceof A, "obj C isa A" ); - t.ok( objC instanceof B, "obj C isa B" ); - t.ok( objC instanceof C, "obj C isa C" ); - t.ok( !(objC instanceof mixin), "obj C isn'ta mixin" ); - } else { - t.ok( true, "IE sucks" ); - t.ok( true, "IE sucks" ); - t.ok( true, "IE sucks" ); - t.ok( true, "IE sucks" ); - } - t.eq( objC.mixed, true, "class C has mixin properties" ); - } - - </script> -</head> -<body> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/BaseTypes/Element.html b/misc/openlayers/tests/deprecated/BaseTypes/Element.html deleted file mode 100644 index bd7e074..0000000 --- a/misc/openlayers/tests/deprecated/BaseTypes/Element.html +++ /dev/null @@ -1,56 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - - <script type="text/javascript"> - - function test_Element_hide(t) { - t.plan(2); - - var elem1 = { - style: { - 'display': "none" - } - }; - - var elem2 = { - style: { - 'display': "" - } - }; - - OpenLayers.Element.hide(elem1, elem2, "do-not-exists"); - - t.eq(elem1.style.display, "none", "hidden element stays hidden"); - t.eq(elem2.style.display, "none", "shown element hidden"); - } - - function test_Element_show(t) { - t.plan(2); - - var elem1 = { - style: { - 'display': "none" - } - }; - - var elem2 = { - style: { - 'display': "" - } - }; - - OpenLayers.Element.show(elem1, "do-not-exists", elem2); - - t.eq(elem1.style.display, "", "hidden element shown"); - t.eq(elem2.style.display, "", "shown element stays shown"); - } - - </script> -</head> -<body> - <div id="elemID" style="width:50px; height:100px; background-color:red">test</div> -</body> -</html> -
\ No newline at end of file diff --git a/misc/openlayers/tests/deprecated/Control/MouseToolbar.html b/misc/openlayers/tests/deprecated/Control/MouseToolbar.html deleted file mode 100644 index f66a18b..0000000 --- a/misc/openlayers/tests/deprecated/Control/MouseToolbar.html +++ /dev/null @@ -1,60 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - var map; - function test_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_Control_MouseToolbar_addControl (t) { - t.plan( 8 ); - 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[4] === control, "map.controls contains control" ); - t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Control div zIndexed properly" ); - t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Viewport div contains control div" ); - t.eq( control.div.style.left, "6px", "Control div left located correctly by default"); - t.eq( control.div.style.top, "300px", "Control div top located correctly by default"); - - } - function test_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> diff --git a/misc/openlayers/tests/deprecated/Geometry/Rectangle.html b/misc/openlayers/tests/deprecated/Geometry/Rectangle.html deleted file mode 100644 index 75778e8..0000000 --- a/misc/openlayers/tests/deprecated/Geometry/Rectangle.html +++ /dev/null @@ -1,77 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - - function test_Rectangle_constructor (t) { - t.plan( 8 ); - - //empty - var rect = new OpenLayers.Geometry.Rectangle(); - t.ok( rect instanceof OpenLayers.Geometry.Rectangle, "new OpenLayers.Geometry.Rectangle returns Rectangle object" ); - t.eq( rect.CLASS_NAME, "OpenLayers.Geometry.Rectangle", "Rectangle.CLASS_NAME is set correctly"); - t.ok( rect.id != null, "rect.id is set"); - t.ok( ! (rect.x || rect.y || rect.width || rect.height), "empty construct leaves properties empty"); - - //good - var x = {}; - var y = {}; - var w = {}; - var h = {}; - var rect = new OpenLayers.Geometry.Rectangle(x, y, w, h); - t.eq( rect.x, x, "good init correctly sets x property"); - t.eq( rect.y, y, "good init correctly sets y property"); - t.eq( rect.width, w, "good init correctly sets width property"); - t.eq( rect.height, h, "good init correctly sets height property"); - } - - function test_Rectangle_calculateBounds(t) { - t.plan(1); - - var x = 1; - var y = 2; - var w = 10; - var h = 20; - var rect = new OpenLayers.Geometry.Rectangle(x, y, w, h); - rect.calculateBounds(); - - var testBounds = new OpenLayers.Bounds(x, y, x + w, y + h) - - t.ok( rect.bounds.equals(testBounds), "calculateBounds works correctly"); - } - - function test_Rectangle_getLength(t) { - t.plan(1); - - var x = 1; - var y = 2; - var w = 10; - var h = 20; - var rect = new OpenLayers.Geometry.Rectangle(x, y, w, h); - - var testLength = (2 * w) + (2 * h); - - t.eq(rect.getLength(), testLength, "getLength() works"); - } - - function test_Rectangle_getArea(t) { - t.plan(1); - - var x = 1; - var y = 2; - var w = 10; - var h = 20; - var rect = new OpenLayers.Geometry.Rectangle(x, y, w, h); - - var testArea = w * h; - t.eq(rect.getArea(), testArea, "testArea() works"); - } - - - - </script> -</head> -<body> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/Layer/GML.html b/misc/openlayers/tests/deprecated/Layer/GML.html deleted file mode 100644 index daf5917..0000000 --- a/misc/openlayers/tests/deprecated/Layer/GML.html +++ /dev/null @@ -1,61 +0,0 @@ -<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 deleted file mode 100644 index d65fef6..0000000 --- a/misc/openlayers/tests/deprecated/Layer/MapServer.html +++ /dev/null @@ -1,59 +0,0 @@ -<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 deleted file mode 100644 index f235492..0000000 --- a/misc/openlayers/tests/deprecated/Layer/MapServer/Untiled.html +++ /dev/null @@ -1,158 +0,0 @@ -<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 deleted file mode 100644 index 09b6a54..0000000 --- a/misc/openlayers/tests/deprecated/Layer/WFS.html +++ /dev/null @@ -1,178 +0,0 @@ -<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 deleted file mode 100644 index 43977c8..0000000 --- a/misc/openlayers/tests/deprecated/Layer/WMS.html +++ /dev/null @@ -1,60 +0,0 @@ -<!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 deleted file mode 100644 index d79aec5..0000000 --- a/misc/openlayers/tests/deprecated/Layer/WMS/Post.html +++ /dev/null @@ -1,89 +0,0 @@ -<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 deleted file mode 100755 index f7c67c0..0000000 --- a/misc/openlayers/tests/deprecated/Layer/Yahoo.html +++ /dev/null @@ -1,121 +0,0 @@ -<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 deleted file mode 100644 index 4a001ec..0000000 --- a/misc/openlayers/tests/deprecated/Layer/mice.xml +++ /dev/null @@ -1,156 +0,0 @@ -<?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 deleted file mode 100644 index 4a001ec..0000000 --- a/misc/openlayers/tests/deprecated/Layer/owls.xml +++ /dev/null @@ -1,156 +0,0 @@ -<?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/Popup/AnchoredBubble.html b/misc/openlayers/tests/deprecated/Popup/AnchoredBubble.html deleted file mode 100644 index ffad069..0000000 --- a/misc/openlayers/tests/deprecated/Popup/AnchoredBubble.html +++ /dev/null @@ -1,61 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/Rico/Corner.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - - function test_Popup_Anchored_setOpacity(t) { - t.plan(5); - var opacity = 0.5; - var id = "chicken"; - var w = 500; - var h = 400; - var sz = new OpenLayers.Size(w,h); - var lon = 5; - var lat = 40; - var ll = new OpenLayers.LonLat(lon, lat); - var content = "foo"; - var x = 50; - var y = 100; - - var map = new OpenLayers.Map('map'); - map.addLayer(new OpenLayers.Layer('name', {'isBaseLayer':true})); - map.zoomToMaxExtent(); - - var popup = new OpenLayers.Popup.AnchoredBubble(id, - ll, - sz, - content, - null, - false); - map.addPopup(popup); - - popup.setOpacity(opacity); - popup.draw(new OpenLayers.Pixel(x, y)); - - if (navigator.appName.indexOf("Microsoft") == -1 || new RegExp(/msie 10/).test(navigator.userAgent.toLowerCase())) { - t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity"); - } else { - t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity"); - } - - t.ok(popup.groupDiv!=null, "popup.groupDiv exists"); - t.ok(popup.groupDiv.parentNode!=null, "popup.groupDiv.parentNode exists"); - t.ok(popup.groupDiv.parentNode.getElementsByTagName("span").length > 0, "popup.groupDiv.parentNode has SPAN children"); - - var ricoCornerDiv = popup.groupDiv.parentNode.getElementsByTagName("span")[0]; - if (navigator.appName.indexOf("Microsoft") == -1 || new RegExp(/msie 10/).test(navigator.userAgent.toLowerCase())) { - t.eq(parseFloat(ricoCornerDiv.style.opacity), opacity, "good default ricoCornerDiv.opacity"); - } else { - t.eq(ricoCornerDiv.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default ricoCornerDiv.opacity"); - } - - } - - </script> -</head> -<body> -<div id="map" style="width:512px; height:256px"> </div> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/Protocol/SQL.html b/misc/openlayers/tests/deprecated/Protocol/SQL.html deleted file mode 100644 index f45203d..0000000 --- a/misc/openlayers/tests/deprecated/Protocol/SQL.html +++ /dev/null @@ -1,24 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - - function test_initialize(t) { - t.plan(3); - var options = {tableName: 'my_features', - databaseName: 'my_database_name'} - var protocol = new OpenLayers.Protocol.SQL(options); - - t.ok(protocol instanceof OpenLayers.Protocol.SQL, - "new OpenLayers.Protocol.SQL returns object"); - - t.eq(protocol.tableName, options.tableName, "tableName property is set"); - t.eq(protocol.databaseName, options.databaseName, "databaseName property is set"); - } - - </script> -</head> -<body> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/Protocol/SQL/Gears.html b/misc/openlayers/tests/deprecated/Protocol/SQL/Gears.html deleted file mode 100644 index 0909fb4..0000000 --- a/misc/openlayers/tests/deprecated/Protocol/SQL/Gears.html +++ /dev/null @@ -1,474 +0,0 @@ -<html> -<head> - <script src="../../../OLLoader.js"></script> - <script src="../../../../lib/deprecated.js"></script> - <script type="text/javascript"> - - function test_initialize(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(5); - - t.eq(protocol.CLASS_NAME, "OpenLayers.Protocol.SQL.Gears", - "ctor returns correct value"); - - t.eq(protocol.jsonParser.CLASS_NAME, - "OpenLayers.Format.JSON", - "ctor creates a JSON parser"); - - t.eq(protocol.wktParser.CLASS_NAME, - "OpenLayers.Format.WKT", - "ctor creates a WKT parser"); - - var str = protocol.FID_PREFIX + "foo_bar"; - t.ok(str.match(protocol.fidRegExp), - "ctor creates correct regexp"); - - t.ok(typeof protocol.db == "object", - "ctor creates a db object"); - - protocol.clear(); - protocol.destroy(); - } - - function test_destroy(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(3); - - protocol.destroy(); - - t.eq(protocol.db, null, - "destroy nullifies db"); - t.eq(protocol.jsonParser, null, - "destroy nullifies jsonParser"); - t.eq(protocol.wktParser, null, - "destroy nullifies wktParser"); - } - - function test_read(t) { - var protocolCallback, readCallback; - var protocolOptions = {callback: protocolCallback}; - var readOptions = {callback: readCallback}; - - var protocol = new OpenLayers.Protocol.SQL.Gears(protocolOptions); - if (!protocol.supported()) { - t.plan(0); - return; - } - - function okCallback(resp) { - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "read calls correct callback with a response object"); - } - - function failCallback(resp) { - t.fail("read calls incorrect callback"); - } - - t.plan(4); - - var resp; - - // 2 tests - protocolOptions.callback = okCallback; - readOptions.callback = failCallback; - resp = protocol.read(); - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "read returns a response object"); - - // 2 test - protocolOptions.callback = failCallback; - readOptions.callback = okCallback; - resp = protocol.read(readOptions); - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "read returns a response object"); - - protocol.clear(); - protocol.destroy(); - } - - function test_unfreezeFeature(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(10); - - var feature; - var wkt, json, fid, state; - - json = "{\"fake\":\"properties\"}"; - fid = "1000"; - state = OpenLayers.State.INSERT; - - var row = { - fieldByName: function(str) { - if (str == "geometry") { - return wkt; - } - if (str == "properties") { - return json; - } - if (str == "fid") { - return fid; - } - if (str == "state") { - return state; - } - } - }; - - // 5 tests - wkt = "POINT(1 2)"; - feature = protocol.unfreezeFeature(row); - t.eq(feature.CLASS_NAME, "OpenLayers.Feature.Vector", - "unfreezeFeature returns an OpenLayers.Feature.Vector"); - t.ok(feature.geometry.x == 1 && feature.geometry.y == 2, - "unfreezeFeature returns a feature with correct geometry"); - t.eq(feature.attributes.fake, "properties", - "unfreezeFeature returns a feature with correct attributes"); - t.eq(feature.fid, fid, - "unfreezeFeature returns a feature with fid"); - t.eq(feature.state, state, - "unfreezeFeature returns a feature with state"); - - // 5 tests - wkt = protocol.NULL_GEOMETRY; - state = protocol.NULL_FEATURE_STATE; - feature = protocol.unfreezeFeature(row); - t.eq(feature.CLASS_NAME, "OpenLayers.Feature.Vector", - "unfreezeFeature returns an OpenLayers.Feature.Vector"); - t.eq(feature.geometry, null, - "unfreezeFeature returns a feature with correct geometry"); - t.eq(feature.attributes.fake, "properties", - "unfreezeFeature returns a feature with correct attributes"); - t.eq(feature.fid, fid, - "unfreezeFeature returns a feature with fid"); - t.eq(feature.state, null, - "unfreezeFeature returns a feature with state"); - - protocol.clear(); - protocol.destroy(); - } - - function test_extractFidFromField(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(4); - - var field, fid; - - // fid is a string, field is not prefixed with FID_PREFIX - // 1 test - field = "10"; - res = protocol.extractFidFromField(field); - t.eq(res, "10", - "extractFidFromField returns expected string"); - - // fid is a string, field is prefixed with FID_PREFIX - // 1 test - field = protocol.FIX_PREFIX + "10"; - res = protocol.extractFidFromField(field); - t.eq(res, protocol.FIX_PREFIX + "10", - "extractFidFromField returns expected prefixed string"); - - // fid is a number, field is not prefixed with FIX_PREFIX - // 1 test - protocol.typeOfFid = "number"; - field = "10"; - res = protocol.extractFidFromField(field); - t.eq(res, 10, - "extractFidFromField returns expected number"); - - // fid is a number, field is prefixed with FIX_PREFIX - // 1 test - protocol.typeOfFid = "number"; - field = protocol.FID_PREFIX + "10"; - res = protocol.extractFidFromField(field); - t.eq(res, protocol.FID_PREFIX + "10", - "extractFidFromField returns expected prefixed string"); - } - - function test_freezeFeature(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(8); - - var feature, res; - - // 4 tests - feature = new OpenLayers.Feature.Vector(); - feature.geometry = new OpenLayers.Geometry.Point(1, 2); - feature.attributes.fake = "properties"; - feature.fid = "1000"; - feature.state = OpenLayers.State.INSERT; - res = protocol.freezeFeature(feature); - t.eq(res[0], feature.fid, - "freezeFeature returns correct fid"); - t.eq(res[1], "POINT(1 2)", - "freezeFeature returns correct WKT"); - t.eq(res[2], "{\"fake\":\"properties\"}", - "freezeFeature returns correct JSON"); - t.eq(res[3], feature.state, - "freezeFeature returns correct feature state"); - - // 4 tests - protocol.saveFeatureState = false; - feature = new OpenLayers.Feature.Vector(); - feature.attributes.fake = "properties"; - feature.fid = "1000"; - feature.state = OpenLayers.State.INSERT; - res = protocol.freezeFeature(feature); - t.eq(res[0], feature.fid, - "freezeFeature returns correct fid"); - t.eq(res[1], protocol.NULL_GEOMETRY, - "freezeFeature returns expected null geom string"); - t.eq(res[2], "{\"fake\":\"properties\"}", - "freezeFeature returns correct JSON"); - t.eq(res[3], protocol.NULL_FEATURE_STATE, - "freezeFeature returns expected null feature state string"); - - protocol.clear(); - protocol.destroy(); - } - - function test_create(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(8); - - var resp; - var scope = {"fake": "scope"}; - - var options = { - callback: function(resp) { - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "user callback is passed a response"); - t.eq(resp.requestType, "create", - "user callback is passed correct request type in resp"); - t.ok(this == scope, - "user callback called with correct scope"); - }, - scope: scope - }; - - // 4 tests - var feature = new OpenLayers.Feature.Vector(); - feature.fid = "1000"; - feature.attributes.fake = "properties"; - feature.state = OpenLayers.State.INSERT; - resp = protocol.create([feature], options); - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "create returns a response"); - - // check what we have in the DB - // 4 tests - resp = protocol.read({"noFeatureStateReset": true}); - t.eq(resp.features.length, 1, - "create inserts feature in the DB"); - t.eq(resp.features[0].fid, feature.fid, - "create inserts feature with correct fid"); - t.eq(resp.features[0].attributes.fake, feature.attributes.fake, - "create inserts feature with correct attributes"); - t.eq(resp.features[0].state, feature.state, - "create inserts feature with correct state"); - - protocol.clear(); - protocol.destroy(); - } - - function test_createOrUpdate(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(5); - - // 1 test - var feature = new OpenLayers.Feature.Vector(); - feature.fid = "1000"; - feature.attributes.fake = "properties"; - feature.state = OpenLayers.State.INSERT; - resp = protocol.createOrUpdate([feature]); - t.eq(resp.CLASS_NAME, "OpenLayers.Protocol.Response", - "createOrUpdate returns a response"); - - // check what we have in the DB - // 4 tests - resp = protocol.read({"noFeatureStateReset": true}); - t.eq(resp.features.length, 1, - "createOrUpdate inserts feature in the DB"); - t.eq(resp.features[0].fid, feature.fid, - "createOrUpdate inserts feature with correct fid"); - t.eq(resp.features[0].attributes.fake, feature.attributes.fake, - "createOrUpdate inserts feature with correct attributes"); - t.eq(resp.features[0].state, feature.state, - "createOrUpdate inserts feature with correct state"); - - protocol.clear(); - protocol.destroy(); - } - - function test_delete(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(4); - - function createOneAndDeleteOne(fid, deleteOptions) { - var feature = new OpenLayers.Feature.Vector(); - feature.fid = fid; - feature.attributes.fake = "properties"; - feature.state = OpenLayers.State.INSERT; - var r = protocol.create([feature]); - protocol["delete"](r.reqFeatures, deleteOptions); - } - - var resp, fid; - - // 1 test - fid = 1000; - protocol.saveFeatureState = false; - createOneAndDeleteOne(fid) - resp = protocol.read(); - t.eq(resp.features.length, 0, - "delete deletes feature if saveFeatureState is false"); - protocol.clear(); - - // 1 test - fid = 1000; - protocol.saveFeatureState = true; - createOneAndDeleteOne(fid); - resp = protocol.read(); - t.eq(resp.features.length, 1, - "delete does not delete feature if saveFeatureState is true"); - protocol.clear(); - - // 1 test - fid = "1000"; - protocol.saveFeatureState = true; - createOneAndDeleteOne(fid); - resp = protocol.read(); - t.eq(resp.features.length, 1, - "delete does not delete feature if saveFeatureState is true"); - protocol.clear(); - - // 1 test - fid = protocol.FID_PREFIX + "1000"; - protocol.saveFeatureState = true; - createOneAndDeleteOne(fid, {dontDelete: true}); - resp = protocol.read(); - t.eq(resp.features.length, 0, - "delete deletes feature if saveFeatureState is true and fid is prefixed"); - protocol.clear(); - - protocol.destroy(); - } - - function test_callUserCallback(t) { - var protocol = new OpenLayers.Protocol.SQL.Gears(); - if (!protocol.supported()) { - t.plan(0); - return; - } - - t.plan(6); - - var options, resp; - var scope = {'fake': 'scope'}; - - // test commit callback - // 1 tests - options = { - 'callback': function() { - t.ok(this == scope, 'callback called with correct scope'); - }, - 'scope': scope - }; - resp = {'requestType': 'create', 'last': true}; - protocol.callUserCallback(options, resp); - // 0 test - resp = {'requestType': 'create', 'last': false}; - protocol.callUserCallback(options, resp); - - // test create callback - // 2 tests - options = { - 'create': { - 'callback': function(r) { - t.ok(this == scope, 'callback called with correct scope'); - t.ok(r == resp, 'callback called with correct response'); - }, - 'scope': scope - } - }; - resp = {'requestType': 'create'}; - protocol.callUserCallback(options, resp); - - // test with both callbacks set - // 3 tests - options = { - 'create': { - 'callback': function(r) { - t.ok(this == scope, 'callback called with correct scope'); - t.ok(r == resp, 'callback called with correct response'); - }, - 'scope': scope - }, - 'callback': function() { - t.ok(this == scope, 'callback called with correct scope'); - }, - 'scope': scope - }; - resp = {'requestType': 'create', 'last': true}; - protocol.callUserCallback(options, resp); - - // no callback set - // 0 test - options = { - 'delete': { - 'callback': function(resp) { - t.fail('callback should not get called'); - } - } - }; - resp = {'requestType': 'create'}; - protocol.callUserCallback(options, resp); - - // cleanup - protocol.destroy(); - } - - </script> -</head> -<body> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/Renderer/SVG2.html b/misc/openlayers/tests/deprecated/Renderer/SVG2.html deleted file mode 100644 index c23b95c..0000000 --- a/misc/openlayers/tests/deprecated/Renderer/SVG2.html +++ /dev/null @@ -1,399 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - - var geometry = null, node = null; - - function test_SVG_constructor(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - var r = new OpenLayers.Renderer.SVG2(document.body); - t.ok(r instanceof OpenLayers.Renderer.SVG2, "new OpenLayers.Renderer.SVG2 returns SVG object" ); - } - - function test_SVG_destroy(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - - var g_Destroy = false; - - OpenLayers.Renderer.Elements.prototype._destroy = - OpenLayers.Renderer.Elements.prototype.destroy; - - OpenLayers.Renderer.prototype.destroy = function() { - g_Destroy = true; - } - - var r = new OpenLayers.Renderer.SVG2(document.body); - r.destroy(); - - t.eq(g_Destroy, true, "OpenLayers.Renderer.Elements.destroy() called"); - - OpenLayers.Renderer.prototype.destroy = - OpenLayers.Renderer.prototype._destroy; - } - - function test_SVG_updateDimensions(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(7); - - OpenLayers.Renderer.SVG2.prototype._setExtent = - OpenLayers.Renderer.SVG2.prototype.setExtent; - - var g_SetExtent = false; - OpenLayers.Renderer.SVG2.prototype.setExtent = function() { - g_SetExtent = true; - OpenLayers.Renderer.SVG2.prototype._setExtent.apply(this, arguments); - } - - var r = new OpenLayers.Renderer.SVG2(document.body); - var extent = new OpenLayers.Bounds(1,2,3,4); - r.map = { - getResolution: function() { - return 0.5; - }, - getExtent: function() { - return extent; - }, - getMaxExtent: function() { - return extent; - } - } - r.updateDimensions(); - - t.eq(g_SetExtent, true, "Elements.setExtent() called"); - - t.eq(r.extent.toString(), extent.scale(3).toString(), "renderer's extent is correct"); - t.eq(r.rendererRoot.getAttributeNS(null, "width"), "12", "width is correct"); - t.eq(r.rendererRoot.getAttributeNS(null, "height"), "12", "height is correct"); - t.eq(r.rendererRoot.getAttributeNS(null, "viewBox"), "-1 -6 6 6", "rendererRoot viewBox is correct"); - - // test extent changes - extent = new OpenLayers.Bounds(2,3,5,6); - r.updateDimensions(); - t.eq(r.extent.toString(), extent.scale(3).toString(), "renderer's extent changed after updateDimensions"); - t.eq(r.rendererRoot.getAttributeNS(null, "viewBox"), "-1 -9 9 9", "rendererRoot viewBox is correct after a new setExtent"); - - OpenLayers.Renderer.SVG2.prototype.setExtent = - OpenLayers.Renderer.SVG2.prototype._setExtent; - } - - function test_SVG_drawpoint(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - var properDraw = false; - var g_Radius = null; - r.drawCircle = function(n, g, r) { - properDraw = true; - g_Radius = 1; - } - r.drawPoint(); - - t.ok(properDraw && g_Radius == 1, "drawPoint called drawCircle with radius set to 1"); - } - - function test_SVG_drawcircle(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(5); - - var r = new OpenLayers.Renderer.SVG2(document.body); - r.resolution = 0.5; - r.left = 0; - r.top = 0; - - var node = document.createElement('div'); - - var geometry = { - x: 1, - y: 2 - } - - r.drawCircle(node, geometry, 3); - - t.eq(node.getAttributeNS(null, 'cx'), '1', "cx is correct"); - t.eq(node.getAttributeNS(null, 'cy'), '-2', "cy is correct"); - t.eq(node._radius, 3, "radius preset is correct"); - - // #1274: out of bound node fails when first added - var geometry = { - x: 10000000, - y: 200000000, - CLASS_NAME: "OpenLayers.Geometry.Point", - id: "foo", - getBounds: function() {return {bottom: 0}} - } - node.id = geometry.id; - r.root.appendChild(node); - - var drawCircleCalled = false; - r.drawCircle = function() { - drawCircleCalled = true; - return OpenLayers.Renderer.SVG2.prototype.drawCircle.apply(r, arguments); - } - - r.drawGeometry(geometry, {pointRadius: 3}, "blah_4000"); - t.eq(drawCircleCalled, true, "drawCircle called on drawGeometry for a point geometry.") - t.ok(node.parentNode != r.root, "circle will not be drawn when coordinates are outside the valid range"); - } - - function test_SVG_drawlinestring(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(2); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - var node = document.createElement('div'); - - var geometry = { - components: "foo" - } - g_GetString = false; - g_Components = null; - r.getComponentsString = function(c) { - g_GetString = true; - g_Components = c; - return "bar"; - } - - r.drawLineString(node, geometry); - - t.ok(g_GetString && g_Components == "foo", "getComponentString is called with valid arguments"); - t.eq(node.getAttributeNS(null, "points"), "bar", "points attribute is correct"); - } - - function test_SVG_drawlinearring(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(2); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - var node = document.createElement('div'); - - var geometry = { - components: "foo" - } - g_GetString = false; - g_Components = null; - r.getComponentsString = function(c) { - g_GetString = true; - g_Components = c; - return "bar"; - } - - r.drawLinearRing(node, geometry); - - t.ok(g_GetString, "getComponentString is called with valid arguments"); - t.eq(node.getAttributeNS(null, "points"), "bar", "points attribute is correct"); - } - - function test_SVG_drawpolygon(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(3); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - var node = document.createElement('div'); - - var linearRings = [{ - components: ["foo"] - },{ - components: ["bar"] - }] - - var geometry = { - components: linearRings - } - g_GetString = false; - r.getShortString = function(c) { - g_GetString = true; - return c; - } - - r.drawPolygon(node, geometry); - - t.ok(g_GetString, "getShortString is called"); - t.eq(node.getAttributeNS(null, "d"), "M foo M bar z", "d attribute is correctly set"); - t.eq(node.getAttributeNS(null, "fill-rule"), "evenodd", "fill-rule attribute is correctly set"); - } - - function test_SVG_drawrectangle(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(4); - - var r = new OpenLayers.Renderer.SVG2(document.body); - r.resolution = 0.5; - r.left = 0; - r.top = 0; - - var node = document.createElement('div'); - - var geometry = { - x: 1, - y: 2, - width: 3, - height: 4 - } - - r.drawRectangle(node, geometry); - - t.eq(node.getAttributeNS(null, "x"), "1", "x attribute is correctly set"); - t.eq(node.getAttributeNS(null, "y"), "-2", "y attribute is correctly set"); - t.eq(node.getAttributeNS(null, "width"), "3", "width attribute is correctly set"); - t.eq(node.getAttributeNS(null, "height"), "4", "height attribute is correctly set"); - } - - function test_SVG_getcomponentsstring(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - - var components = ['foo', 'bar']; - - OpenLayers.Renderer.SVG2.prototype._getShortString = - OpenLayers.Renderer.SVG2.prototype.getShortString; - - OpenLayers.Renderer.SVG2.prototype.getShortString = function(p) { - return p; - }; - - var string = OpenLayers.Renderer.SVG2.prototype.getComponentsString(components); - t.eq(string, "foo,bar", "returned string is correct"); - - OpenLayers.Renderer.SVG2.prototype.getShortString = - OpenLayers.Renderer.SVG2.prototype._getShortString; - } - - - - function test_SVG_getshortstring(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - - var r = new OpenLayers.Renderer.SVG2(document.body); - r.resolution = 0.5; - r.left = 0; - r.top = 0; - - var point = { - x: 1, - y: 2 - }; - - var string = r.getShortString(point); - t.eq(string, "1,-2", "returned string is correct"); - } - - function test_svg_getnodetype(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(1); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - var g = {CLASS_NAME: "OpenLayers.Geometry.Point"} - var s = {graphicName: "square"}; - - t.eq(r.getNodeType(g, s), "svg", "Correct node type for well known symbols"); - } - - function test_svg_importsymbol(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(2); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - r.importSymbol("square"); - - var polygon = document.getElementById(r.container.id + "_defs").firstChild.firstChild; - - var pass = false; - for (var i = 0; i < polygon.points.numberOfItems; i++) { - var p = polygon.points.getItem(i); - pass = p.x === OpenLayers.Renderer.symbol.square[2*i] && - p.y === OpenLayers.Renderer.symbol.square[2*i+1]; - if (!pass) { - break; - } - } - t.ok(pass, "Square symbol rendered correctly"); - t.ok(r.symbolMetrics["-square"], "Symbol metrics cached correctly."); - } - - function test_svg_dashstyle(t) { - if (!OpenLayers.Renderer.SVG2.prototype.supported()) { - t.plan(0); - return; - } - - t.plan(5); - - var r = new OpenLayers.Renderer.SVG2(document.body); - - t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dot"}, 1), "1,4", "dot dasharray created correctly"); - t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dash"}, 1), "4,4", "dash dasharray created correctly"); - t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "longdash"}, 1), "8,4", "longdash dasharray created correctly"); - t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "dashdot"}, 1), "4,4,1,4", "dashdot dasharray created correctly"); - t.eq(r.dashStyle({strokeWidth: 1, strokeDashstyle: "longdashdot"}, 1), "8,4,1,4", "dashdot dasharray created correctly"); - } - - </script> -</head> -<body> -<div id="map" style="width:500px;height:550px"></div> -</body> -</html> diff --git a/misc/openlayers/tests/deprecated/Tile/WFS.html b/misc/openlayers/tests/deprecated/Tile/WFS.html deleted file mode 100644 index 3dee1c7..0000000 --- a/misc/openlayers/tests/deprecated/Tile/WFS.html +++ /dev/null @@ -1,215 +0,0 @@ -<html> -<head> - <script src="../../OLLoader.js"></script> - <script src="../../../lib/deprecated.js"></script> - <script type="text/javascript"> - var tile; - - var map, layer; - function setUp() { - map = new OpenLayers.Map("map"); - layer = new OpenLayers.Layer(null, { - isBaseLayer: true - }); - map.addLayer(layer) - map.setCenter(new OpenLayers.LonLat(0, 0)); - } - - function tearDown() { - map.destroy(); - map = null; - layer = null; - } - - function test_Tile_WFS_constructor (t) { - t.plan( 8 ); - setUp(); - - var position = new OpenLayers.Pixel(10,20); - var bounds = new OpenLayers.Bounds(1,2,3,4); - var url = "bobob"; - var size = new OpenLayers.Size(5,6); - - tile = new OpenLayers.Tile.WFS(layer, position, bounds, url, size); - - t.ok( tile instanceof OpenLayers.Tile.WFS, "new OpenLayers.Tile.WFS returns Tile.WFS object" ); - t.ok( tile.layer === layer, "tile.layer set correctly"); - t.ok( tile.position.equals(position), "tile.position set correctly"); - t.ok( tile.bounds.equals(bounds), "tile.bounds set correctly"); - t.eq( tile.url, url, "tile.url set correctly"); - t.ok( tile.size.equals(size), "tile.size is set correctly" ); - - t.ok( tile.id != null, "tile is given an id"); - t.ok( tile.events != null, "tile's events intitialized"); - - tearDown(); - } - - function test_Tile_WFS_requestSuccess(t) { - t.plan(2); - setUp(); - - var tile = { - 'request': {} - }; - - OpenLayers.Tile.WFS.prototype.requestSuccess.apply(tile, []); - - t.ok(tile.request == null, "request property on tile set to null"); - - var position = new OpenLayers.Pixel(10,20); - var bounds = new OpenLayers.Bounds(1,2,3,4); - var url = "bobob"; - var size = new OpenLayers.Size(5,6); - - tile = new OpenLayers.Tile.WFS(layer, position, bounds, url, size); - tile.destroy(); - tile.requestSuccess({'requestText': '<xml><foo /></xml>'}); - t.ok(true, "Didn't fail after calling requestSuccess on destroyed tile."); - - tearDown(); - } - - function test_Tile_WFS_loadFeaturesForRegion(t) { - t.plan(9); - - var tile = { - 'url': {} - }; - - var g_Success = {}; - - var _get = OpenLayers.Request.GET; - OpenLayers.Request.GET = function(config) { - t.ok(config.url == tile.url, "tile's url correctly passed"); - t.ok(config.params == null, "null params"); - t.ok(config.scope == tile, "tile passed as scope"); - t.ok(config.success == g_Success, "success passed"); - }; - - //no running request -- 4 tests - OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); - - //running request (cancelled) -- 4 tests + 1 test (for request abort) - tile.request = { - 'abort': function() { - t.ok(true, "request aborted"); - } - }; - OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); - - OpenLayers.Request.GET = _get; - } - - function test_Tile_WFS_destroy(t) { - t.plan(9); - setUp(); - - var position = new OpenLayers.Pixel(10,20); - var bounds = new OpenLayers.Bounds(1,2,3,4); - var url = "bobob"; - var size = new OpenLayers.Size(5,6); - - tile = new OpenLayers.Tile.WFS(layer, position, bounds, url, size); - tile.events.destroy = function() { - t.ok(true, "tile events destroy() called"); - }; - - - var _gAbort = false; - tile.request = { - abort: function() { - _gAbort = true; - } - } - - - tile.destroy(); - - t.ok(tile.layer == null, "tile.layer set to null"); - t.ok(tile.bounds == null, "tile.bounds set to null"); - t.ok(tile.size == null, "tile.size set to null"); - t.ok(tile.position == null, "tile.position set to null"); - t.ok(_gAbort, "request transport is aborted"); - t.ok(tile.request == null, "tile.request set to null"); - - t.ok(tile.events == null, "tile.events set to null"); - - tile.requestSuccess({'requestText': '<xml><foo /></xml>'}); - t.ok(true, "Didn't fail after calling requestSuccess on destroyed tile."); - - tearDown(); - } - function test_nonxml_format(t) { - t.plan(2); - - setUp(); - - var data = '{"type":"Feature", "id":"OpenLayers.Feature.Vector_135", "properties":{}, "geometry":{"type":"Point", "coordinates":[118.125, -18.6328125]}, "crs":{"type":"OGC", "properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}' - var position = new OpenLayers.Pixel(10,20); - var bounds = new OpenLayers.Bounds(1,2,3,4); - var url = "bobob"; - var size = new OpenLayers.Size(5,6); - - var log = []; - - var l = new OpenLayers.Layer(null, { - vectorMode: true, - formatObject: new OpenLayers.Format.GeoJSON(), - addFeatures: function(features) { - log.push(features); - } - }) - map.addLayer(l); - - var tile = new OpenLayers.Tile.WFS(l, position, bounds, url, size); - - tile.requestSuccess({responseText: data}); - - t.eq(log.length, 1, "one call logged") - t.eq(log[0] && log[0].length, 1, "GeoJSON format returned a single feature which was added."); - - tearDown(); - } - - function test_xml_string_and_dom(t) { - t.plan(4); - setUp(); - - var data = '<?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>-94.989723,43.285833 -74.755001,51.709520</gml:coordinates> </gml:Box> </gml:boundedBy> <gml:featureMember> <bsc:OWLS> <gml:boundedBy> <gml:Box srsName="EPSG:4326"> <gml:coordinates>-94.142500,50.992777 -94.142500,50.992777</gml:coordinates> </gml:Box> </gml:boundedBy> <bsc:msGeometry> <gml:Point srsName="EPSG:4326"> <gml:coordinates>-94.142500,50.992777</gml:coordinates> </gml:Point> </bsc:msGeometry> <bsc:ROUTEID>ON_2</bsc:ROUTEID> <bsc:ROUTE_NAME>Suffel Road</bsc:ROUTE_NAME> <bsc:LATITUDE>50.9927770</bsc:LATITUDE> <bsc:LONGITUDE>-94.1425000</bsc:LONGITUDE> </bsc:OWLS> </gml:featureMember></wfs:FeatureCollection>'; - var position = new OpenLayers.Pixel(10,20); - var bounds = new OpenLayers.Bounds(1,2,3,4); - var url = "bobob"; - var size = new OpenLayers.Size(5,6); - - var l = new OpenLayers.Layer(); - map.addLayer(l); - - var tile = new OpenLayers.Tile.WFS(l, position, bounds, url, size); - - var log = []; - tile.addResults = function(results) { - log.push(results); - } - tile.requestSuccess({responseText: data}); - - t.eq(log.length, 1, "first call logged"); - t.eq(log[0] && log[0].length, 1, "results count is correct when passing in XML as a string into non-vectormode"); - - log.length = 0; - tile.addResults = function(results) { - log.push(results); - } - tile.requestSuccess({responseXML: OpenLayers.Format.XML.prototype.read(data)}); - - t.eq(log.length, 1, "second call logged"); - t.eq(log[0] && log[0].length, 1, "results count is correct when passing in XML as DOM into non-vectormode"); - - tearDown(); - } - </script> -</head> -<body> -</body> -</html> - diff --git a/misc/openlayers/tests/deprecated/Util.html b/misc/openlayers/tests/deprecated/Util.html deleted file mode 100644 index e65340b..0000000 --- a/misc/openlayers/tests/deprecated/Util.html +++ /dev/null @@ -1,20 +0,0 @@ -<html> - <head> - <script> -var custom$ = function() {}; -window.$ = custom$; - </script> - <script src="../OLLoader.js"></script> - <script src="../../lib/deprecated.js"></script> - <script> - -function test_$(t) { - t.plan(1); - t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $."); -} - - </script> - </head> - <body> - </body> -</html>
\ No newline at end of file |