]> dev.renevier.net Git - syp.git/blob - openlayers/tests/Layer/Yahoo.html
reset openlayers directory to its original state at the end of build.sh
[syp.git] / openlayers / tests / Layer / Yahoo.html
1 <html>
2 <head>
3   <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
4   <script src="../../lib/OpenLayers.js"></script>
5   <script type="text/javascript">
6     var layer; 
7
8     function test_Layer_Yahoo_constructor (t) {
9         t.plan( 4 );
10
11         var tempEventPane = OpenLayers.Layer.EventPane.prototype.initialize;
12         OpenLayers.Layer.EventPane.prototype.initialize = function(name, options) {
13             t.ok(name == g_Name, "EventPane initialize() called with correct name");
14             t.ok(options == g_Options, "EventPane initialize() called with correct options");
15         }
16
17         var tempFixedZoomLevels = OpenLayers.Layer.FixedZoomLevels.prototype.initialize;
18         OpenLayers.Layer.FixedZoomLevels.prototype.initialize = function(name, options) {
19             t.ok(name == g_Name, "FixedZoomLevels initialize() called with correct name");
20             t.ok(options == g_Options, "FixedZoomLevels initialize() called with correct options");
21         }
22
23
24         g_Name = {};
25         g_Options = {};        
26         var l = new OpenLayers.Layer.Yahoo(g_Name, g_Options);
27
28         OpenLayers.Layer.EventPane.prototype.initialize = tempEventPane;
29         OpenLayers.Layer.FixedZoomLevels.prototype.initialize = tempFixedZoomLevels;
30     }
31
32     function test_Layer_Yahoo_loadMapObject(t) {
33         t.plan(5);
34         
35         var temp = YMap;
36         YMap = OpenLayers.Class({
37             initialize: function(div, type, size) {
38                 t.ok(div == g_Div, "correct div passed to YMap constructor");
39                 t.ok(type == g_Type, "correct type passed to YMap constructor");
40                 t.ok(size == g_YMapSize, "correct size passed to YMap constructor");
41             },
42             disableKeyControls: function() {
43                 t.ok(true, "disableKeyControls called on map object");
44             }
45         });
46         
47         g_Div = {};
48         g_Type = {};
49         g_MapSize = {};
50         g_YMapSize = {};
51         
52         var l = new OpenLayers.Layer.Yahoo();
53         l.div = g_Div;
54         l.type = g_Type;
55         l.map = {
56             'getSize': function() {
57                 return g_MapSize;
58             }
59         };
60         l.getMapObjectSizeFromOLSize = function(mapSize) {
61             t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
62             return g_YMapSize;
63         };
64
65         l.loadMapObject();
66
67         YMap = temp;
68     }    
69
70     function test_Layer_Yahoo_onMapResize(t) {
71         t.plan(2);
72         
73         g_MapSize = {};
74         g_YMapSize = {};
75         
76         var l = new OpenLayers.Layer.Yahoo();
77         l.mapObject = {
78             'resizeTo': function(size) {
79                 t.ok(size == g_YMapSize, "correct YSize passed to reiszeTo on map object");
80             }
81         }
82         l.map = {
83             'getSize': function() {
84                 return g_MapSize;
85             }
86         };
87         l.getMapObjectSizeFromOLSize = function(mapSize) {
88             t.ok(mapSize == g_MapSize, "correctly translating map size from ol to YSize");
89             return g_YMapSize;
90         };
91
92         l.onMapResize();
93     }
94     
95     function test_Layer_Yahoo_getMapObjectSizeFromOLSize(t) {
96         t.plan(2);
97         
98         var temp = YSize;
99         YSize = function(w, h) {
100             t.ok(w == g_Size.w, "correct width passed to YSize constructor");
101             t.ok(h == g_Size.h, "correct height passed to YSize constructor");
102         }
103         
104         g_Size = {
105             'w': {},
106             'h': {}
107         };
108         
109         OpenLayers.Layer.Yahoo.prototype.getMapObjectSizeFromOLSize(g_Size);
110
111         YSize = temp;
112     }
113
114
115   </script>
116 </head>
117 <body>
118   <div id="map"></div>
119 </body>
120 </html>