blob: 787f3ea3d52f9dbbb4434e31d37399100fd5809d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/basic-gestures.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
async function runTest()
{
if (!testRunner.runUIScript)
return;
var output = '';
var targetRect = document.getElementById('selection').getBoundingClientRect();
var pressPointX = targetRect.x + targetRect.width / 2;
var pressPointY = targetRect.y + targetRect.height / 2;
var result = await longPressAtPoint(pressPointX, pressPointY);
if (document.getSelection().toString() == "PressMe")
output += 'PASS: Correct Selection';
else
output += 'FAIL: failed to select a word as a result of a long press';
output += '<br>';
output += result;
document.getElementById('target').innerHTML = output;
testRunner.notifyDone();
}
window.addEventListener('load', runTest, false);
</script>
<style>
#target {
height: 100px;
width: 200px;
background-color: silver;
}
</style>
<meta name="viewport" content="initial-scale=1">
</head>
<body>
<div id="target">
<p><span id="selection">PressMe</span></p>
This test requires UIScriptController to run.
</div>
</body>
</html>