Merge branch 'upstream-master' into gears
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../OLLoader.js"></script>
|
||||
<script src="../../../lib/deprecated.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var name = "GML Layer";
|
||||
|
||||
var gml = "./owls.xml";
|
||||
var gml2 = "./mice.xml";
|
||||
|
||||
// if this test is running online, different rules apply
|
||||
var isMSIE = (navigator.userAgent.indexOf("MSIE") > -1);
|
||||
if (isMSIE) {
|
||||
gml = "." + gml;
|
||||
gml2 = "." + gml2;
|
||||
}
|
||||
|
||||
function test_Layer_GML_constructor(t) {
|
||||
t.plan(3);
|
||||
|
||||
var layer = new OpenLayers.Layer.GML(name);
|
||||
t.ok(layer instanceof OpenLayers.Layer.GML, "new OpenLayers.Layer.GML returns correct object" );
|
||||
t.eq(layer.name, name, "layer name is correctly set");
|
||||
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||
|
||||
}
|
||||
function test_Layer_GML_events(t) {
|
||||
t.plan(3);
|
||||
|
||||
var layer = new OpenLayers.Layer.GML(name, gml, {isBaseLayer: true});
|
||||
layer.events.register("loadstart", layer, function() {
|
||||
t.ok(true, "loadstart called.")
|
||||
});
|
||||
layer.events.register("loadend", layer, function() {
|
||||
t.ok(true, "loadend called.")
|
||||
});
|
||||
var map = new OpenLayers.Map("map");
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
t.delay_call(3, function() {
|
||||
t.ok(true, "waited for 3s");
|
||||
});
|
||||
|
||||
}
|
||||
function test_GML_setUrl(t) {
|
||||
t.plan(2);
|
||||
var layer = new OpenLayers.Layer.GML(name, gml);
|
||||
var map = new OpenLayers.Map("map");
|
||||
map.addLayer(layer);
|
||||
t.eq(layer.url, gml, "layer has correct original url");
|
||||
layer.setUrl(gml2);
|
||||
t.eq(layer.url, gml2, "layer has correctly changed url");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
|
||||
<script src="../../OLLoader.js"></script>
|
||||
<script src="../../../lib/deprecated.js"></script>
|
||||
<script type="text/javascript">
|
||||
var layer;
|
||||
|
||||
function test_Layer_Yahoo_constructor (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var tempEventPane = OpenLayers.Layer.EventPane.prototype.initialize;
|
||||
OpenLayers.Layer.EventPane.prototype.initialize = function(name, options) {
|
||||
t.ok(name == g_Name, "EventPane initialize() called with correct name");
|
||||
t.ok(options == g_Options, "EventPane initialize() called with correct options");
|
||||
}
|
||||
|
||||
var tempFixedZoomLevels = OpenLayers.Layer.FixedZoomLevels.prototype.initialize;
|
||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize = function(name, options) {
|
||||
t.ok(name == g_Name, "FixedZoomLevels initialize() called with correct name");
|
||||
t.ok(options == g_Options, "FixedZoomLevels initialize() called with correct options");
|
||||
}
|
||||
|
||||
|
||||
g_Name = {};
|
||||
g_Options = {};
|
||||
var l = new OpenLayers.Layer.Yahoo(g_Name, g_Options);
|
||||
|
||||
OpenLayers.Layer.EventPane.prototype.initialize = tempEventPane;
|
||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize = tempFixedZoomLevels;
|
||||
}
|
||||
|
||||
function test_Layer_Yahoo_loadMapObject(t) {
|
||||
t.plan(5);
|
||||
|
||||
var temp = YMap;
|
||||
YMap = OpenLayers.Class({
|
||||
initialize: function(div, type, size) {
|
||||
t.ok(div == g_Div, "correct div passed to YMap constructor");
|
||||
t.ok(type == g_Type, "correct type passed to YMap constructor");
|
||||
t.ok(size == g_YMapSize, "correct size passed to YMap constructor");
|
||||
},
|
||||
disableKeyControls: function() {
|
||||
t.ok(true, "disableKeyControls called on map object");
|
||||
}
|
||||
});
|
||||
|
||||
g_Div = {};
|
||||
g_Type = {};
|
||||
g_MapSize = {};
|
||||
g_YMapSize = {};
|
||||
|
||||
var l = new OpenLayers.Layer.Yahoo();
|
||||
l.div = g_Div;
|
||||
l.type = g_Type;
|
||||
l.map = {
|
||||
'getSize': function() {
|
||||
return g_MapSize;
|
||||
}
|
||||
};
|
||||
l.getMapObjectSizeFromOLSize = function(mapSize) {
|
||||
t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
|
||||
return g_YMapSize;
|
||||
};
|
||||
|
||||
l.loadMapObject();
|
||||
|
||||
YMap = temp;
|
||||
}
|
||||
|
||||
function test_Layer_Yahoo_onMapResize(t) {
|
||||
t.plan(2);
|
||||
|
||||
g_MapSize = {};
|
||||
g_YMapSize = {};
|
||||
|
||||
var l = new OpenLayers.Layer.Yahoo();
|
||||
l.mapObject = {
|
||||
'resizeTo': function(size) {
|
||||
t.ok(size == g_YMapSize, "correct YSize passed to reiszeTo on map object");
|
||||
}
|
||||
}
|
||||
l.map = {
|
||||
'getSize': function() {
|
||||
return g_MapSize;
|
||||
}
|
||||
};
|
||||
l.getMapObjectSizeFromOLSize = function(mapSize) {
|
||||
t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
|
||||
return g_YMapSize;
|
||||
};
|
||||
|
||||
l.onMapResize();
|
||||
}
|
||||
|
||||
function test_Layer_Yahoo_getMapObjectSizeFromOLSize(t) {
|
||||
t.plan(2);
|
||||
|
||||
var temp = YSize;
|
||||
YSize = function(w, h) {
|
||||
t.ok(w == g_Size.w, "correct width passed to YSize constructor");
|
||||
t.ok(h == g_Size.h, "correct height passed to YSize constructor");
|
||||
}
|
||||
|
||||
g_Size = {
|
||||
'w': {},
|
||||
'h': {}
|
||||
};
|
||||
|
||||
OpenLayers.Layer.Yahoo.prototype.getMapObjectSizeFromOLSize(g_Size);
|
||||
|
||||
YSize = temp;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user