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 mouse_move_count = 0; |
| 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(div2, 'pointermove', function(event) { |
| 28 mouse_move_count++; |
| 29 if (got_capture && mouse_move_count == 2) |
| 30 div1.requestPointerLock(); |
| 31 }); |
| 32 on_event(div2, 'gotpointercapture', function(event) { |
| 33 got_capture = true; |
| 34 }); |
| 35 on_event(div2, 'lostpointercapture', function(event) { |
| 36 lost_capture = true; |
| 37 test_pointerEvent.step(function() { |
| 38 assert_equals(document.pointerLockElement, div1, "docume
nt.pointerLockElement should be div1."); |
| 39 assert_true(lost_capture, "Pointer capture was lost afte
r got a pointer lock."); |
| 40 }); |
| 41 test_pointerEvent.done(); |
| 42 }); |
| 43 } |
| 44 </script> |
| 45 </head> |
| 46 <body onload="run()"> |
| 47 <h1>Pointer Events pointer lock test</h1> |
| 48 <h2 id="pointerTypeDescription"></h2> |
| 49 <h4> |
| 50 Test Description: This test checks that we release the exsiting poin
ter capture when any element in the page gets a pointer lock. |
| 51 <ol> |
| 52 <li>Press left button down on the green rectangle and hold it.<
/li> |
| 53 <li>Move the mouse inside the green rectangle.</li> |
| 54 </ol> |
| 55 |
| 56 Test passes if the pointer capture is released on the yellow rectang
le when the green rectangle gets the pointer lock. |
| 57 </h4> |
| 58 <div id="testContainer"> |
| 59 <div id="div1" style="width:800px;height:250px;background:green"></d
iv> |
| 60 <div id="div2" style="width:800px;height:250px;background:yellow"></
div> |
| 61 </div> |
| 62 <div class="spacer"></div> |
| 63 </body> |
| 64 </html> |
OLD | NEW |