propset svn:eol-style native recursively throughout trunk. enjoy\!

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2978 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-04-02 16:46:34 +00:00
parent 9e688ebb37
commit 7f0ccb69f0
14 changed files with 1893 additions and 1878 deletions
+249 -234
View File
@@ -1,234 +1,249 @@
<html>
<head>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>Z
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var params = { map: '/mapdata/vmap_wms.map',
layers: 'basic'};
function test_01_Layer_MapServer_constructor (t) {
t.plan( 4 );
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
t.ok( layer instanceof OpenLayers.Layer.MapServer, "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_02_Layer_MapServer_addtile (t) {
t.plan( 6 );
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
var pixel = new OpenLayers.Pixel(5,6);
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},params);
tParams = OpenLayers.Util.extend(tParams, {
layers: 'basic',
mode: 'map',
map_imagetype: 'png',
mapext:[1,2,3,4],
imgext:[1,2,3,4],
map_size:[256, 256],
imgx:128,
imgy:128,
imgxy:[256,256]
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
"image src is created correctly via addtile" );
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
}
function test_03_Layer_MapServer_inittiles (t) {
t.plan( 2 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),5);
t.eq( layer.grid.length, 7, "Grid rows is correct." );
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
}
function test_04_Layer_MapServer_clone (t) {
t.plan(4);
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
layer.grid = [ [6, 7],
[8, 9]];
var clone = layer.clone();
t.ok( clone.grid != layer.grid, "clone does not copy grid");
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
layer.tileSize.w += 40;
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
layer.grid = null;
}
function test_05_Layer_MapServer_isBaseLayer(t) {
t.plan(3);
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend(new Object(), params);
newParams.transparent = "true";
layer = new OpenLayers.Layer.MapServer(name, url, newParams);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false});
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
}
function test_06_Layer_MapServer_mergeNewParams (t) {
t.plan( 5 );
var map = new OpenLayers.Map("map");
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(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");
}
function test_07_Layer_MapServer_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(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");
}
function test_08_Layer_MapServer_setOpacity (t) {
t.plan( 5 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
tParams = { layers: 'basic',
format: 'image/png'};
tOptions = { 'opacity': '0.5' };
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams, tOptions);
map.addLayer(tLayer);
map.zoomToMaxExtent();
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
tLayer.setOpacity("0.6");
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
var pixel = new OpenLayers.Pixel(5,6);
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
}
function test_20_Layer_MapServer_Reproject (t) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
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, "top side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
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");
}
function test_99_Layer_MapServer_destroy (t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
<html>
<head>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>Z
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var params = { map: '/mapdata/vmap_wms.map',
layers: 'basic'};
function test_01_Layer_MapServer_constructor (t) {
t.plan( 4 );
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
t.ok( layer instanceof OpenLayers.Layer.MapServer, "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_02_Layer_MapServer_addtile (t) {
t.plan( 6 );
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
var pixel = new OpenLayers.Pixel(5,6);
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},params);
tParams = OpenLayers.Util.extend(tParams, {
layers: 'basic',
mode: 'map',
map_imagetype: 'png',
mapext:[1,2,3,4],
imgext:[1,2,3,4],
map_size:[256, 256],
imgx:128,
imgy:128,
imgxy:[256,256]
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
"image src is created correctly via addtile" );
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
}
function test_03_Layer_MapServer_inittiles (t) {
t.plan( 2 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),5);
t.eq( layer.grid.length, 7, "Grid rows is correct." );
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
}
function test_04_Layer_MapServer_clone (t) {
t.plan(4);
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
layer.grid = [ [6, 7],
[8, 9]];
var clone = layer.clone();
t.ok( clone.grid != layer.grid, "clone does not copy grid");
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
layer.tileSize.w += 40;
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
layer.grid = null;
}
function test_05_Layer_MapServer_isBaseLayer(t) {
t.plan(3);
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(name, url, params);
t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend(new Object(), params);
newParams.transparent = "true";
layer = new OpenLayers.Layer.MapServer(name, url, newParams);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false});
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
}
function test_06_Layer_MapServer_mergeNewParams (t) {
t.plan( 5 );
var map = new OpenLayers.Map("map");
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapServer(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");
}
function test_07_Layer_MapServer_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(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");
}
function test_08_Layer_MapServer_setOpacity (t) {
t.plan( 5 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
tParams = { layers: 'basic',
format: 'image/png'};
tOptions = { 'opacity': '0.5' };
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams, tOptions);
map.addLayer(tLayer);
map.zoomToMaxExtent();
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
tLayer.setOpacity("0.6");
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
var pixel = new OpenLayers.Pixel(5,6);
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
}
function test_20_Layer_MapServer_Reproject (t) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
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, "top side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
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");
}
function test_99_Layer_MapServer_destroy (t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.destroy();
// checks to make sure superclass (grid) destroy() was called
t.ok( layer.grid == null, "grid set to null");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>
+163 -163
View File
@@ -1,163 +1,163 @@
<html>
<head>A
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var params = { map: '/mapdata/vmap_wms.map',
Alayers: 'basic'};
function test_01_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_04_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, "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;
}
function test_05_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(new Object(), 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_06_Layer_MapServer_Untiled_mergeNewParams (t) {
t.plan( 5 );
var map = new OpenLayers.Map("map");
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.tile.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.tile.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");
}
function test_07_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',
srs: 'EPSG:4326'
};
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
sStr = sStr.replace(/,/g, "+");
t.eq(str, sStr , "getFullRequestString() works");
}
function test_08_Layer_MapServer_Untiled_setOpacity (t) {
t.plan( 4 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
tParams = { layers: 'basic',
format: 'image/png'};
tOptions = { 'opacity': '0.5' };
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams, tOptions);
map.addLayer(tLayer);
map.zoomToMaxExtent();
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
tLayer.setOpacity("0.6");
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
}
function test_99_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");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:256px;height:256px"></div>
</body>
</html>
<html>
<head>A
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
var params = { map: '/mapdata/vmap_wms.map',
Alayers: 'basic'};
function test_01_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_04_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, "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;
}
function test_05_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(new Object(), 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_06_Layer_MapServer_Untiled_mergeNewParams (t) {
t.plan( 5 );
var map = new OpenLayers.Map("map");
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.tile.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.tile.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");
}
function test_07_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',
srs: 'EPSG:4326'
};
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
sStr = sStr.replace(/,/g, "+");
t.eq(str, sStr , "getFullRequestString() works");
}
function test_08_Layer_MapServer_Untiled_setOpacity (t) {
t.plan( 4 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
tParams = { layers: 'basic',
format: 'image/png'};
tOptions = { 'opacity': '0.5' };
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams, tOptions);
map.addLayer(tLayer);
map.zoomToMaxExtent();
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
tLayer.setOpacity("0.6");
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
}
function test_99_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");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:256px;height:256px"></div>
</body>
</html>
+74 -74
View File
@@ -1,74 +1,74 @@
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var name = "Vector Layer";
function test_01_Layer_Vector_constructor(t) {
t.plan(3);
var layer = new OpenLayers.Layer.Vector(name);
t.ok(layer instanceof OpenLayers.Layer.Vector, "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_02_Layer_Vector_addFeatures(t) {
t.plan(2);
var layer = new OpenLayers.Layer.Vector(name);
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
var pointFeature = new OpenLayers.Feature.Vector(layer, point);
layer.addFeatures([pointFeature]);
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
t.ok(layer.features[0] == pointFeature, "OpenLayers.Layer.Vector.addFeatures returns an array of features");
}
function test_03_Layer_Vector_removeFeatures(t) {
t.plan(1);
var layer = new OpenLayers.Layer.Vector(name);
var point1 = new OpenLayers.Geometry.Point(-111.04, 45.68);
var pointFeature1 = new OpenLayers.Feature.Vector(layer, point1);
var point2 = new OpenLayers.Geometry.Point(-111.14, 45.78);
var pointFeature2 = new OpenLayers.Feature.Vector(layer, point2);
layer.addFeatures([pointFeature1, pointFeature2]);
var features = layer.removeFeatures([pointFeature1]);
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
}
function test_Layer_Vector_addsStyle (t) {
t.plan(2);
layer = new OpenLayers.Layer.Vector(name);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
f = new OpenLayers.Feature.Vector();
t.eq( f.style, null, "Feature style is null by default.");
layer.addFeatures(f);
t.ok( f.style != null, "Feature style is set by layer.");
}
function test_99_Layer_Vector_destroy (t) {
t.plan(1);
layer = new OpenLayers.Layer.Vector(name);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
layer.destroy();
t.eq(layer.map, null, "layer.map is null after destroy");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var name = "Vector Layer";
function test_01_Layer_Vector_constructor(t) {
t.plan(3);
var layer = new OpenLayers.Layer.Vector(name);
t.ok(layer instanceof OpenLayers.Layer.Vector, "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_02_Layer_Vector_addFeatures(t) {
t.plan(2);
var layer = new OpenLayers.Layer.Vector(name);
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
var pointFeature = new OpenLayers.Feature.Vector(layer, point);
layer.addFeatures([pointFeature]);
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
t.ok(layer.features[0] == pointFeature, "OpenLayers.Layer.Vector.addFeatures returns an array of features");
}
function test_03_Layer_Vector_removeFeatures(t) {
t.plan(1);
var layer = new OpenLayers.Layer.Vector(name);
var point1 = new OpenLayers.Geometry.Point(-111.04, 45.68);
var pointFeature1 = new OpenLayers.Feature.Vector(layer, point1);
var point2 = new OpenLayers.Geometry.Point(-111.14, 45.78);
var pointFeature2 = new OpenLayers.Feature.Vector(layer, point2);
layer.addFeatures([pointFeature1, pointFeature2]);
var features = layer.removeFeatures([pointFeature1]);
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
}
function test_Layer_Vector_addsStyle (t) {
t.plan(2);
layer = new OpenLayers.Layer.Vector(name);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
f = new OpenLayers.Feature.Vector();
t.eq( f.style, null, "Feature style is null by default.");
layer.addFeatures(f);
t.ok( f.style != null, "Feature style is set by layer.");
}
function test_99_Layer_Vector_destroy (t) {
t.plan(1);
layer = new OpenLayers.Layer.Vector(name);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
layer.destroy();
t.eq(layer.map, null, "layer.map is null after destroy");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>
+21 -21
View File
@@ -1,21 +1,21 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
function test_01_Format_constructor(t) {
t.plan(4);
var options = {'foo': 'bar'};
var format = new OpenLayers.Format(options);
t.ok(format instanceof OpenLayers.Format,
"new OpenLayers.Format returns object" );
t.eq(format.foo, "bar", "constructor sets options correctly");
t.eq(typeof format.read, "function", "format has a read function");
t.eq(typeof format.write, "function", "format has a write function");
}
// -->
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
function test_01_Format_constructor(t) {
t.plan(4);
var options = {'foo': 'bar'};
var format = new OpenLayers.Format(options);
t.ok(format instanceof OpenLayers.Format,
"new OpenLayers.Format returns object" );
t.eq(format.foo, "bar", "constructor sets options correctly");
t.eq(typeof format.read, "function", "format has a read function");
t.eq(typeof format.write, "function", "format has a write function");
}
// -->
</script>
</head>
<body>
</body>
</html>
+212 -212
View File
@@ -1,212 +1,212 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var map;
function test_01_Geometry_constructor (t) {
t.plan( 2 );
var g = new OpenLayers.Geometry();
t.eq(g.CLASS_NAME, "OpenLayers.Geometry", "correct CLASS_NAME")
t.ok(g.id.startsWith("OpenLayers.Geometry_"), "id correctly set");
}
function test_02_Geometry_setBounds(t) {
t.plan( 2 );
var g = new OpenLayers.Geometry();
//null object
g.setBounds(null);
t.ok(g.bounds == null, "setbounds with null value does not crash or set bounds");
//no classname object
g_clone = {};
var object = {
'clone': function() { return g_clone; }
};
g.setBounds(object);
t.ok(g.bounds == g_clone, "setbounds with valid object sets bounds, calls clone");
}
function test_03_Geometry_extendBounds(t) {
t.plan(9);
OpenLayers.Bounds.prototype._extend =
OpenLayers.Bounds.prototype.extend;
OpenLayers.Bounds.prototype.extend = function(b) {
g_extendBounds = b;
};
var g = new OpenLayers.Geometry();
//this.bounds null (calculateBounds(), setBounds() called)
g.setBounds = function(b) { g_setBounds = b; };
g.calculateBounds = function() { g_calculateBounds = {}; };
var object = {};
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
t.ok(g_setBounds == object, "setBounds() called when this.bounds is null and calculateBounds() is null too");
t.ok(g_extendBounds != object, "this.bounds.extend() not called when this.bounds is null and calculateBounds() is null too");
//this.bounds null (calculateBounds() sets this.bounds:
// - setBounds() not called
// - this.bounds.extend() called
g_calcBounds = new OpenLayers.Bounds(1,2,3,4);
g.calculateBounds = function() {
g_calculateBounds = {};
this.bounds = g_calcBounds;
};
var object = {};
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is null and calculateBounds() sets this.bounds");
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is null and calculateBounds() sets this.bounds");
//this.bounds non-null thus extend()
// - setBounds() not called
// - this.bounds.extend() called
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds == null, "calculateBounds() not called when this.bounds is non null");
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is nonnull");
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is non-null");
OpenLayers.Bounds.prototype.extend =
OpenLayers.Bounds.prototype._extend;
}
function test_04_Geometry_getBounds(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
var testBounds = new OpenLayers.Bounds(1,2,3,4);
g.bounds = testBounds.clone();
t.ok(g.getBounds().equals(testBounds), "getBounds works");
}
function test_05_Geometry_atPoint(t) {
t.plan(6);
var g = new OpenLayers.Geometry();
var lonlat = null;
var lon = 5;
var lat = 10;
//null lonlat
g.bounds = new OpenLayers.Bounds();
var atPoint = g.atPoint(lonlat, lon, lat);
t.ok(!atPoint, "null lonlat")
//null this.bounds
g.bounds = null;
lonlat = new OpenLayers.LonLat(1,2);
atPoint = g.atPoint(lonlat, lon, lat);
t.ok(!atPoint, "null this.bounds")
//toleranceLon/toleranceLat
//default toleranceLon/toleranceLat
OpenLayers.Bounds.prototype._containsLonLat = OpenLayers.Bounds.prototype.containsLonLat;
g_Return = {};
OpenLayers.Bounds.prototype.containsLonLat = function(ll) {
g_bounds = this;
return g_Return;
}
var testBounds = new OpenLayers.Bounds(10,20,30,40);
g.bounds = testBounds.clone();
lonlat = new OpenLayers.LonLat(20,30);
g_bounds = null;
atPoint = g.atPoint(lonlat);
t.ok(g_bounds.equals(testBounds), "default toleranceLon/Lat are 0");
t.ok(atPoint == g_Return, "default toleranceLon/Lat returns correctly");
//real toleranceLon/toleranceLat
var testBounds = new OpenLayers.Bounds(10,20,30,40);
g.bounds = testBounds.clone();
lonlat = new OpenLayers.LonLat(20,30);
g_bounds = null;
atPoint = g.atPoint(lonlat, lon, lat);
testBounds.left -= lon;
testBounds.bottom -= lat;
testBounds.right += lon;
testBounds.top += lat;
t.ok(g_bounds.equals(testBounds), "real toleranceLon/Lat are 0");
t.ok(atPoint == g_Return, "real toleranceLon/Lat returns correctly");
OpenLayers.Bounds.prototype.containsLonLat = OpenLayers.Bounds.prototype._containsLonLat;
}
function test_06_Geometry_getLength(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
t.eq(g.getLength(), 0, "getLength is 0");
}
function test_07_Geometry_getArea(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
t.eq(g.getArea(), 0, "getArea is 0");
}
function test_99_Geometry_destroy(t) {
t.plan( 5 );
var g = new OpenLayers.Geometry();
g.bounds = new OpenLayers.Bounds();
g.feature = new Object();
g.events = {
'destroy': function() {
g_events_destroy = {};
}
};
g_style_destroy = null;
g_events_destroy = {};
g.destroy();
t.eq(g.id, null, "id nullified");
t.eq(g.bounds, null, "bounds nullified");
t.eq(g.feature, null, "feature reference nullified");
t.ok(g_events_destroy != null, "events.destroy() called on non-null events");
t.eq(g.events, null, "events nullified");
}
// -->
</script>
</head>
<body>
<div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var map;
function test_01_Geometry_constructor (t) {
t.plan( 2 );
var g = new OpenLayers.Geometry();
t.eq(g.CLASS_NAME, "OpenLayers.Geometry", "correct CLASS_NAME")
t.ok(g.id.startsWith("OpenLayers.Geometry_"), "id correctly set");
}
function test_02_Geometry_setBounds(t) {
t.plan( 2 );
var g = new OpenLayers.Geometry();
//null object
g.setBounds(null);
t.ok(g.bounds == null, "setbounds with null value does not crash or set bounds");
//no classname object
g_clone = {};
var object = {
'clone': function() { return g_clone; }
};
g.setBounds(object);
t.ok(g.bounds == g_clone, "setbounds with valid object sets bounds, calls clone");
}
function test_03_Geometry_extendBounds(t) {
t.plan(9);
OpenLayers.Bounds.prototype._extend =
OpenLayers.Bounds.prototype.extend;
OpenLayers.Bounds.prototype.extend = function(b) {
g_extendBounds = b;
};
var g = new OpenLayers.Geometry();
//this.bounds null (calculateBounds(), setBounds() called)
g.setBounds = function(b) { g_setBounds = b; };
g.calculateBounds = function() { g_calculateBounds = {}; };
var object = {};
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
t.ok(g_setBounds == object, "setBounds() called when this.bounds is null and calculateBounds() is null too");
t.ok(g_extendBounds != object, "this.bounds.extend() not called when this.bounds is null and calculateBounds() is null too");
//this.bounds null (calculateBounds() sets this.bounds:
// - setBounds() not called
// - this.bounds.extend() called
g_calcBounds = new OpenLayers.Bounds(1,2,3,4);
g.calculateBounds = function() {
g_calculateBounds = {};
this.bounds = g_calcBounds;
};
var object = {};
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is null and calculateBounds() sets this.bounds");
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is null and calculateBounds() sets this.bounds");
//this.bounds non-null thus extend()
// - setBounds() not called
// - this.bounds.extend() called
g_setBounds = null;
g_calculateBounds = null;
g_extendBounds = null;
g.extendBounds(object);
t.ok(g_calculateBounds == null, "calculateBounds() not called when this.bounds is non null");
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is nonnull");
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is non-null");
OpenLayers.Bounds.prototype.extend =
OpenLayers.Bounds.prototype._extend;
}
function test_04_Geometry_getBounds(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
var testBounds = new OpenLayers.Bounds(1,2,3,4);
g.bounds = testBounds.clone();
t.ok(g.getBounds().equals(testBounds), "getBounds works");
}
function test_05_Geometry_atPoint(t) {
t.plan(6);
var g = new OpenLayers.Geometry();
var lonlat = null;
var lon = 5;
var lat = 10;
//null lonlat
g.bounds = new OpenLayers.Bounds();
var atPoint = g.atPoint(lonlat, lon, lat);
t.ok(!atPoint, "null lonlat")
//null this.bounds
g.bounds = null;
lonlat = new OpenLayers.LonLat(1,2);
atPoint = g.atPoint(lonlat, lon, lat);
t.ok(!atPoint, "null this.bounds")
//toleranceLon/toleranceLat
//default toleranceLon/toleranceLat
OpenLayers.Bounds.prototype._containsLonLat = OpenLayers.Bounds.prototype.containsLonLat;
g_Return = {};
OpenLayers.Bounds.prototype.containsLonLat = function(ll) {
g_bounds = this;
return g_Return;
}
var testBounds = new OpenLayers.Bounds(10,20,30,40);
g.bounds = testBounds.clone();
lonlat = new OpenLayers.LonLat(20,30);
g_bounds = null;
atPoint = g.atPoint(lonlat);
t.ok(g_bounds.equals(testBounds), "default toleranceLon/Lat are 0");
t.ok(atPoint == g_Return, "default toleranceLon/Lat returns correctly");
//real toleranceLon/toleranceLat
var testBounds = new OpenLayers.Bounds(10,20,30,40);
g.bounds = testBounds.clone();
lonlat = new OpenLayers.LonLat(20,30);
g_bounds = null;
atPoint = g.atPoint(lonlat, lon, lat);
testBounds.left -= lon;
testBounds.bottom -= lat;
testBounds.right += lon;
testBounds.top += lat;
t.ok(g_bounds.equals(testBounds), "real toleranceLon/Lat are 0");
t.ok(atPoint == g_Return, "real toleranceLon/Lat returns correctly");
OpenLayers.Bounds.prototype.containsLonLat = OpenLayers.Bounds.prototype._containsLonLat;
}
function test_06_Geometry_getLength(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
t.eq(g.getLength(), 0, "getLength is 0");
}
function test_07_Geometry_getArea(t) {
t.plan(1);
var g = new OpenLayers.Geometry();
t.eq(g.getArea(), 0, "getArea is 0");
}
function test_99_Geometry_destroy(t) {
t.plan( 5 );
var g = new OpenLayers.Geometry();
g.bounds = new OpenLayers.Bounds();
g.feature = new Object();
g.events = {
'destroy': function() {
g_events_destroy = {};
}
};
g_style_destroy = null;
g_events_destroy = {};
g.destroy();
t.eq(g.id, null, "id nullified");
t.eq(g.bounds, null, "bounds nullified");
t.eq(g.feature, null, "feature reference nullified");
t.ok(g_events_destroy != null, "events.destroy() called on non-null events");
t.eq(g.events, null, "events nullified");
}
// -->
</script>
</head>
<body>
<div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>
+166 -166
View File
@@ -1,166 +1,166 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var layer;
function test_01_Renderer_drawGeometry(t) {
t.plan(1);
var r = new OpenLayers.Renderer();
t.ok( r instanceof OpenLayers.Renderer, "new OpenLayers.Renderer returns REnderer object" );
}
/*
function test_01_Renderer_drawGeometry(t) {
t.plan(12);
var r = new OpenLayers.Renderer();
r.root = document.body;
r.setStyle = function() {};
var geometry = null;
var style = null;
r.drawGeometry(geometry, style);
t.ok(true, "didnt do anything on null style");
// point
var properDraw = false;
r.drawPoint = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Point'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPoint when passed a point");
// curve
var properDraw = false;
r.drawCurve = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Curve'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawCurve when passed a curve");
// line segment
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineSegment'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a line segment");
// line string
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineString'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a line string");
// linear ring
var properDraw = false;
r.drawLinearRing = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LinearRing'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLinearRing when passed a linear ring");
// polygon
var properDraw = false;
r.drawPolygon = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Polygon'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPolygon when passed a polygon");
// surface
var properDraw = false;
r.drawSurface = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Surface'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawSurface when passed a surface");
// rectangle
var properDraw = false;
r.drawRectangle = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Rectangle'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawRectangle when passed a rectangle");
// multi-point
var properDraw = false;
r.drawPoint = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiPoint',
components: [{CLASS_NAME: 'OpenLayers.Geometry.Point'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPoint when passed a multi-point");
// multi-linestring
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiLineString',
components: [{CLASS_NAME: 'OpenLayers.Geometry.LineString'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a multi-linestring");
// multi-polygon
var properDraw = false;
r.drawPolygon = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiPolygon',
components: [{CLASS_NAME: 'OpenLayers.Geometry.Polygon'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPolygon when passed a multi-polygon");
}
*/
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var layer;
function test_01_Renderer_drawGeometry(t) {
t.plan(1);
var r = new OpenLayers.Renderer();
t.ok( r instanceof OpenLayers.Renderer, "new OpenLayers.Renderer returns REnderer object" );
}
/*
function test_01_Renderer_drawGeometry(t) {
t.plan(12);
var r = new OpenLayers.Renderer();
r.root = document.body;
r.setStyle = function() {};
var geometry = null;
var style = null;
r.drawGeometry(geometry, style);
t.ok(true, "didnt do anything on null style");
// point
var properDraw = false;
r.drawPoint = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Point'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPoint when passed a point");
// curve
var properDraw = false;
r.drawCurve = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Curve'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawCurve when passed a curve");
// line segment
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineSegment'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a line segment");
// line string
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineString'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a line string");
// linear ring
var properDraw = false;
r.drawLinearRing = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LinearRing'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLinearRing when passed a linear ring");
// polygon
var properDraw = false;
r.drawPolygon = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Polygon'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPolygon when passed a polygon");
// surface
var properDraw = false;
r.drawSurface = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Surface'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawSurface when passed a surface");
// rectangle
var properDraw = false;
r.drawRectangle = function(g) {
properDraw = true;
return {};
}
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Rectangle'};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawRectangle when passed a rectangle");
// multi-point
var properDraw = false;
r.drawPoint = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiPoint',
components: [{CLASS_NAME: 'OpenLayers.Geometry.Point'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPoint when passed a multi-point");
// multi-linestring
var properDraw = false;
r.drawLineString = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiLineString',
components: [{CLASS_NAME: 'OpenLayers.Geometry.LineString'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawLineString when passed a multi-linestring");
// multi-polygon
var properDraw = false;
r.drawPolygon = function(g) {
properDraw = true;
return {};
}
geometry = {
CLASS_NAME: 'OpenLayers.Geometry.MultiPolygon',
components: [{CLASS_NAME: 'OpenLayers.Geometry.Polygon'}]
};
style = true;
r.drawGeometry(geometry, style);
t.ok(properDraw, "drawGeometry called drawPolygon when passed a multi-polygon");
}
*/
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>