Merge branch 'master' of github.com:openlayers/openlayers into transform
Conflicts: theme/default/style.css
This commit is contained in:
@@ -4,9 +4,6 @@
|
||||
<script type="text/javascript">window.alert = oldAlert;</script>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script type="text/javascript">
|
||||
// turn off animation frame handling, so we can check img urls in tests
|
||||
delete OpenLayers.Layer.Grid.prototype.queueTileDraw;
|
||||
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
|
||||
|
||||
@@ -187,7 +187,9 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Check our utility function for generating tile indexes against a file cache
|
||||
* Check the utility function for generating tile indexes against a file cache
|
||||
* This is already tested in BaseTypes test, but these are specific,
|
||||
* common conversions that this class will rely on, so the tests are retained
|
||||
*/
|
||||
function test_Layer_ARCGISCACHE_zeroPad(t) {
|
||||
t.plan(4);
|
||||
@@ -195,10 +197,10 @@
|
||||
var layer = new OpenLayers.Layer.ArcGISCache('test', null, { });
|
||||
|
||||
//some tile examples
|
||||
t.ok('00000001' == layer.zeroPad(1, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00000020' == layer.zeroPad(32, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00000100' == layer.zeroPad(256, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00001000' == layer.zeroPad(4096, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00000001' == OpenLayers.Number.zeroPad(1, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00000020' == OpenLayers.Number.zeroPad(32, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00000100' == OpenLayers.Number.zeroPad(256, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
t.ok('00001000' == OpenLayers.Number.zeroPad(4096, 8, 16), 'zeroPad should generate tile indexes properly ');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-20
@@ -1,19 +1,5 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
/**
|
||||
* Because browsers that implement requestAnimationFrame may not execute
|
||||
* animation functions while a window is not displayed (e.g. in a hidden
|
||||
* iframe as in these tests), we mask the native implementations here. The
|
||||
* native requestAnimationFrame functionality is tested in Util.html and
|
||||
* in PanZoom.html (where a popup is opened before panning).
|
||||
*/
|
||||
window.requestAnimationFrame =
|
||||
window.webkitRequestAnimationFrame =
|
||||
window.mozRequestAnimationFrame =
|
||||
window.oRequestAnimationFrame =
|
||||
window.msRequestAnimationFrame = null;
|
||||
</script>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script type="text/javascript">
|
||||
var map, layer;
|
||||
@@ -108,10 +94,9 @@
|
||||
isBaseLayer: false
|
||||
}, options));
|
||||
map.addLayer(layer);
|
||||
var tile = layer.tileQueue[0];
|
||||
|
||||
t.delay_call(5, function() {
|
||||
t.ok(tile.url, "Tile not empty");
|
||||
t.ok(layer.grid[0][0].url, "Tile not empty");
|
||||
map.destroy();
|
||||
});
|
||||
}
|
||||
@@ -186,12 +171,11 @@
|
||||
layer = new OpenLayers.Layer.Bing(options);
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
var tile = layer.tileQueue[0];
|
||||
|
||||
t.delay_call(5, function() {
|
||||
t.ok(OpenLayers.Util.indexOf(layer.attribution, '<img src="//') != -1, "Attribution contains a logo with protocol //");
|
||||
t.ok(OpenLayers.Util.indexOf(layer.attribution, '<img src="http://') == -1, "Attribution logo does not have http:// protocol");
|
||||
t.ok(tile.url.indexOf('http:') == -1, "Tile url does not contain http:");
|
||||
t.ok(layer.grid[1][1].url.indexOf('http:') == -1, "Tile url does not contain http:");
|
||||
|
||||
map.destroy();
|
||||
});
|
||||
@@ -200,11 +184,10 @@
|
||||
layer_https = new OpenLayers.Layer.Bing(OpenLayers.Util.applyDefaults({protocol: 'https:'}, options));
|
||||
map2.addLayer(layer_https);
|
||||
map2.zoomToMaxExtent();
|
||||
var tile = layer_https.tileQueue[0];
|
||||
|
||||
t.delay_call(5, function() {
|
||||
t.ok(OpenLayers.Util.indexOf(layer_https.attribution, '<img src="https://') != -1, "Attribution logo has https:// protocol");
|
||||
t.ok(tile.url.indexOf('https:') == 0, "Tile url contains https:");
|
||||
t.ok(layer_https.grid[1][1].url.indexOf('https:') == 0, "Tile url contains https:");
|
||||
map2.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
+60
-52
@@ -2,9 +2,6 @@
|
||||
<head>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script type="text/javascript">
|
||||
// turn off animation frame handling, so we can check img urls in tests
|
||||
var origQueueTileDraw = OpenLayers.Layer.Grid.prototype.queueTileDraw;
|
||||
delete OpenLayers.Layer.Grid.prototype.queueTileDraw;
|
||||
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
@@ -99,26 +96,6 @@
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_queueTileDraw(t) {
|
||||
t.plan(3);
|
||||
OpenLayers.Layer.Grid.prototype.queueTileDraw = origQueueTileDraw;
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS(name, url, params);
|
||||
map.addLayer(layer);
|
||||
map.setCenter([0, 0], 3);
|
||||
var queued = layer.tileQueue.length;
|
||||
t.ok(layer.tileQueue.length, "Tiles queued for drawing");
|
||||
map.zoomIn();
|
||||
t.eq(layer.tileQueue.length, queued, "Tile queue has same length after immediate zoom change");
|
||||
t.delay_call(1, function() {
|
||||
t.eq(layer.tileQueue.length, 0, "Tiles from queue processed");
|
||||
});
|
||||
|
||||
map.destroy();
|
||||
delete OpenLayers.Layer.Grid.prototype.queueTileDraw;
|
||||
}
|
||||
|
||||
function test_Layer_Grid_clearTiles (t) {
|
||||
t.plan(4);
|
||||
|
||||
@@ -257,10 +234,7 @@
|
||||
|
||||
function test_Layer_Grid_moveTo(t) {
|
||||
|
||||
t.plan(17);
|
||||
|
||||
var origIsNative = OpenLayers.Animation.isNative;
|
||||
OpenLayers.Animation.isNative = false;
|
||||
t.plan(13);
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS(name, url, params);
|
||||
@@ -270,23 +244,6 @@
|
||||
map.setCenter([-10, 0], 5);
|
||||
|
||||
var log = [];
|
||||
var origDeferMoveGriddedTiles = layer.deferMoveGriddedTiles;
|
||||
layer.deferMoveGriddedTiles = function() {
|
||||
log.push("deferMoveGriddedTiles");
|
||||
origDeferMoveGriddedTiles.apply(this, arguments);
|
||||
};
|
||||
layer.moveGriddedTiles = function() {
|
||||
log.push("moveGriddedTiles");
|
||||
OpenLayers.Layer.WMS.prototype.moveGriddedTiles.apply(this, arguments);
|
||||
};
|
||||
map.moveTo([5, 0]);
|
||||
t.eq(log[0], "moveGriddedTiles", "deferred after moveTo");
|
||||
map.moveTo([0, 0]);
|
||||
t.eq(log[1], "moveGriddedTiles", "deferred again after another moveTo");
|
||||
t.eq(log.length, 2, "no tiles loaded yet");
|
||||
t.delay_call(1, function() {
|
||||
t.eq(log[2], "deferMoveGriddedTiles", "tiles moved after tileLoadingDelay");
|
||||
});
|
||||
|
||||
//make sure null bounds doesnt cause script error.
|
||||
// no test necessary, just action
|
||||
@@ -308,9 +265,6 @@
|
||||
g_WhichFunc = "MoveGridded";
|
||||
g_Bounds = layer.map.getExtent();
|
||||
};
|
||||
layer.deferMoveGriddedTiles = function() {
|
||||
g_WhichFunc = "DeferMoveGridded";
|
||||
}
|
||||
var clearTestBounds = function() {
|
||||
g_WhichFunc = null;
|
||||
g_Bounds = null;
|
||||
@@ -417,8 +371,6 @@
|
||||
layer.moveTo(null, zoomChanged);
|
||||
t.ok(g_WhichFunc == "InitGridded", "if tiles drastically out of bounds, we call initGriddedTile()");
|
||||
t.ok(g_Bounds.equals(b), "if tiles drastically out of bounds, we call initGriddedTile() with correct bounds");
|
||||
|
||||
OpenLayers.Animation.isNative = origIsNative;
|
||||
}
|
||||
|
||||
/** THIS WOULD BE WHERE THE TESTS WOULD GO FOR
|
||||
@@ -437,7 +389,7 @@
|
||||
*/
|
||||
|
||||
function test_Layer_Grid_clone(t) {
|
||||
t.plan(7);
|
||||
t.plan(6);
|
||||
|
||||
var options = {tileSize: new OpenLayers.Size(500,50)};
|
||||
var map = new OpenLayers.Map('map', options);
|
||||
@@ -452,7 +404,6 @@
|
||||
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
||||
t.ok( clone.grid.length == 0, "clone creates a new array instead");
|
||||
|
||||
t.ok(clone.tileQueue !== layer.tileQueue, "new tileQueue for clone");
|
||||
t.eq(clone.backBuffer, null, "no backbuffer from original");
|
||||
|
||||
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
|
||||
@@ -574,7 +525,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
imgDiv: {className: ''}
|
||||
}
|
||||
|
||||
g_registered = {};
|
||||
@@ -1146,6 +1098,36 @@
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_backbuffer_replace(t) {
|
||||
t.plan(6);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('', '../../img/blank.gif');
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
t.delay_call(1, function() {
|
||||
layer.mergeNewParams({foo: 'bar'});
|
||||
var tile = layer.grid[1][1];
|
||||
t.ok(OpenLayers.Element.hasClass(tile.imgDiv, 'olTileReplacing'), 'tile is marked for being replaced');
|
||||
t.ok(document.getElementById(tile.id + '_bb'), 'backbuffer created for tile');
|
||||
// simulate a css declaration where '.olTileReplacing' sets display
|
||||
// to none.
|
||||
tile.imgDiv.style.display = 'none';
|
||||
tile.onImageLoad();
|
||||
t.ok(!OpenLayers.Element.hasClass(tile.imgDiv, 'olTileReplacing'), 'tile replaced, no longer marked');
|
||||
t.ok(!document.getElementById(tile.id + '_bb'), 'backbuffer removed for tile');
|
||||
|
||||
layer.mergeNewParams({foo: 'baz'});
|
||||
tile = layer.grid[1][1];
|
||||
// simulate a css declaration where '.olTileReplacing' does not set
|
||||
// display to none.
|
||||
tile.imgDiv.style.display = 'block';
|
||||
tile.onImageLoad();
|
||||
t.ok(!OpenLayers.Element.hasClass(tile.imgDiv, 'olTileReplacing'), 'tile replaced, no longer marked');
|
||||
t.ok(document.getElementById(tile.id + '_bb'), 'backbuffer not removed for visible tile');
|
||||
});
|
||||
}
|
||||
|
||||
function test_singleTile_move_and_zoom(t) {
|
||||
|
||||
@@ -1475,6 +1457,32 @@
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_addOptions(t) {
|
||||
t.plan(15);
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS(name, url, params, {buffer:2});
|
||||
map.addLayer(layer);
|
||||
t.eq(layer.tileSize, map.getTileSize(), "layer's tile size is equal to the map's tile size");
|
||||
t.ok(layer.removeBackBufferDelay !== 0, "removeBackBufferDelay should not be 0 since we are not singleTile");
|
||||
t.eq(layer.className, "olLayerGrid", "className correct for gridded mode");
|
||||
map.setCenter(new OpenLayers.LonLat(0,0),5);
|
||||
t.eq(layer.grid.length, 8, "Grid rows is correct.");
|
||||
t.eq(layer.grid[0].length, 7, "Grid cols is correct.");
|
||||
t.eq(layer.singleTile, false, "singleTile is false by default");
|
||||
layer.addOptions({singleTile: true});
|
||||
t.eq(layer.removeBackBufferDelay, 0, "removeBackBufferDelay set to 0 since singleTile is true");
|
||||
t.eq(layer.singleTile, true, "singleTile set to true");
|
||||
t.eq(layer.className, "olLayerGridSingleTile", "className correct for singleTile mode");
|
||||
t.eq(layer.grid.length, 1, "Grid rows is correct.");
|
||||
t.eq(layer.grid[0].length, 1, "Grid cols is correct.");
|
||||
t.eq(layer.tileSize, new OpenLayers.Size(748, 823), "tile size changed");
|
||||
layer.addOptions({singleTile: false});
|
||||
t.eq(layer.grid.length, 8, "Grid rows is correct.");
|
||||
t.eq(layer.grid[0].length, 7, "Grid cols is correct.");
|
||||
t.eq(layer.tileSize, map.getTileSize(), "layer's tile size is equal to the map's tile size");
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -555,9 +555,6 @@
|
||||
}
|
||||
|
||||
function test_tileBounds(t) {
|
||||
// do not defer moveGriddedTiles
|
||||
var isNative = OpenLayers.Animation.isNative;
|
||||
OpenLayers.Animation.isNative = true;
|
||||
t.plan(3);
|
||||
|
||||
var map = new OpenLayers.Map("map", {projection: "EPSG:3857"});
|
||||
@@ -575,7 +572,6 @@
|
||||
t.eq(bounds.right, 0, "0 is 0, and not some super small number");
|
||||
|
||||
map.destroy();
|
||||
OpenLayers.Animation.isNative = isNative;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user