]> dev.renevier.net Git - syp.git/blob - openlayers/tests/Popup/AnchoredBubble.html
err_lonlat_invalid exceptions not thrown correctly
[syp.git] / openlayers / tests / Popup / AnchoredBubble.html
1 <html>
2 <head>
3   <script src="../../lib/OpenLayers.js"></script>
4   <script type="text/javascript">
5
6    function test_Popup_Anchored_setOpacity(t) { 
7         t.plan(5);
8         var opacity = 0.5;
9         var id = "chicken";
10         var w = 500;
11         var h = 400;
12         var sz = new OpenLayers.Size(w,h);
13         var lon = 5;
14         var lat = 40;
15         var ll = new OpenLayers.LonLat(lon, lat);
16         var content = "foo";
17         var x = 50;
18         var y = 100;
19
20         var map = new OpenLayers.Map('map');
21         map.addLayer(new OpenLayers.Layer('name', {'isBaseLayer':true}));
22         map.zoomToMaxExtent();
23
24         var popup = new OpenLayers.Popup.AnchoredBubble(id,
25                                      ll,
26                                      sz,
27                                      content,
28                                      null,
29                                      false);
30         map.addPopup(popup);
31
32         popup.setOpacity(opacity);
33         popup.draw(new OpenLayers.Pixel(x, y));
34
35         if (navigator.appName.indexOf("Microsoft") == -1) {
36             t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
37         } else {
38             t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity");
39         }
40
41         t.ok(popup.groupDiv!=null, "popup.groupDiv exists");
42         t.ok(popup.groupDiv.parentNode!=null, "popup.groupDiv.parentNode exists");
43         t.ok(popup.groupDiv.parentNode.getElementsByTagName("span").length > 0, "popup.groupDiv.parentNode has SPAN children");
44
45         var ricoCornerDiv = popup.groupDiv.parentNode.getElementsByTagName("span")[0];
46         if (navigator.appName.indexOf("Microsoft") == -1) {
47             t.eq(parseFloat(ricoCornerDiv.style.opacity), opacity, "good default ricoCornerDiv.opacity");
48         } else {
49             t.eq(ricoCornerDiv.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default ricoCornerDiv.opacity");
50         }
51         
52    }
53
54   </script>
55 </head>
56 <body>
57 <div id="map" style="width:512px; height:256px"> </div>
58 </body>
59 </html>