forked from burg/timelapse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouse-cursor-change.html
80 lines (72 loc) · 2.22 KB
/
mouse-cursor-change.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style type="text/css">
</style>
</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 = 50;
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>