git-svn-id: http://svn.openlayers.org/trunk/openlayers@4059 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
121 lines
3.8 KiB
HTML
Executable File
121 lines
3.8 KiB
HTML
Executable File
<html>
|
|
<head>
|
|
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
|
|
<script src="../../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
var layer;
|
|
|
|
function test_01_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_02_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_03_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_04_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>
|