Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Pointer Events pointer lock tests</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 lock_count = 0; | |
| 13 var capture_count = 0; | |
| 14 var mouse_down_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 mouse_down_count++; | |
| 26 | |
| 27 if (mouse_down_count == 1) { | |
| 28 div2.setPointerCapture(event.pointerId); | |
| 29 div1.requestPointerLock(); | |
| 30 } else { | |
| 31 document.exitPointerLock(); | |
| 32 } | |
| 33 }); | |
| 34 on_event(div2, 'gotpointercapture', function(event) { | |
| 35 capture_count++; | |
| 36 }); | |
| 37 on_event(div2, 'lostpointercapture', function(event) { | |
| 38 capture_count++; | |
| 39 }); | |
| 40 on_event(document, 'pointerlockchange', function(event) { | |
| 41 lock_count++; | |
| 42 test_pointerEvent.step(function() { | |
| 43 if (lock_count == 1) | |
| 44 assert_equals(document.pointerLockElement, div1, "do cument.pointerLockElement should be div1."); | |
| 45 else if (lock_count == 2) { | |
| 46 assert_equals(document.pointerLockElement, null, "do cument.pointerLockElement should be null."); | |
| 47 assert_equals(capture_count, 0, "no capture"); | |
|
Navid Zolghadr
2017/05/17 16:30:10
Maybe a better error message here. Like "There sho
lanwei
2017/05/19 15:04:58
Done.
| |
| 48 } | |
| 49 }); | |
| 50 test_pointerEvent.done(); | |
| 51 }); | |
| 52 } | |
| 53 </script> | |
| 54 </head> | |
| 55 <body onload="run()"> | |
| 56 <h1>Pointer Events pointer lock test</h1> | |
| 57 <h2 id="pointerTypeDescription"></h2> | |
| 58 <h4> | |
| 59 Test Description: This test checks that we do not set the pointer ca pture when any element in the page gets a pointer lock. | |
| 60 <ol> | |
| 61 <li>Press left button down on the blue rectangle and hold it.</ li> | |
|
Navid Zolghadr
2017/05/17 16:30:10
Do you want to add a little move here as well? Als
scheib
2017/05/18 23:30:46
The middle button press seems to be a distraction
lanwei
2017/05/19 15:04:59
Done.
| |
| 62 <li>Press middle button down on the blue rectangle and hold it. </li> | |
| 63 </ol> | |
| 64 | |
| 65 Test passes if the pointer capture is not set when the blue rectangl e gets the pointer lock. | |
| 66 </h4> | |
| 67 <div id="testContainer"> | |
| 68 <div id="div1" style="width:800px;height:250px;background:green"></d iv> | |
| 69 <div id="div2" style="width:800px;height:250px;background:yellow"></ div> | |
| 70 </div> | |
| 71 <div class="spacer"></div> | |
| 72 </body> | |
| 73 </html> | |
| OLD | NEW |