| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Cursor: should update after image loaded even when stationary</title> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <style> |
| 8 #target { |
| 9 height: 500px; |
| 10 width: 500px; |
| 11 } |
| 12 </style> |
| 13 </head> |
| 14 <body> |
| 15 <div id="target"></div> |
| 16 <script> |
| 17 var cursorTest = async_test('Test cursor update after image loaded'); |
| 18 cursorTest.step(function() { |
| 19 assert_not_equals(window.eventSender, undefined, 'This test requires eventSe
nder.'); |
| 20 |
| 21 assert_equals(internals.getCurrentCursorInfo(), "type=Pointer hotSpot=0,0"); |
| 22 |
| 23 var target = document.getElementById('target'); |
| 24 var rect = target.getBoundingClientRect(); |
| 25 eventSender.mouseMoveTo(rect.left + 3, rect.top + 3); |
| 26 |
| 27 // Wait for condition until timeout. |
| 28 function waitForCondition(condition, completion) { |
| 29 if (condition()) { |
| 30 completion(); |
| 31 } else { |
| 32 requestAnimationFrame(() => waitForCondition(condition, completion))
; |
| 33 } |
| 34 } |
| 35 |
| 36 function testSetCursorImage(url, expectedCursorInfo, complete) { |
| 37 const currentCursorInfo = internals.getCurrentCursorInfo(); |
| 38 target.style.cursor = `url(${url}),auto`; |
| 39 waitForCondition(() => internals.getCurrentCursorInfo() != currentCursor
Info, cursorTest.step_func(() => { |
| 40 assert_equals(internals.getCurrentCursorInfo(), expectedCursorInfo); |
| 41 complete(); |
| 42 })); |
| 43 } |
| 44 |
| 45 testSetCursorImage('resources/greenbox.png', 'type=Custom hotSpot=0,0 image=
25x25', () => { |
| 46 testSetCursorImage('resources/abe.png', 'type=Custom hotSpot=0,0 image=7
6x103', () => { |
| 47 cursorTest.done(); |
| 48 }) |
| 49 }); |
| 50 }); |
| 51 </script> |
| 52 </body> |
| 53 </html> |
| OLD | NEW |