From d7f013ddbd71525e850c81dc17207faf6bd65828 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 16 Jan 2013 16:26:51 +0100 Subject: [PATCH] when cloning a layer that is loading, make sure numLoadingTiles is reset to 0 on the clone --- lib/OpenLayers/Layer/Grid.js | 1 + tests/Layer/Grid.html | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index b1b96031cd..96a5f8f394 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -428,6 +428,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { obj.backBuffer = null; obj.backBufferTimerId = null; obj.loading = false; + obj.numLoadingTiles = 0; return obj; }, diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index 97a191f96b..4296aba64a 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -390,7 +390,7 @@ */ function test_Layer_Grid_clone(t) { - t.plan(6); + t.plan(7); var options = {tileSize: new OpenLayers.Size(500,50)}; var map = new OpenLayers.Map('map', options); @@ -400,8 +400,10 @@ layer.grid = [ [6, 7], [8, 9]]; + // if we clone when tiles are still loading, this should not influence the clone + layer.numLoadingTiles = 1; var clone = layer.clone(); - + t.eq( clone.numLoadingTiles, 0, "numLoadingTiles should be reset"); t.ok( clone.grid != layer.grid, "clone does not copy grid"); t.ok( clone.grid.length == 0, "clone creates a new array instead");