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 | |
15 function resetTestState() { | |
16 } | |
17 | |
18 function run() { | |
19 var test_pointerEvent = setup_pointerevent_test("no pointercaptu re while pointerlock", ['mouse']); | |
20 var div1 = document.getElementById("div1"); | |
21 var div2 = document.getElementById("div2"); | |
22 | |
23 on_event(div1, 'pointerdown', function(event) { | |
24 div2.setPointerCapture(event.pointerId); | |
25 if (got_capture) | |
26 div1.requestPointerLock(); | |
27 }); | |
28 on_event(div2, 'mousedown', function(event) { | |
Navid Zolghadr
2017/05/17 16:30:10
I believe we shouldn't rely on mouse events here.
| |
29 if (got_capture) | |
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; | |
Navid Zolghadr
2017/05/17 16:30:10
I believe we need to make sure we get this lostpoi
| |
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 down on the blue rectangle and hold it.</li> | |
Navid Zolghadr
2017/05/17 16:30:10
ditto
| |
53 <li>Press Esc key to exit pointer lock mode.</li> | |
54 </ol> | |
55 | |
56 Test passes if the pointer capture is released when the blue rectang le 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 |