omit some tests in browsers that don't give us getComputedStyle for elements inside hidden frames (closes #2910)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11753 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -211,7 +211,7 @@ OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
|
||||
// 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";
|
||||
|
||||
@@ -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();
|
||||
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});
|
||||
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});
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user