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_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 div1.requestPointerLock(); | |
27 }); | |
28 on_event(div1, 'pointermove', function(event) { | |
scheib
2017/05/19 19:54:17
why not pointerup?
If using move, I'm concerned t
lanwei
2017/05/23 23:11:42
We want to use the same actions for all three test
| |
29 mouse_move_count++; | |
30 if (mouse_move_count == 2) { | |
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, "There shouldn't be any capture events fired."); | |
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 green rectangle and hold it.< /li> | |
62 <li>Move the mouse inside the green rectangle.</li> | |
63 </ol> | |
64 | |
65 Test passes if the pointer capture is not set when the green rectang le 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 |