4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"../js/resources/image-preload-helper.js"></script>
6 <style type=
"text/css">
10 <p id=
"description"></p>
11 <p><a href=https://bugs.webkit.org/show_bug.cgi?id=
100059>Bug
100059</a></p>
12 <div id=
"test-container">
13 <div>Implicit default cursor
</div>
14 <div style='cursor: url(resources/greenbox-
3frames.cur), pointer'
>CUR file with
3 frames, largest of which (
2nd frame) is
20x12 with hotspot at (
18,
11).
</div>
17 <div id=
"console"></div>
19 var imagesLeftToLoad
= 0;
20 var testContainer
= document
.getElementById('test-container');
23 // Can't do anything useful here without eventSender
24 if (window
.eventSender
) {
25 var nodesToTest
= document
.querySelectorAll('#test-container > div');
26 for (var i
= 0; i
< nodesToTest
.length
; i
++) {
27 var node
= nodesToTest
[i
];
28 debug('TEST CASE: ' + node
.textContent
);
30 // Make sure the node is visible and move the mouse over top of it.
31 document
.documentElement
.scrollTop
= node
.offsetTop
- 50;
32 eventSender
.mouseMoveTo(node
.offsetLeft
+ 3, node
.offsetTop
- document
.documentElement
.scrollTop
+ 3);
34 // Get details of the current mouse cursor.
35 // Note that we could return structured data which we then validate, but that's a lot more
36 // work and is redundant with relying on the expected output anyway. Better to just dump
37 // it and inspect that it matches the description.
38 debug('Cursor Info: ' + window
.internals
.getCurrentCursorInfo());
41 // This text is redundant with the test output - hide it
42 testContainer
.style
.display
= 'none';
48 description("Test that mouse cursors are applied correctly.");
50 if (!window
.eventSender
) {
51 testFailed('This test requires DumpRenderTree');
54 if (window
.testRunner
) {
55 testRunner
.dumpAsText();
56 testRunner
.waitUntilDone();
57 window
.jsTestIsAsync
= true;
60 // Now wait for each image to load or fail to load before starting tests.
61 // Without this we can get null images in the cursors - eg. no known size.
62 preloadImagesFromStyle(testContainer
, 1, runTests
);