Merged with upstream master

This commit is contained in:
Gregers Gram Rygg
2012-05-30 15:31:37 +02:00
47 changed files with 405 additions and 211 deletions

View File

@@ -14,6 +14,23 @@
"olControlOverviewMap", "displayClass is correct" );
}
function test_divs_title(t) {
t.plan(2);
control = new OpenLayers.Control.OverviewMap({
maximizeTitle: "maximize title",
minimizeTitle: "minimize title"
});
map = new OpenLayers.Map('map', {
layers: [new OpenLayers.Layer("layer", {isBaseLayer: true})],
controls: [control]
});
map.zoomToMaxExtent();
t.eq(control.maximizeDiv.title, "maximize title", "maximizeDiv.title is correct");
t.eq(control.minimizeDiv.title, "minimize title", "minimizeDiv.title is correct");
map.destroy();
}
function test_setMap(t) {
t.plan(4);

View File

@@ -236,13 +236,13 @@
var f = new OpenLayers.Format.KML();
t.eq(f.read(f.write(feature))[0].attributes.name, feature.id, "placemark name from feature.id");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
feature.style = {
label: "placemark name from style.label"
};
t.eq(f.read(f.write(feature))[0].attributes.name, feature.style.label, "placemark name from style.label");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
}
function test_Format_KML_linestring_projected(t) {
t.plan(1);

View File

@@ -1523,6 +1523,70 @@
map.destroy();
}
function test_removeExcessTiles(t) {
t.plan(15);
/*
* Set up
*/
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Grid('name', '/url',
{}, {isBaseLayer: true});
map.addLayer(layer);
function newTile(id) {
var t = new OpenLayers.Tile(layer,
new OpenLayers.Pixel(1, 1),
new OpenLayers.Bounds(1, 1, 1, 1));
t._id = id;
return t;
}
layer.grid = [
[newTile(1), newTile(2), newTile(3)],
[newTile(4), newTile(5)],
[newTile(6), newTile(7), newTile(8)]
];
// create a clone to be able to test whether
// tiles have been destroyed or not
var grid = [
layer.grid[0].slice(),
layer.grid[1].slice(),
layer.grid[2].slice()
];
/*
* Test
*/
layer.removeExcessTiles(2, 2);
t.eq(layer.grid.length, 2, 'grid has two rows');
t.eq(layer.grid[0].length, 2, 'row #1 has two columns');
t.eq(layer.grid[0][0]._id, 1, 'row #1 col #1 includes expected tile');
t.eq(layer.grid[0][1]._id, 2, 'row #1 col #2 includes expected tile');
t.eq(layer.grid[1].length, 2, 'row #2 has two columns');
t.eq(layer.grid[1][0]._id, 4, 'row #2 col #1 includes expected tile');
t.eq(layer.grid[1][1]._id, 5, 'row #2 col #2 includes expected tile');
t.ok(grid[0][0].events != null, 'tile 0,0 not destroyed');
t.ok(grid[0][1].events != null, 'tile 0,1 not destroyed');
t.ok(grid[0][2].events == null, 'tile 0,2 destroyed');
t.ok(grid[1][0].events != null, 'tile 1,0 not destroyed');
t.ok(grid[1][1].events != null, 'tile 1,1 not destroyed');
t.ok(grid[2][0].events == null, 'tile 2,0 destroyed');
t.ok(grid[2][1].events == null, 'tile 2,1 destroyed');
t.ok(grid[2][2].events == null, 'tile 2,2 destroyed');
/*
* Tear down
*/
map.destroy();
}
</script>
</head>

View File

@@ -748,7 +748,7 @@
function test_Map_double_addLayer(t) {
t.plan(2);
map = new OpenLayers.Map($('map'));
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS('Test Layer',
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}

View File

@@ -1,10 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script>
var custom$ = function() {};
window.$ = custom$;
</script>
<script>
var OpenLayers = [
"OpenLayers/BaseTypes/Class.js",
@@ -77,11 +73,6 @@
t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works");
}
function test_$(t) {
t.plan(1);
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
}
function test_Util_getImagesLocation (t) {
t.plan( 1 );
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",

View File

@@ -0,0 +1,20 @@
<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>

View File

@@ -231,6 +231,7 @@
<li>Kinetic.html</li>
<li>Util.html</li>
<li>deprecated/Ajax.html</li>
<li>deprecated/Util.html</li>
<li>deprecated/BaseTypes/Class.html</li>
<li>deprecated/BaseTypes/Element.html</li>
<li>deprecated/Control/MouseToolbar.html</li>