Clone needs a fresh backBuffer and tileQueue.

This commit is contained in:
ahocevar
2012-03-19 21:09:43 +01:00
parent acd11005b6
commit d31a8da839
2 changed files with 7 additions and 1 deletions

View File

@@ -323,6 +323,9 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
// we do not want to copy reference to grid, so we make a new array
obj.grid = [];
obj.gridResolution = null;
// same for backbuffer and tile queue
obj.backBuffer = null;
obj.tileQueue = [];
return obj;
},

View File

@@ -393,7 +393,7 @@
*/
function test_Layer_Grid_clone(t) {
t.plan(5);
t.plan(7);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
@@ -407,6 +407,9 @@
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");