New OpenLayers.Tile.Image.getCanvasContext function

This commit is contained in:
fredj
2012-01-18 14:06:22 +01:00
parent 57ae02f381
commit b4ac0af5d8
2 changed files with 57 additions and 0 deletions
+25
View File
@@ -399,6 +399,31 @@
map.destroy();
});
}
function test_getCanvasContext(t) {
if (!OpenLayers.CANVAS_SUPPORTED) {
t.plan(0);
} else {
t.plan(1);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0, 0), 5);
t.delay_call(5, function() {
var tile = layer.grid[0][0];
if (tile.isLoading) {
t.ok(false, "test_getCanvasContext timeout");
} else {
t.ok(tile.getCanvasContext() instanceof CanvasRenderingContext2D,
"getCanvasContext() returns CanvasRenderingContext2D instance");
}
map.destroy();
});
}
}
</script>
</head>