OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Element.hasPointerCapture test</title> | 4 <title>Element.hasPointerCapture test</title> |
5 <meta name="viewport" content="width=device-width"> | 5 <meta name="viewport" content="width=device-width"> |
6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
9 <script type="text/javascript" src="pointerevent_support.js"></script> | 9 <script type="text/javascript" src="pointerevent_support.js"></script> |
10 <script> | 10 <script> |
(...skipping 17 matching lines...) Expand all Loading... |
28 on_event(target0, "pointerdown", function (e) { | 28 on_event(target0, "pointerdown", function (e) { |
29 detected_pointertypes[e.pointerType] = true; | 29 detected_pointertypes[e.pointerType] = true; |
30 test_pointerEvent.step(function () { | 30 test_pointerEvent.step(function () { |
31 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 31 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
32 "before target0.setPointerCapture, target0
.hasPointerCapture should be false"); | 32 "before target0.setPointerCapture, target0
.hasPointerCapture should be false"); |
33 }); | 33 }); |
34 target1.setPointerCapture(e.pointerId); | 34 target1.setPointerCapture(e.pointerId); |
35 test_pointerEvent.step(function () { | 35 test_pointerEvent.step(function () { |
36 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 36 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
37 "after target1.setPointerCapture, target0.
hasPointerCapture should be false"); | 37 "after target1.setPointerCapture, target0.
hasPointerCapture should be false"); |
38 assert_equals(target1.hasPointerCapture(e.pointerId), tr
ue, | |
39 "after target1.setPointerCapture, target1.
hasPointerCapture should be true"); | |
40 }); | 38 }); |
41 target0.setPointerCapture(e.pointerId); | 39 target0.setPointerCapture(e.pointerId); |
42 set_capture_to_target0 = true; | 40 set_capture_to_target0 = true; |
43 // hasPointerCapture will return true immediately after a ca
ll to setPointerCapture | 41 // hasPointerCapture will return true immediately after a ca
ll to setPointerCapture |
44 test_pointerEvent.step(function () { | 42 test_pointerEvent.step(function () { |
45 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, | 43 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, |
46 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); | 44 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); |
47 }); | 45 }); |
48 // hasPointerCapture will return false immediately after a c
all to releasePointerCapture | 46 // hasPointerCapture will return false immediately after a c
all to releasePointerCapture |
49 target0.releasePointerCapture(e.pointerId); | 47 target0.releasePointerCapture(e.pointerId); |
50 set_capture_to_target0 = false; | 48 set_capture_to_target0 = false; |
51 test_pointerEvent.step(function () { | 49 test_pointerEvent.step(function () { |
52 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 50 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
53 "after target0.releasePointerCapture, targ
et0.hasPointerCapture should be false"); | 51 "after target0.releasePointerCapture, targ
et0.hasPointerCapture should be false"); |
54 assert_equals(target1.hasPointerCapture(e.pointerId), fa
lse, | |
55 "after target0.releasePointerCapture, targ
et1.hasPointerCapture should be false"); | |
56 }); | 52 }); |
57 target0.setPointerCapture(e.pointerId); | 53 target0.setPointerCapture(e.pointerId); |
58 set_capture_to_target0 = true; | 54 set_capture_to_target0 = true; |
59 test_pointerEvent.step(function () { | 55 test_pointerEvent.step(function () { |
60 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, | 56 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, |
61 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); | 57 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); |
62 }); | 58 }); |
63 // If the element.hasPointerCapture is false element.release
PointerCapture does nothing | 59 // If the element.hasPointerCapture is false element.release
PointerCapture does nothing |
64 target1.releasePointerCapture(e.pointerId); | 60 target1.releasePointerCapture(e.pointerId); |
65 test_pointerEvent.step(function () { | 61 test_pointerEvent.step(function () { |
(...skipping 20 matching lines...) Expand all Loading... |
86 "pointerup target0.hasPointerCapture shoul
d be true"); | 82 "pointerup target0.hasPointerCapture shoul
d be true"); |
87 }); | 83 }); |
88 set_capture_to_target0 = false; | 84 set_capture_to_target0 = false; |
89 }); | 85 }); |
90 | 86 |
91 on_event(target0, "lostpointercapture", function (e) { | 87 on_event(target0, "lostpointercapture", function (e) { |
92 test_pointerEvent.step(function () { | 88 test_pointerEvent.step(function () { |
93 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 89 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
94 "pointerup target0.hasPointerCapture shoul
d be false"); | 90 "pointerup target0.hasPointerCapture shoul
d be false"); |
95 }); | 91 }); |
96 }); | |
97 | |
98 on_event(target1, "pointerup", function (e) { | |
99 test_pointerEvent.step(function () { | |
100 assert_equals(target1.hasPointerCapture(e.pointerId), fa
lse, | |
101 "pointerup target1.hasPointerCapture shoul
d be false"); | |
102 }); | |
103 test_pointerEvent.done(); | 92 test_pointerEvent.done(); |
104 }); | 93 }); |
105 } | 94 } |
106 </script> | 95 </script> |
107 </head> | 96 </head> |
108 <body onload="run()"> | 97 <body onload="run()"> |
109 <h1>Element.hasPointerCapture test</h1> | 98 <h1>Element.hasPointerCapture test</h1> |
110 <h4> | 99 <h4> |
111 Test Description: This test checks if Element.hasPointerCapture retu
rns value correctly | 100 Test Description: This test checks if Element.hasPointerCapture retu
rns value correctly |
112 <ol> | 101 <ol> |
113 <li> Press black rectangle and do not release | 102 <li> Press black rectangle and do not release. |
114 <li> Move your pointer to purple rectangle | 103 <li> Move your pointer to yellow rectangle. |
115 <li> Release the pointer | 104 <li> Release the pointer with no other move after that. |
116 <li> Click purple rectangle | |
117 </ol> | 105 </ol> |
118 </h4> | 106 </h4> |
119 <p> | 107 <p> |
120 <div id="target0" touch-action:none></div> | 108 <div id="target0" style="background:black"></div> |
121 <div id="target1" touch-action:none></div> | 109 <div id="target1" style="background:yellow"></div> |
122 <div id="complete-notice"> | 110 <div id="complete-notice"> |
123 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> | 111 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
124 </div> | 112 </div> |
125 <div id="log"></div> | 113 <div id="log"></div> |
126 </body> | 114 </body> |
127 </html> | 115 </html> |
OLD | NEW |