| 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>typematic DOH Robot 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"></script> |
| 13 |
|
| 14 |
<script type="text/javascript"> |
| 15 |
require([ |
| 16 |
"doh/runner", "dojo/robotx", |
| 17 |
"dojo/dom", "dojo/keys", |
| 18 |
"dojo/domReady!" |
| 19 |
], function(doh, robot, dom, keys){ |
| 20 |
robot.initRobot('../test_typematic.html'); |
| 21 |
|
| 22 |
doh.register("press and hold test", [ |
| 23 |
{ |
| 24 |
name: "keyboard", |
| 25 |
timeout: 9000, |
| 26 |
runTest: function(){ |
| 27 |
var |
| 28 |
d = new doh.Deferred(), |
| 29 |
input = dom.byId("typematicInput"), |
| 30 |
v; |
| 31 |
input.value = ""; |
| 32 |
input.focus(); |
| 33 |
|
| 34 |
robot.keyDown(keys.CTRL, 1000); |
| 35 |
robot.keyDown(keys.F11, 200); |
| 36 |
robot.sequence(function(){ |
| 37 |
v = input.value; // get value before releasing key to reduce timing dependence on the robot |
| 38 |
}, 2000); |
| 39 |
robot.keyUp(keys.F11, 100); |
| 40 |
robot.keyUp(keys.CTRL, 100); |
| 41 |
|
| 42 |
robot.sequence(d.getTestCallback(function(){ |
| 43 |
// allow off by 1 |
| 44 |
doh.t(v == "aaaaaaaaaa" || v == "aaaaaaaaaaa" || v == "aaaaaaaaaaaa", "a letters typed " + v); |
| 45 |
}), 500); |
| 46 |
|
| 47 |
return d; |
| 48 |
} |
| 49 |
}, |
| 50 |
{ |
| 51 |
name: "mouse", |
| 52 |
timeout: 5000, |
| 53 |
runTest: function(){ |
| 54 |
var |
| 55 |
d = new doh.Deferred(), |
| 56 |
input = dom.byId("typematicInput"), |
| 57 |
v; |
| 58 |
input.value = ""; |
| 59 |
|
| 60 |
robot.mouseMoveAt("typematicButton", 500, 1); |
| 61 |
robot.mousePress({left: true}, 500); |
| 62 |
robot.sequence(function(){ |
| 63 |
v = input.value; // get value before releasing button to reduce timing dependence on the robot |
| 64 |
}, 1000); |
| 65 |
robot.mouseRelease({left: true}, 100); |
| 66 |
|
| 67 |
robot.sequence(d.getTestCallback(function(){ |
| 68 |
// allow off by 1 |
| 69 |
doh.t(v == "bbbbbb" || v == "bbbbbbb" || v == "bbbbbbbb", "b letters typed " + v); |
| 70 |
}), 500); |
| 71 |
|
| 72 |
return d; |
| 73 |
} |
| 74 |
}, |
| 75 |
{ |
| 76 |
name: "double click", |
| 77 |
timeout: 5000, |
| 78 |
runTest: function(){ |
| 79 |
var |
| 80 |
d = new doh.Deferred(), |
| 81 |
input = dom.byId("typematicInput"); |
| 82 |
input.value = ""; |
| 83 |
|
| 84 |
robot.mouseMoveAt("typematicButton", 500, 1); |
| 85 |
robot.mousePress({left: true}, 500); |
| 86 |
robot.mouseRelease({left: true}, 100); |
| 87 |
robot.mousePress({left: true}, 100); |
| 88 |
robot.mouseRelease({left: true}, 100); |
| 89 |
|
| 90 |
robot.sequence(d.getTestCallback(function(){ |
| 91 |
doh.is("bb", input.value, "b letters typed " + input.value); |
| 92 |
}), 500); |
| 93 |
|
| 94 |
return d; |
| 95 |
} |
| 96 |
} |
| 97 |
]); |
| 98 |
|
| 99 |
doh.run(); |
| 100 |
}); |
| 101 |
</script> |
| 102 |
</head> |
| 103 |
</html> |