Do not copy by reference size/bounds/position in making a new tile. All tests pass ie6/ff (Closes #1026).

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4579 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-09-28 21:37:05 +00:00
parent eacfa2b88a
commit 1390a0a6f7
2 changed files with 7 additions and 4 deletions

View File

@@ -93,10 +93,10 @@ OpenLayers.Tile = OpenLayers.Class({
*/
initialize: function(layer, position, bounds, url, size) {
this.layer = layer;
this.position = position;
this.bounds = bounds;
this.position = position.clone();
this.bounds = bounds.clone();
this.url = url;
this.size = size;
this.size = size.clone();
//give the tile a unique id based on its BBOX.
this.id = OpenLayers.Util.createUniqueID("Tile_");

View File

@@ -5,7 +5,7 @@
var tile;
function test_01_Tile_constructor (t) {
t.plan( 9 );
t.plan( 12 );
var layer = {}; // bogus layer
var position = new OpenLayers.Pixel(10,20);
@@ -18,9 +18,12 @@
t.ok( tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object" );
t.eq( tile.layer, layer, "tile.layer set correctly");
t.ok( tile.position.equals(position), "tile.position set correctly");
t.ok( tile.position != position, "tile.position set not by reference");
t.ok( tile.bounds.equals(bounds), "tile.bounds set correctly");
t.ok( tile.bounds != bounds, "tile.bounds set not by reference");
t.eq( tile.url, url, "tile.url set correctly");
t.ok( tile.size.equals(size), "tile.size is set correctly" );
t.ok( tile.size != size, "tile.size set not by reference");
t.ok( tile.id != null, "tile is given an id");
t.ok(OpenLayers.String.startsWith(tile.id, "Tile_"),