blob: fc5ae6fbd7caf313a0c110b3fc6c4eecd4448a1b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/image-preload-helper.js"></script>
<style type="text/css">
</style>
</head>
<body>
<p id="description"></p>
<p><a href=https://bugs.webkit.org/show_bug.cgi?id=100059>Bug 100059</a></p>
<div id="test-container">
<div>Implicit default cursor</div>
<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>
</div>
<br/>
<div id="console"></div>
<script>
var imagesLeftToLoad = 0;
var testContainer = document.getElementById('test-container');
function runTests() {
// Can't do anything useful here without eventSender
if (window.eventSender) {
var nodesToTest = document.querySelectorAll('#test-container > div');
for (var i = 0; i < nodesToTest.length; i++) {
var node = nodesToTest[i];
debug('TEST CASE: ' + node.textContent);
// Make sure the node is visible and move the mouse over top of it.
document.scrollingElement.scrollTop = node.offsetTop - 50;
eventSender.mouseMoveTo(node.offsetLeft + 3, node.offsetTop - document.scrollingElement.scrollTop + 3);
// Get details of the current mouse cursor.
// Note that we could return structured data which we then validate, but that's a lot more
// work and is redundant with relying on the expected output anyway. Better to just dump
// it and inspect that it matches the description.
debug('Cursor Info: ' + window.internals.getCurrentCursorInfo());
debug('');
}
// This text is redundant with the test output - hide it
testContainer.style.display = 'none';
}
finishJSTest();
}
description("Test that mouse cursors are applied correctly.");
if (!window.eventSender) {
testFailed('This test requires DumpRenderTree');
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.jsTestIsAsync = true;
}
// Now wait for each image to load or fail to load before starting tests.
// Without this we can get null images in the cursors - eg. no known size.
preloadImagesFromStyle(testContainer, 1, runTests);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>