pointerevent_pointerout_pen.html (3136B)
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 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <!-- Additional helper script for common checks across event types --> 13 <script type="text/javascript" src="pointerevent_support.js"></script> 14 </head> 15 <body onload="run()"> 16 <h2>pointerout</h2> 17 <h4>Test Description: This test checks if pointerout event triggers for pen. Place your pen over the black rectangle and then pull the pen out of the digitizer's detectable range. </h4> 18 <p>Note: this test is for devices that support hover - for pen only</p> 19 <div id="target0"></div> 20 <script> 21 var test_pointerout = async_test("pointerout event received"); 22 // showPointerTypes is defined in pointerevent_support.js 23 // Requirements: the callback function will reference the test_pointerEvent object and 24 // will fail unless the async_test is created with the var name "test_pointerEvent". 25 add_completion_callback(showPointerTypes); 26 27 var isPointerupReceived = false; 28 var detected_pointertypes = {}; 29 30 function run() { 31 var target0 = document.getElementById("target0"); 32 var actions_promise; 33 34 // When a pen stylus leaves the hover range detectable by the digitizer the pointerout event must be dispatched. 35 // TA: 7.2 36 on_event(target0, "pointerout", function (event) { 37 detected_pointertypes[event.pointerType] = true; 38 if(event.pointerType == 'pen') { 39 // Make sure the test finishes after all the input actions are completed. 40 actions_promise.then( () => { 41 test_pointerout.done(); 42 }); 43 } 44 else { 45 test_pointerout.step(function() { 46 assert_true(false, 47 "you have to use pen for this test"); 48 }, "you have to use pen for this test"); 49 } 50 }); 51 52 // Inject pen inputs. 53 actions_promise = new test_driver.Actions() 54 .addPointer("PenPointer1", "pen") 55 .pointerMove(0, 0, {origin: target0}) 56 .pointerMove(0, 0) 57 .send(); 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>