OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Pointer Event: Dispatch pointerleave (pen). </title> | 4 <title>Pointer Event: Dispatch pointerleave (pen). </title> |
5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> | 5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> |
6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"/> | 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"/> |
7 <meta name="assert" content="When a pointing device that supports hover
(pen stylus) leaves the range of the digitizer while over an element, the pointe
rleave event must be dispatched."/> | 7 <meta name="assert" content="When a pointing device that supports hover
(pen stylus) leaves the range of the digitizer while over an element, the pointe
rleave event must be dispatched."/> |
8 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | 8 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
9 <!-- /resources/testharness.js --> | 9 <!-- /resources/testharness.js --> |
10 <script src="/resources/testharness.js"></script> | 10 <script src="/resources/testharness.js"></script> |
11 <script src="/resources/testharnessreport.js"></script> | 11 <script src="/resources/testharnessreport.js"></script> |
12 <!-- Additional helper script for common checks across event types --> | 12 <!-- Additional helper script for common checks across event types --> |
13 <script type="text/javascript" src="pointerevent_support.js"></script> | 13 <script type="text/javascript" src="pointerevent_support.js"></script> |
14 <script type="text/javascript"> | 14 <script type="text/javascript"> |
15 var detected_pointertypes = {}; | 15 var detected_pointertypes = {}; |
16 var test_pointerEvent = async_test("pointerleave event"); // set up
test harness | 16 var test_pointerEvent = async_test("pointerleave event"); // set up
test harness |
17 // showPointerTypes is defined in pointerevent_support.js | 17 // showPointerTypes is defined in pointerevent_support.js |
18 // Requirements: the callback function will reference the test_point
erEvent object and | 18 // Requirements: the callback function will reference the test_point
erEvent object and |
19 // will fail unless the async_test is created with the var name "tes
t_pointerEvent". | 19 // will fail unless the async_test is created with the var name "tes
t_pointerEvent". |
20 add_completion_callback(showPointerTypes); | 20 add_completion_callback(showPointerTypes); |
21 | 21 |
22 function run() { | 22 function run() { |
23 var target0 = document.getElementById("target0"); | 23 var target0 = document.getElementById("target0"); |
| 24 var count = 0; |
| 25 |
| 26 on_event(target0, "pointerenter", function (event) { |
| 27 test_pointerEvent.step(function () { |
| 28 assert_equals(event.pointerType, "pen", "Test should be
run using a pen as input"); |
| 29 assert_equals(event.type, "pointerenter", "The " + event
.type + " event was received"); |
| 30 assert_equals(event.isPrimary, true, "The " + event.type
+ ".isPrimary is true"); |
| 31 }); |
| 32 }); |
24 | 33 |
25 on_event(target0, "pointerleave", function (event) { | 34 on_event(target0, "pointerleave", function (event) { |
26 detected_pointertypes[event.pointerType] = true; | 35 detected_pointertypes[event.pointerType] = true; |
27 check_PointerEvent(event); | 36 check_PointerEvent(event); |
| 37 count++; |
28 test_pointerEvent.step(function () { | 38 test_pointerEvent.step(function () { |
29 assert_equals(event.pointerType, "pen", "Test should be
run using a pen as input"); | 39 assert_equals(event.pointerType, "pen", "Test should be
run using a pen as input"); |
30 assert_equals(event.type, "pointerleave", "The " + event
.type + " event was received"); | 40 assert_equals(event.type, "pointerleave", "The " + event
.type + " event was received"); |
| 41 assert_equals(event.isPrimary, true, "The " + event.type
+ ".isPrimary is true"); |
31 assert_true((event.clientX > target0.getBoundingClientRe
ct().left)&& | 42 assert_true((event.clientX > target0.getBoundingClientRe
ct().left)&& |
32 (event.clientX < target0.getBoundingClientRect().rig
ht)&& | 43 (event.clientX < target0.getBoundingClientRect().rig
ht)&& |
33 (event.clientY > target0.getBoundingClientRect().top
)&& | 44 (event.clientY > target0.getBoundingClientRect().top
)&& |
34 (event.clientY < target0.getBoundingClientRect().bot
tom), | 45 (event.clientY < target0.getBoundingClientRect().bot
tom), |
35 "pointerleave should be received inside of target bo
unds"); | 46 "pointerleave should be received inside of target bo
unds"); |
36 }); | 47 }); |
37 test_pointerEvent.done(); // complete test | 48 if (count >= 2) |
| 49 test_pointerEvent.done(); // complete test |
38 }); | 50 }); |
39 } | 51 } |
40 </script> | 52 </script> |
41 </head> | 53 </head> |
42 <body onload="run()"> | 54 <body onload="run()"> |
43 <h1>Pointer Event: Dispatch pointerleave (pen)</h1> | 55 <h1>Pointer Event: Dispatch pointerleave (pen)</h1> |
44 <h4> | 56 <h4> |
45 Test Description: | 57 Test Description: |
46 When a pointing device that supports hover (pen stylus) leaves the r
ange of the digitizer while over an element, the pointerleave event must be disp
atched. | 58 When a pointing device that supports hover (pen stylus) leaves the r
ange of the digitizer while over an element, the pointerleave event must be disp
atched. In addition, all the pointer events' isPrimary should always be true whe
n the pointing device leaves and enters the range of the digitizer again. |
47 </h4> | 59 </h4> |
48 <br /> | 60 <br /> |
49 <div id="target0"> | 61 <div id="target0"> |
50 Use a pen to hover over then lift up away from this element. | 62 Use a pen to hover over then lift up away from this element. |
51 </div> | 63 </div> |
52 <div id="complete-notice"> | 64 <div id="complete-notice"> |
53 <p>Test complete: Scroll to Summary to view Pass/Fail Results.</p> | 65 <p>Test complete: Scroll to Summary to view Pass/Fail Results.</p> |
54 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> | 66 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
55 </div> | 67 </div> |
56 <div id="log"></div> | 68 <div id="log"></div> |
57 </body> | 69 </body> |
58 </html> | 70 </html> |
OLD | NEW |