conditionally run Google tests based on protocol and host - print debug statements if key is not valid - this means that tests do not fail with an invalid key

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4060 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-08-27 18:27:23 +00:00
parent e4d857b167
commit b133435e06
3 changed files with 156 additions and 103 deletions

View File

@@ -199,19 +199,29 @@
}
function test_20_Layer_MapServer_Reproject (t) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
layer.isBaseLayer=false;
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
t.eq( tile.bounds.left, -22.5, "left side matches" );
t.eq( tile.bounds.right, -11.25, "top side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
var validkey = (window.location.protocol == "file:") ||
(window.location.host == "localhost") ||
(window.location.host == "openlayers.org");
if(validkey) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
layer.isBaseLayer=false;
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
t.eq( tile.bounds.left, -22.5, "left side matches" );
t.eq( tile.bounds.right, -11.25, "top side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
} else {
t.plan(1);
t.debug_print("can't test google layer from " +
window.location.host);
}
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapServer(name, url, params);