pointerevent_setpointercapture_inactive_button_mouse.html (3105B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>setPointerCapture + inactive button state</title> 5 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> 6 <meta name="viewport" content="width=device-width"> 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 <script src="pointerevent_support.js"></script> 13 </head> 14 <body onload="run()"> 15 <h1>setPointerCapture</h1> 16 <h4> 17 Test Description: This test checks if setPointerCapture works properly. 18 <ol> 19 <li>Put your mouse over the black rectangle 20 <li>Move you mouse out to complete the test 21 </ol> 22 </h4> 23 <p> 24 <div id="target0" style="background:black; color:white;"></div> 25 <script> 26 var detected_pointertypes = {}; 27 28 var captureGot = false; 29 30 setup({ single_test: true }); 31 add_completion_callback(showPointerTypes); 32 33 function run() { 34 var target0 = document.getElementById("target0"); 35 var actions_promise; 36 37 on_event(target0, "pointerover", function (event) { 38 detected_pointertypes[event.pointerType] = true; 39 target0.setPointerCapture(event.pointerId); 40 // After we receive a pointerover event, dispatch a pointer move to move out of target0. 41 // https://github.com/w3c/webdriver/issues/1545 42 actions_promise.then(function() { 43 return new test_driver.Actions().pointerMove(1, 1).send(); 44 }); 45 }); 46 47 // First dispatch a pointer move to target0. 48 actions_promise = new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send(); 49 50 // When the setPointerCapture method is invoked, if the specified pointer is not in active button state, then the method must have no effect on subsequent pointer events. 51 // TA: 13.2 52 on_event(target0, "pointerout", function (event) { 53 assert_false(captureGot, "pointer capture is not set while button state is inactive") 54 // Make sure the test finishes after all the input actions are completed. 55 actions_promise.then( () => { 56 done(); 57 }); 58 }); 59 60 on_event(target0, 'gotpointercapture', function(e) { 61 captureGot = true; 62 }); 63 } 64 </script> 65 <h1>Pointer Events setPointerCapture Tests</h1> 66 <div id="complete-notice"> 67 <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> 68 </div> 69 <div id="log"></div> 70 </body> 71 </html>