making google tests conditional so invalid keys don't fail tests - debug reporting instead
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4249 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -128,42 +128,54 @@
|
|||||||
window.location.host);
|
window.location.host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_Goole_forwardMercator(t){
|
function test_Layer_Goole_forwardMercator(t){
|
||||||
t.plan(2);
|
if(validkey) {
|
||||||
//Just test that the fowardMercator function still exists.
|
t.plan(2);
|
||||||
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
//Just test that the fowardMercator function still exists.
|
||||||
layer.forwardMercator = function(evt) {
|
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
||||||
t.ok( true, "GoogleMercator.forwardMercator was called and executed." );
|
layer.forwardMercator = function(evt) {
|
||||||
return;
|
t.ok(true,
|
||||||
}
|
"GoogleMercator.forwardMercator was called and executed." );
|
||||||
layer.forwardMercator();
|
return;
|
||||||
//Now test the fowardMercator returns the expected LonLat object
|
}
|
||||||
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
layer.forwardMercator();
|
||||||
var lonlat2 = new OpenLayers.LonLat(Math.random(),Math.random());
|
//Now test the fowardMercator returns the expected LonLat object
|
||||||
var result = layer.forwardMercator(lonlat2.lon, lonlat2.lat);
|
var layer = new OpenLayers.Layer.Google('Test Layer', {'sphericalMercator': true});
|
||||||
t.ok( result instanceof OpenLayers.LonLat, "OpenLayers.Google.fowardMercator returns LonLat object" );
|
var lonlat2 = new OpenLayers.LonLat(Math.random(),Math.random());
|
||||||
|
var result = layer.forwardMercator(lonlat2.lon, lonlat2.lat);
|
||||||
}
|
t.ok(result instanceof OpenLayers.LonLat, "OpenLayers.Google.fowardMercator returns LonLat object" );
|
||||||
|
} else {
|
||||||
|
t.plan(0);
|
||||||
|
t.debug_print("Google tests can't be run from " +
|
||||||
|
window.location.host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function test_Layer_Google_overlay(t) {
|
function test_Layer_Google_overlay(t) {
|
||||||
// Test for #849.
|
// Test for #849.
|
||||||
t.plan(1);
|
if(validkey) {
|
||||||
var map = new OpenLayers.Map( 'map' ,
|
t.plan(1);
|
||||||
{ controls: [] , 'numZoomLevels':20});
|
var map = new OpenLayers.Map( 'map' ,
|
||||||
|
{ controls: [] , 'numZoomLevels':20});
|
||||||
var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} );
|
|
||||||
var layer = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS",
|
var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} );
|
||||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic', 'transparent':true},
|
var layer = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS",
|
||||||
{isBaseLayer: false} );
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic', 'transparent':true},
|
||||||
|
{isBaseLayer: false} );
|
||||||
map.addLayers([satellite, layer]);
|
|
||||||
map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5);
|
map.addLayers([satellite, layer]);
|
||||||
map.zoomIn();
|
map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5);
|
||||||
var size = map.getSize();
|
map.zoomIn();
|
||||||
var px = new OpenLayers.Pixel(size.w, size.h);
|
var size = map.getSize();
|
||||||
var br = map.getLonLatFromPixel(px);
|
var px = new OpenLayers.Pixel(size.w, size.h);
|
||||||
t.ok(layer.grid[0][0].bounds.containsLonLat(br), "Bottom right pixel is covered by untiled WMS layer");
|
var br = map.getLonLatFromPixel(px);
|
||||||
|
t.ok(layer.grid[0][0].bounds.containsLonLat(br), "Bottom right pixel is covered by untiled WMS layer");
|
||||||
|
} else {
|
||||||
|
t.plan(0);
|
||||||
|
t.debug_print("Google tests can't be run from " +
|
||||||
|
window.location.host);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user