add MultiMap tests without document.write, because this does not work in IE. We also have to do a try-catch in the first test to avoid tests from failing in WebKit browsers when the api key is incorrect. Non-functional change.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10724 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,38 +4,51 @@
|
|||||||
<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA10072915821139765"></script>
|
<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA10072915821139765"></script>
|
||||||
<script src="../../lib/OpenLayers.js"></script>
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var layer;
|
var doTest = true;
|
||||||
|
|
||||||
function test_Layer_MultiMap_constructor (t) {
|
function test_Layer_MultiMap_constructor (t) {
|
||||||
|
// WebKit browsers fail when the API key is for a different url, so we
|
||||||
|
// do not test in this case.
|
||||||
|
try {
|
||||||
|
var map = new OpenLayers.Map("map");
|
||||||
|
var layer = new OpenLayers.Layer.MultiMap('MultiMap Layer');
|
||||||
|
map.addLayer(layer);
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
doTest = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!doTest) { t.plan(0); return; }
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
var layer = new OpenLayers.Layer.MultiMap('MultiMap Layer');
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
|
||||||
t.ok( layer instanceof OpenLayers.Layer.MultiMap, "new OpenLayers.Layer.MultiMap returns object" );
|
t.ok( layer instanceof OpenLayers.Layer.MultiMap, "new OpenLayers.Layer.MultiMap returns object" );
|
||||||
t.eq( layer.CLASS_NAME, "OpenLayers.Layer.MultiMap", "CLASS_NAME variable set correctly");
|
t.eq( layer.CLASS_NAME, "OpenLayers.Layer.MultiMap", "CLASS_NAME variable set correctly");
|
||||||
|
|
||||||
t.eq( layer.name, "Goog Layer", "layer.name is correct" );
|
t.eq( layer.name, "MultiMap Layer", "layer.name is correct" );
|
||||||
|
|
||||||
t.ok ( layer.mapObject != null, "MultiMap Object correctly loaded");
|
t.ok ( layer.mapObject != null, "MultiMap Object correctly loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_MultiMap_isBaseLayer (t) {
|
function test_Layer_MultiMap_isBaseLayer (t) {
|
||||||
|
if (!doTest) { t.plan(0); return; }
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
var layer = new OpenLayers.Layer.MultiMap('MultiMap Layer');
|
||||||
|
|
||||||
t.ok(layer.isBaseLayer, "a default load of google layer responds as a base layer");
|
t.ok(layer.isBaseLayer, "a default load of multimap layer responds as a base layer");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_MultiMap_Translation_lonlat (t) {
|
function test_Layer_MultiMap_Translation_lonlat (t) {
|
||||||
|
if (!doTest) { t.plan(0); return; }
|
||||||
|
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
var layer = new OpenLayers.Layer.MultiMap('MultiMap Layer');
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
// these two lines specify an appropriate translation.
|
// these two lines specify an appropriate translation.
|
||||||
@@ -56,11 +69,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_MultiMap_Translation_pixel (t) {
|
function test_Layer_MultiMap_Translation_pixel (t) {
|
||||||
|
if (!doTest) { t.plan(0); return; }
|
||||||
|
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
var layer = new OpenLayers.Layer.MultiMap('MultiMap Layer');
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
// these two lines specify an appropriate translation.
|
// these two lines specify an appropriate translation.
|
||||||
@@ -82,6 +96,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function test_Layer_destroy (t) {
|
function test_Layer_destroy (t) {
|
||||||
|
if (!doTest) { t.plan(0); return; }
|
||||||
t.plan( 5 );
|
t.plan( 5 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
<li>Layer/MapGuide.html</li>
|
<li>Layer/MapGuide.html</li>
|
||||||
<li>Layer/MapServer.html</li>
|
<li>Layer/MapServer.html</li>
|
||||||
<li>Layer/Markers.html</li>
|
<li>Layer/Markers.html</li>
|
||||||
<script type="text/javascript">if(window.location.host.match(/^(www.)?openlayers.org$/)){document.write('<li>Layer/MultiMap.html</li>');}</script>
|
<li>Layer/MultiMap.html</li>
|
||||||
<li>Layer/PointTrack.html</li>
|
<li>Layer/PointTrack.html</li>
|
||||||
<li>Layer/SphericalMercator.html</li>
|
<li>Layer/SphericalMercator.html</li>
|
||||||
<li>Layer/Text.html</li>
|
<li>Layer/Text.html</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user