Merge branch '2.12' of github.com:openlayers/openlayers

This commit is contained in:
Bart van den Eijnden
2012-06-13 07:18:53 +02:00
13 changed files with 125 additions and 31 deletions

View File

@@ -39,10 +39,64 @@ function run() {
else {
out.innerHTML += "<br/>height Fail: " + size + ", " + height;
}
// To use the same syntax as in "\tests"
var t = {eq: function(a, b, msg) {
if (a == b) {
out.innerHTML += "<br/>ok " + msg;
}
else {
out.innerHTML += "<br/><span style=\"color:red\">Fail (" + a + " not eq " + b + "): " + msg + "<span>";
}
}
};
var text = (new Array(10)).join("foo foo foo <br>"),
content = "<div>" + text + "</div>";
var testName,
finalSize,
initialSize = OpenLayers.Util.getRenderedDimensions(content, null);
// containerElement option on absolute position with width and height
testName = "Absolute with w&h: ";
var optionAbsDiv ={
containerElement: document.getElementById("absoluteDiv")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute with w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute with w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
// containerElement option on absolute position without width and height
testName = "Absolute without w&h: ";
var optionAbsDiv00 ={
containerElement: document.getElementById("absoluteDiv00")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute without w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute without w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
}
</script>
</head>
<body onload="run()">
<div id="out"></div>
<div id="absoluteDiv" style="position:absolute; left:10px; width:500px; height: 500px"></div>
<div id="absoluteDiv00" style="position:absolute; left:10px;"></div>
</body>
</html>