From cca1395fc6a6750bea112f7009fe35a793a996e1 Mon Sep 17 00:00:00 2001 From: bartvde Date: Wed, 16 Jun 2010 14:25:15 +0000 Subject: [PATCH] Geometry.Collection does not call parent destructor, so bounds are not reset, r=fredj (closes #2688) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10405 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Geometry/Collection.js | 1 + tests/Geometry/Collection.html | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Geometry/Collection.js b/lib/OpenLayers/Geometry/Collection.js index 0cce921d94..3780dcb05e 100644 --- a/lib/OpenLayers/Geometry/Collection.js +++ b/lib/OpenLayers/Geometry/Collection.js @@ -63,6 +63,7 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, { destroy: function () { this.components.length = 0; this.components = null; + OpenLayers.Geometry.prototype.destroy.apply(this, arguments); }, /** diff --git a/tests/Geometry/Collection.html b/tests/Geometry/Collection.html index 4518295fa0..a6364a8adf 100644 --- a/tests/Geometry/Collection.html +++ b/tests/Geometry/Collection.html @@ -252,17 +252,19 @@ } function test_Collection_destroy(t) { - t.plan( 1 ); + t.plan( 3 ); coll = new OpenLayers.Geometry.Collection(); - coll.components = {}; - + coll.addComponents(new OpenLayers.Geometry.Point(0,0)); + coll.addComponents(new OpenLayers.Geometry.Point(10,10)); + coll.getBounds(); coll.destroy(); t.ok(coll.components == null, "components array cleared"); + t.ok(coll.getBounds() == null, "bounds is cleared"); + t.ok(coll.id == null, "id is cleared"); } -