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"); |
38 }); | 40 }); |
39 target0.setPointerCapture(e.pointerId); | 41 target0.setPointerCapture(e.pointerId); |
40 set_capture_to_target0 = true; | 42 set_capture_to_target0 = true; |
41 // hasPointerCapture will return true immediately after a ca
ll to setPointerCapture | 43 // hasPointerCapture will return true immediately after a ca
ll to setPointerCapture |
42 test_pointerEvent.step(function () { | 44 test_pointerEvent.step(function () { |
43 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, | 45 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, |
44 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); | 46 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); |
45 }); | 47 }); |
46 // hasPointerCapture will return false immediately after a c
all to releasePointerCapture | 48 // hasPointerCapture will return false immediately after a c
all to releasePointerCapture |
47 target0.releasePointerCapture(e.pointerId); | 49 target0.releasePointerCapture(e.pointerId); |
48 set_capture_to_target0 = false; | 50 set_capture_to_target0 = false; |
49 test_pointerEvent.step(function () { | 51 test_pointerEvent.step(function () { |
50 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 52 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
51 "after target0.releasePointerCapture, targ
et0.hasPointerCapture should be false"); | 53 "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"); |
52 }); | 56 }); |
53 target0.setPointerCapture(e.pointerId); | 57 target0.setPointerCapture(e.pointerId); |
54 set_capture_to_target0 = true; | 58 set_capture_to_target0 = true; |
55 test_pointerEvent.step(function () { | 59 test_pointerEvent.step(function () { |
56 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, | 60 assert_equals(target0.hasPointerCapture(e.pointerId), tr
ue, |
57 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); | 61 "after target0.setPointerCapture, target0.
hasPointerCapture should be true"); |
58 }); | 62 }); |
59 // If the element.hasPointerCapture is false element.release
PointerCapture does nothing | 63 // If the element.hasPointerCapture is false element.release
PointerCapture does nothing |
60 target1.releasePointerCapture(e.pointerId); | 64 target1.releasePointerCapture(e.pointerId); |
61 test_pointerEvent.step(function () { | 65 test_pointerEvent.step(function () { |
(...skipping 20 matching lines...) Expand all Loading... |
82 "pointerup target0.hasPointerCapture shoul
d be true"); | 86 "pointerup target0.hasPointerCapture shoul
d be true"); |
83 }); | 87 }); |
84 set_capture_to_target0 = false; | 88 set_capture_to_target0 = false; |
85 }); | 89 }); |
86 | 90 |
87 on_event(target0, "lostpointercapture", function (e) { | 91 on_event(target0, "lostpointercapture", function (e) { |
88 test_pointerEvent.step(function () { | 92 test_pointerEvent.step(function () { |
89 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, | 93 assert_equals(target0.hasPointerCapture(e.pointerId), fa
lse, |
90 "pointerup target0.hasPointerCapture shoul
d be false"); | 94 "pointerup target0.hasPointerCapture shoul
d be false"); |
91 }); | 95 }); |
| 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 }); |
92 test_pointerEvent.done(); | 103 test_pointerEvent.done(); |
93 }); | 104 }); |
94 } | 105 } |
95 </script> | 106 </script> |
96 </head> | 107 </head> |
97 <body onload="run()"> | 108 <body onload="run()"> |
98 <h1>Element.hasPointerCapture test</h1> | 109 <h1>Element.hasPointerCapture test</h1> |
99 <h4> | 110 <h4> |
100 Test Description: This test checks if Element.hasPointerCapture retu
rns value correctly | 111 Test Description: This test checks if Element.hasPointerCapture retu
rns value correctly |
101 <ol> | 112 <ol> |
102 <li> Press black rectangle and do not release. | 113 <li> Press black rectangle and do not release |
103 <li> Move your pointer to yellow rectangle. | 114 <li> Move your pointer to purple rectangle |
104 <li> Release the pointer with no other move after that. | 115 <li> Release the pointer |
| 116 <li> Click purple rectangle |
105 </ol> | 117 </ol> |
106 </h4> | 118 </h4> |
107 <p> | 119 <p> |
108 <div id="target0" style="background:black"></div> | 120 <div id="target0" touch-action:none></div> |
109 <div id="target1" style="background:yellow"></div> | 121 <div id="target1" touch-action:none></div> |
110 <div id="complete-notice"> | 122 <div id="complete-notice"> |
111 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> | 123 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
112 </div> | 124 </div> |
113 <div id="log"></div> | 125 <div id="log"></div> |
114 </body> | 126 </body> |
115 </html> | 127 </html> |
OLD | NEW |