1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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>
|