Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (52 sloc) 2.226 kb
<html>
<head>
<script src="OLLoader.js"></script>
<script type="text/javascript">
var tile;
function test_Tile_constructor (t) {
t.plan( 11 );
var layer = {}; // bogus layer
var position = new OpenLayers.Pixel(10,20);
var bounds = new OpenLayers.Bounds(1,2,3,4);
var size = new OpenLayers.Size(5,6);
tile = new OpenLayers.Tile(layer, position, bounds, size);
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.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_"),
"tile's id starts correctly");
t.ok( tile.events != null, "tile's events intitialized");
}
function test_Tile_destroy(t) {
t.plan( 6 );
var layer = {
SUPPORTED_TRANSITIONS: [],
events: {
unregister: function() {}
}
}; // bogus layer
var position = new OpenLayers.Pixel(10,20);
var bounds = new OpenLayers.Bounds(1,2,3,4);
var size = new OpenLayers.Size(5,6);
tile = new OpenLayers.Tile(layer, position, bounds, size);
tile.events.destroy = function() {
t.ok(true, "tile events destroy() called");
};
tile.destroy();
t.ok(tile.layer == null, "tile.layer set to null");
t.ok(tile.bounds == null, "tile.bounds set to null");
t.ok(tile.size == null, "tile.size set to null");
t.ok(tile.position == null, "tile.position set to null");
t.ok(tile.events == null, "tile.events set to null");
}
</script>
</head>
<body>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.