| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<title>robot BorderContainer full Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../../util/doh/robot/robot.css"; |
| 9 |
</style> |
| 10 |
|
| 11 |
|
| 12 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 13 |
data-dojo-config="isDebug: true"></script> |
| 14 |
|
| 15 |
<script type="text/javascript"> |
| 16 |
require([ |
| 17 |
"doh/runner", "dojo/robotx", "dojo/dom", "dojo/dom-geometry", "dojo/window", |
| 18 |
"dijit/tests/helpers", "dijit/tests/layout/robot/borderContainerTestFunctions","dojo/domReady!" |
| 19 |
], function(doh, robot, dom, geom, window, helpers, bcTest){ |
| 20 |
|
| 21 |
robot.initRobot('../test_BorderContainer_full.html'); |
| 22 |
|
| 23 |
var registry; |
| 24 |
|
| 25 |
doh.register("setup", [ |
| 26 |
function setup(){ |
| 27 |
// get pointers to singletons loaded on test page |
| 28 |
registry = robot.window.require("dijit/registry"); |
| 29 |
} |
| 30 |
]); |
| 31 |
|
| 32 |
doh.register("API", [ |
| 33 |
function initialConditions(){ |
| 34 |
var bc = registry.byId("main"); |
| 35 |
bcTest.checkBCpanes(bc); |
| 36 |
doh.t(5, bc.getChildren().length, "# of children"); |
| 37 |
}, |
| 38 |
|
| 39 |
function testFullScreen(){ |
| 40 |
var borderContainerPos = geom.position(dom.byId("main")); |
| 41 |
var view = window.getBox(); |
| 42 |
doh.t(borderContainerPos.h-view.h < 3, "borderContainerPos.h-view.h = " + borderContainerPos.h-view.h); |
| 43 |
doh.t(borderContainerPos.w-view.w < 3, "borderContainerPos.w-view.w = " + borderContainerPos.w-view.w); |
| 44 |
} |
| 45 |
]); |
| 46 |
|
| 47 |
doh.register("mouse", [ |
| 48 |
{ |
| 49 |
name: "expand right pane", |
| 50 |
timeout: 10000, |
| 51 |
runTest: function(t){ |
| 52 |
var d = new doh.Deferred(); |
| 53 |
|
| 54 |
var oTop = geom.position(dom.byId("main-top")), |
| 55 |
oCenter = geom.position(dom.byId("main-center")), |
| 56 |
oRight = geom.position(dom.byId("main-trailing")), |
| 57 |
oBottom = geom.position(dom.byId("main-bottom")); |
| 58 |
|
| 59 |
// Drag slider to expand pane |
| 60 |
var size = geom.position("main-trailing_splitter"); |
| 61 |
robot.mouseMoveAt("main-trailing_splitter", 500); |
| 62 |
robot.mousePress({left: true}, 500); |
| 63 |
robot.mouseMoveAt("main-trailing_splitter", 500, 100, |
| 64 |
size.w/2 + (geom.isBodyLtr() ? -100 : 100), size.h/2); |
| 65 |
robot.mouseRelease({left: true}, 500); |
| 66 |
robot.sequence(d.getTestCallback(function(){ |
| 67 |
var nTop = geom.position(dom.byId("main-top")), |
| 68 |
nCenter = geom.position(dom.byId("main-center")), |
| 69 |
nRight = geom.position(dom.byId("main-trailing")), |
| 70 |
nBottom = geom.position(dom.byId("main-bottom")); |
| 71 |
|
| 72 |
doh.t(bcTest.within(oRight.w + 100, nRight.w, 10), "right width went from " + oRight.w + " to " + nRight.w); |
| 73 |
doh.t(bcTest.within(oTop.w - 100, nTop.w, 10), "top width went from " + oTop.w + " to " + nTop.w); |
| 74 |
doh.t(bcTest.within(oCenter.w - 100, nCenter.w, 10), "center width went from " + oCenter.w + " to " + nCenter.w); |
| 75 |
doh.t(bcTest.within(oBottom.w - 100, nBottom.w, 10), "bottom width went from " + nBottom.w + " to " + nBottom.w); |
| 76 |
}), 500); |
| 77 |
|
| 78 |
return d; |
| 79 |
} |
| 80 |
}, |
| 81 |
{ |
| 82 |
name: "shrink bottom pane", |
| 83 |
timeout: 10000, |
| 84 |
runTest: function(t){ |
| 85 |
var d = new doh.Deferred(); |
| 86 |
|
| 87 |
var oTop = geom.position(dom.byId("main-top")), |
| 88 |
oCenter = geom.position(dom.byId("main-center")), |
| 89 |
oRight = geom.position(dom.byId("main-trailing")), |
| 90 |
oBottom = geom.position(dom.byId("main-bottom")); |
| 91 |
|
| 92 |
// Drag slider to shrink pane |
| 93 |
var size = geom.position("main-bottom_splitter"); |
| 94 |
robot.mouseMoveAt("main-bottom_splitter", 500); |
| 95 |
robot.mousePress({left: true}, 500); |
| 96 |
robot.mouseMoveAt("main-bottom_splitter", 500, 100, size.w/2, size.h/2 + 10); |
| 97 |
robot.mouseRelease({left: true}, 500); |
| 98 |
robot.sequence(d.getTestCallback(function(){ |
| 99 |
var nTop = geom.position(dom.byId("main-top")), |
| 100 |
nCenter = geom.position(dom.byId("main-center")), |
| 101 |
nRight = geom.position(dom.byId("main-trailing")), |
| 102 |
nBottom = geom.position(dom.byId("main-bottom")); |
| 103 |
|
| 104 |
doh.t(bcTest.within(oBottom.h - 10, nBottom.h, 10), "bottom height went from " + oBottom.h + " to " + nBottom.h); |
| 105 |
doh.t(bcTest.within(oCenter.h + 10, nCenter.h, 10), "center height went from " + oCenter.h + " to " + nCenter.h); |
| 106 |
}), 500); |
| 107 |
|
| 108 |
return d; |
| 109 |
} |
| 110 |
} |
| 111 |
]); |
| 112 |
|
| 113 |
doh.run(); |
| 114 |
}); |
| 115 |
</script> |
| 116 |
</head> |
| 117 |
</html> |