3 <script src="../lib/OpenLayers.js"></script>
4 <script type="text/javascript">
7 function test_Tile_constructor (t) {
10 var layer = {}; // bogus layer
11 var position = new OpenLayers.Pixel(10,20);
12 var bounds = new OpenLayers.Bounds(1,2,3,4);
14 var size = new OpenLayers.Size(5,6);
16 tile = new OpenLayers.Tile(layer, position, bounds, url, size);
18 t.ok( tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object" );
19 t.eq( tile.layer, layer, "tile.layer set correctly");
20 t.ok( tile.position.equals(position), "tile.position set correctly");
21 t.ok( tile.position != position, "tile.position set not by reference");
22 t.ok( tile.bounds.equals(bounds), "tile.bounds set correctly");
23 t.ok( tile.bounds != bounds, "tile.bounds set not by reference");
24 t.eq( tile.url, url, "tile.url set correctly");
25 t.ok( tile.size.equals(size), "tile.size is set correctly" );
26 t.ok( tile.size != size, "tile.size set not by reference");
28 t.ok( tile.id != null, "tile is given an id");
29 t.ok(OpenLayers.String.startsWith(tile.id, "Tile_"),
30 "tile's id starts correctly");
31 t.ok( tile.events != null, "tile's events intitialized");
34 function test_Tile_clone (t) {
37 var layer = {}; // bogus layer
38 var position = new OpenLayers.Pixel(10,20);
39 var bounds = new OpenLayers.Bounds(1,2,3,4);
41 var size = new OpenLayers.Size(5,6);
43 tile = new OpenLayers.Tile(layer, position, bounds, url, size);
44 var clone = tile.clone();
46 t.ok( clone instanceof OpenLayers.Tile, "OpenLayers.Tile.clone returns Tile object" );
47 t.eq( clone.layer, layer, "clone.layer set correctly");
48 t.ok( clone.position.equals(position), "clone.position set correctly");
49 t.ok( clone.bounds.equals(bounds), "clone.bounds set correctly");
50 t.eq( clone.url, url, "clone.url set correctly");
51 t.ok( clone.size.equals(size), "clone.size is set correctly" );
53 t.ok( clone.id != null, "clone is given an id");
54 t.ok( clone.id != tile.id, "clone is given a new id");
55 t.ok(OpenLayers.String.startsWith(clone.id, "Tile_"),
56 "clone's id starts correctly");
57 t.ok( clone.events != null, "clone's events intitialized");
60 function test_Tile_destroy(t) {
64 SUPPORTED_TRANSITIONS: [],
66 unregister: function() {}
69 var position = new OpenLayers.Pixel(10,20);
70 var bounds = new OpenLayers.Bounds(1,2,3,4);
72 var size = new OpenLayers.Size(5,6);
74 tile = new OpenLayers.Tile(layer, position, bounds, url, size);
75 tile.events.destroy = function() {
76 t.ok(true, "tile events destroy() called");
82 t.ok(tile.layer == null, "tile.layer set to null");
83 t.ok(tile.bounds == null, "tile.bounds set to null");
84 t.ok(tile.size == null, "tile.size set to null");
85 t.ok(tile.position == null, "tile.position set to null");
87 t.ok(tile.events == null, "tile.events set to null");