OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Pointer Events pointer lock test</title> |
| 5 <meta name="viewport" content="width=device-width"> |
| 6 <link rel="stylesheet" type="text/css" href="../pointerevent_styles.css"
> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <!-- Additional helper script for common checks across event types --> |
| 10 <script type="text/javascript" src="../pointerevent_support.js"></script
> |
| 11 <script> |
| 12 var got_capture = false; |
| 13 var lost_capture = false; |
| 14 var lock_requested = false; |
| 15 |
| 16 function resetTestState() { |
| 17 } |
| 18 |
| 19 function run() { |
| 20 var test_pointerEvent = setup_pointerevent_test("no pointercaptu
re while pointerlock", ['mouse']); |
| 21 var div1 = document.getElementById("div1"); |
| 22 var div2 = document.getElementById("div2"); |
| 23 |
| 24 on_event(div1, 'pointerdown', function(event) { |
| 25 div2.setPointerCapture(event.pointerId); |
| 26 }); |
| 27 on_event(div1, 'pointermove', function(event) { |
| 28 if (lost_capture) { |
| 29 test_pointerEvent.step(function() { |
| 30 assert_equals(document.pointerLockElement, div1, "do
cument.pointerLockElement should be div1."); |
| 31 assert_true(lost_capture, "Pointer capture was lost
after got a pointer lock."); |
| 32 }); |
| 33 test_pointerEvent.done(); |
| 34 } |
| 35 }); |
| 36 on_event(div2, 'pointermove', function(event) { |
| 37 if (got_capture && !lock_requested) { |
| 38 div1.requestPointerLock(); |
| 39 lock_requested = true; |
| 40 } |
| 41 }); |
| 42 on_event(div2, 'gotpointercapture', function(event) { |
| 43 got_capture = true; |
| 44 }); |
| 45 on_event(div2, 'lostpointercapture', function(event) { |
| 46 lost_capture = true; |
| 47 }); |
| 48 } |
| 49 </script> |
| 50 </head> |
| 51 <body onload="run()"> |
| 52 <h1>Pointer Events pointer lock test</h1> |
| 53 <h2 id="pointerTypeDescription"></h2> |
| 54 <h4> |
| 55 Test Description: This test checks that we release the exsiting poin
ter capture when any element in the page gets a pointer lock. |
| 56 <ol> |
| 57 <li>Press left button down on the green rectangle and hold it.<
/li> |
| 58 <li>Move the mouse inside the green rectangle.</li> |
| 59 </ol> |
| 60 |
| 61 Test passes if the pointer capture is released on the yellow rectang
le when the green rectangle gets the pointer lock. |
| 62 </h4> |
| 63 <div id="testContainer"> |
| 64 <div id="div1" style="width:800px;height:250px;background:green"></d
iv> |
| 65 <div id="div2" style="width:800px;height:250px;background:yellow"></
div> |
| 66 </div> |
| 67 <div class="spacer"></div> |
| 68 </body> |
| 69 </html> |
OLD | NEW |