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
|
<html>
<head>
<script src="../../OLLoader.js"></script>
<script src="../../../lib/Rico/Corner.js"></script>
<script src="../../../lib/deprecated.js"></script>
<script type="text/javascript">
function test_Popup_Anchored_setOpacity(t) {
t.plan(5);
var opacity = 0.5;
var id = "chicken";
var w = 500;
var h = 400;
var sz = new OpenLayers.Size(w,h);
var lon = 5;
var lat = 40;
var ll = new OpenLayers.LonLat(lon, lat);
var content = "foo";
var x = 50;
var y = 100;
var map = new OpenLayers.Map('map');
map.addLayer(new OpenLayers.Layer('name', {'isBaseLayer':true}));
map.zoomToMaxExtent();
var popup = new OpenLayers.Popup.AnchoredBubble(id,
ll,
sz,
content,
null,
false);
map.addPopup(popup);
popup.setOpacity(opacity);
popup.draw(new OpenLayers.Pixel(x, y));
if (navigator.appName.indexOf("Microsoft") == -1 || new RegExp(/msie 10/).test(navigator.userAgent.toLowerCase())) {
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
} else {
t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity");
}
t.ok(popup.groupDiv!=null, "popup.groupDiv exists");
t.ok(popup.groupDiv.parentNode!=null, "popup.groupDiv.parentNode exists");
t.ok(popup.groupDiv.parentNode.getElementsByTagName("span").length > 0, "popup.groupDiv.parentNode has SPAN children");
var ricoCornerDiv = popup.groupDiv.parentNode.getElementsByTagName("span")[0];
if (navigator.appName.indexOf("Microsoft") == -1 || new RegExp(/msie 10/).test(navigator.userAgent.toLowerCase())) {
t.eq(parseFloat(ricoCornerDiv.style.opacity), opacity, "good default ricoCornerDiv.opacity");
} else {
t.eq(ricoCornerDiv.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default ricoCornerDiv.opacity");
}
}
</script>
</head>
<body>
<div id="map" style="width:512px; height:256px"> </div>
</body>
</html>
|