Add clone methods to Tile and Tile.Image, and add associated tests. r=crschmidt (closes #1296)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5854 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -31,6 +31,32 @@
|
||||
t.ok( tile.events != null, "tile's events intitialized");
|
||||
}
|
||||
|
||||
function test_02_Tile_clone (t) {
|
||||
t.plan( 10 );
|
||||
|
||||
var layer = {}; // bogus layer
|
||||
var position = new OpenLayers.Pixel(10,20);
|
||||
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
var url = "bobob";
|
||||
var size = new OpenLayers.Size(5,6);
|
||||
|
||||
tile = new OpenLayers.Tile(layer, position, bounds, url, size);
|
||||
var clone = tile.clone();
|
||||
|
||||
t.ok( clone instanceof OpenLayers.Tile, "OpenLayers.Tile.clone returns Tile object" );
|
||||
t.eq( clone.layer, layer, "clone.layer set correctly");
|
||||
t.ok( clone.position.equals(position), "clone.position set correctly");
|
||||
t.ok( clone.bounds.equals(bounds), "clone.bounds set correctly");
|
||||
t.eq( clone.url, url, "clone.url set correctly");
|
||||
t.ok( clone.size.equals(size), "clone.size is set correctly" );
|
||||
|
||||
t.ok( clone.id != null, "clone is given an id");
|
||||
t.ok( clone.id != tile.id, "clone is given a new id");
|
||||
t.ok(OpenLayers.String.startsWith(clone.id, "Tile_"),
|
||||
"clone's id starts correctly");
|
||||
t.ok( clone.events != null, "clone's events intitialized");
|
||||
}
|
||||
|
||||
function test_99_Tile_destroy(t) {
|
||||
t.plan( 6 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user