1
<html xmlns="http://www.w3.org/1999/xhtml">
3
<title>Tiles Loading Acceptance Test</title>
4
<style type="text/css">
19
<script src='http://maps.google.com/maps?file=api&v=2.82&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
20
<script src="../../lib/OpenLayers.js"></script>
21
<script type="text/javascript">
22
// make map available for easy debugging
26
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
27
OpenLayers.Util.onImageLoadErrorColor = "transparent";
32
projection: "EPSG:900913",
34
maxResolution: 156543.0339,
35
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
36
20037508, 20037508.34)
38
map = new OpenLayers.Map('map', options);
39
// create Google Mercator layers
40
var gmap = new OpenLayers.Layer.Google(
42
{'sphericalMercator': true}
45
var wmsMaxResolution = 78271.51695;
46
var wms = new OpenLayers.Layer.WMS(
48
"http://world.freemap.in/tiles/",
49
{'layers': 'factbook-overlay', 'format':'png'},
55
'maxResolution' : wmsMaxResolution
58
map.addLayers([gmap, wms]);
59
map.addControl(new OpenLayers.Control.Navigation());
60
map.addControl(new OpenLayers.Control.LayerSwitcher());
61
map.addControl(new OpenLayers.Control.PanZoomBar());
63
function onLayerChanged() {
64
var html = '<p>WMS Layer state - in range: '
69
document.getElementById('layerstate').innerHTML = html;
71
map.events.register('changelayer', wms, onLayerChanged);
73
function onTileLoaded() {
74
var html = '<p>Message: ';
75
if (this.numLoadingTiles > 0) {
76
html += 'Loading tiles...';
78
html += 'Done loading tiles';
81
document.getElementById('tilesloading').innerHTML = html;
83
wms.events.register('tileloaded', wms, onTileLoaded);
89
<body onload="init()">
93
<b>Test 0</b> : at the initial zoom the WMS layer is in range, you should
94
therefore see the 'Loading tiles...' message when loading the page for
100
<b>Test 1</b> : If you zoom out by one level (using the zoombar), the WMS
101
layer becomes out of range. No tile should be loaded so you shouldn't see
102
the 'Loading tiles...' message.
107
<b>Test 2</b> : Zoom in by one level to go back to initial state (the WMS
108
is back). Open the layer switcher and turn off the WMS layer. No tile
109
should be loaded so you shouldn't see the 'Loading tiles...' message.
114
<b>Test 3</b> : Keep the WMS layer turned off in the layer switcher. Zoom
115
out by one level again. The layer is both invisible and out of range, so
116
you shouldn't see the 'Loading tiles...' message.
119
<div id="layerstate"><p>WMS Layer state - in range: true, visibility: true</p></div>
120
<div id="tilesloading"><p>Message:</p></div>