blob: f9f213460a7af71d69e0859d5a5ef2cedc06a669 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=53341">Bug 53341</a></p>
<div id="test-container">
<div id="target" onMouseDown="style.cursor='progress';event.preventDefault();" onMouseMove="style.cursor='pointer';" onMouseUp="style.cursor='help';" style="cursor:pointer;">Play with mouse on this element. Cursors change on events - mousemove: pointer(hand), mousedown: progress, mouseup: help.</div>
</div>
<br/>
<div id="console"></div>
<script>
var CURSOR_UPDATE_DELAY = 200;
description("Test that mouse cursors are changed correctly on mouse events.");
if (!window.eventSender) {
testFailed('This test requires DumpRenderTree');
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.jsTestIsAsync = true;
}
function runTest(prepare, next) {
prepare();
setTimeout(function() {
debug('Cursor Info: ' + window.internals.getCurrentCursorInfo());
debug('');
next();
}, CURSOR_UPDATE_DELAY);
}
function testsDone() {
// This text is redundant with the test output - hide it
document.getElementById('test-container').style.display = 'none';
finishJSTest();
}
// Can't do anything useful here without eventSender
if (window.eventSender) {
var target = document.getElementById('target');
eventSender.dragMode = false;
var tests = [
function() {
debug('Mouse move');
eventSender.mouseMoveTo(target.offsetLeft + 3, target.offsetTop + 3);
}, function() {
debug('Mouse down');
eventSender.mouseDown();
}, function() {
debug('Mouse hold down, move');
eventSender.mouseMoveTo(target.offsetLeft + 13, target.offsetTop + 3);
}, function() {
debug('Mouse up');
eventSender.mouseUp();
}
];
var i = 0;
function nextTest() {
if (i < tests.length) {
runTest(tests[i++], nextTest);
} else {
testsDone();
}
}
nextTest();
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>