[OpenLayers-Commits] r11753 - in trunk/openlayers:
lib/OpenLayers/Handler tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 29 11:15:12 EDT 2011
Author: ahocevar
Date: 2011-03-29 08:15:07 -0700 (Tue, 29 Mar 2011)
New Revision: 11753
Modified:
trunk/openlayers/lib/OpenLayers/Handler/Box.js
trunk/openlayers/tests/Handler/Box.html
Log:
omit some tests in browsers that don't give us getComputedStyle for elements inside hidden frames (closes #2910)
Modified: trunk/openlayers/lib/OpenLayers/Handler/Box.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Box.js 2011-03-29 14:44:35 UTC (rev 11752)
+++ trunk/openlayers/lib/OpenLayers/Handler/Box.js 2011-03-29 15:15:07 UTC (rev 11753)
@@ -211,7 +211,7 @@
// the borders are inside the box bounds, leaving us with a
// clientWidth of 1.
var testDiv = document.createElement("div");
- testDiv.style.visibility = "hidden";
+ //testDiv.style.visibility = "hidden";
testDiv.style.position = "absolute";
testDiv.style.border = "1px solid black";
testDiv.style.width = "3px";
Modified: trunk/openlayers/tests/Handler/Box.html
===================================================================
--- trunk/openlayers/tests/Handler/Box.html 2011-03-29 14:44:35 UTC (rev 11752)
+++ trunk/openlayers/tests/Handler/Box.html 2011-03-29 15:15:07 UTC (rev 11753)
@@ -18,7 +18,16 @@
}
function test_Handler_Box_draw(t) {
- t.plan(12);
+ var testAll = true;
+ if (document.defaultView && document.defaultView.getComputedStyle &&
+ !document.defaultView.getComputedStyle(document.body)) {
+ // we don't get dimensions for hidden frames in IE4, and our test
+ // runs in a hidden frame.
+ testAll = false;
+ }
+
+ t.plan(testAll ? 12 : 2);
+
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
map.addControl(control);
@@ -29,18 +38,24 @@
handler.dragHandler.start = {x: 5, y: 5};
handler.startBox({x: 5, y: 5});
var offset = handler.getBoxOffsets();
- t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box correct");
- t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box correct");
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box correct");
+ }
handler.moveBox({x: 10, y: 10});
- t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box still correct");
- t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box still correct");
- t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box correct");
- t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box correct");
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box correct");
+ t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box correct");
+ }
handler.moveBox({x: 0, y: 0});
- t.eq(parseInt(handler.zoomBox.style.left), 0 - offset.left, "new x position of box correct");
- t.eq(parseInt(handler.zoomBox.style.top), 0 - offset.top, "new y position of box correct");
- t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box still correct");
- t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box still correct");
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 0 - offset.left, "new x position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 0 - offset.top, "new y position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box still correct");
+ }
handler.endBox({x: 11, y: 11});
t.eq(handler.zoomBox, null, "box removed after endBox");
}
More information about the Commits
mailing list