pointerevent_pointerout_after_pointercancel_touch-manual.html (3275B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>pointerout</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 </head> 12 <body class="scrollable" onload="run()"> 13 <h2>pointerout</h2> 14 <h4>Test Description: This test checks if pointerout event triggers after pointercancel. Start touch on the black rectangle and move your touch to scroll in any direction. </h4> 15 <p>Note: this test is for touch devices only</p> 16 <div id="target0"></div> 17 <script> 18 var test_pointerout = async_test("pointerout event received"); 19 // showPointerTypes is defined in pointerevent_support.js 20 // Requirements: the callback function will reference the test_pointerEvent object and 21 // will fail unless the async_test is created with the var name "test_pointerEvent". 22 add_completion_callback(showPointerTypes); 23 24 var eventTested = false; 25 var pointercancel_event = null; 26 var detected_pointertypes = {}; 27 28 function run() { 29 var target0 = document.getElementById("target0"); 30 31 on_event(target0, "pointercancel", function (event) { 32 detected_pointertypes[event.pointerType] = true; 33 pointercancel_event = event; 34 }); 35 36 // After firing the pointercancel event the pointerout event must be dispatched. 37 // TA: 4.3 38 on_event(target0, "pointerout", function (event) { 39 if(event.pointerType == 'touch') { 40 if(pointercancel_event != null) { 41 if (eventTested == false) { 42 test_pointerout.step(function() { 43 assert_equals(event.pointerType, pointercancel_event.pointerType, "pointerType is same for pointercancel and pointerout"); 44 assert_equals(event.isPrimary, pointercancel_event.isPrimary, "isPrimary is same for pointercancel and pointerout"); 45 }); 46 eventTested = true; 47 test_pointerout.done(); 48 } 49 } 50 else { 51 test_pointerout.step(function() { 52 assert_true(false, 53 "pointercancel received before pointerout"); 54 }, "pointercancel received before pointerout"); 55 } 56 } 57 }); 58 } 59 60 </script> 61 <h1>Pointer Events pointerout tests</h1> 62 <div id="complete-notice"> 63 <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> 64 </div> 65 <div id="log"></div> 66 </body> 67 </html>