helper_bug1648491_no_pointercancel_with_dtc.html (2754B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width; initial-scale=1.0"> 6 <title>Test for Bug 1648491</title> 7 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 8 <script type="application/javascript" src="apz_test_utils.js"></script> 9 <script src="/tests/SimpleTest/paint_listener.js"></script> 10 <script src="/tests/SimpleTest/EventUtils.js"></script> 11 <script type="application/javascript"> 12 13 async function test() { 14 var body = document.body; 15 16 var pointersDown = 0; 17 var pointersUp = 0; 18 var pointerMoveCount = 0; 19 20 body.addEventListener("pointerdown", function(e) { 21 dump(`Got pointerdown, pointer id ${e.pointerId}\n`); 22 pointersDown++; 23 }); 24 body.addEventListener("pointermove", function(e) { 25 dump(`Got pointermove, pointer id ${e.pointerId}, at ${e.clientX}, ${e.clientY}\n`); 26 pointerMoveCount++; 27 }); 28 let pointersUpPromise = new Promise(resolve => { 29 body.addEventListener("pointercancel", function(e) { 30 dump(`Got pointercancel, pointer id ${e.pointerId}\n`); 31 ok(false, "Should not have gotten pointercancel"); 32 pointersUp++; 33 if (pointersDown == pointersUp) { 34 // All pointers lifted, let's continue the test 35 resolve(); 36 } 37 }); 38 body.addEventListener("pointerup", function(e) { 39 dump(`Got pointerup, pointer id ${e.pointerId}\n`); 40 pointersUp++; 41 if (pointersDown == pointersUp) { 42 // All pointers lifted, let's continue the test 43 resolve(); 44 } 45 }); 46 }); 47 48 var zoom_in = [ 49 [ { x: 125, y: 175 }, { x: 175, y: 225 } ], 50 [ { x: 120, y: 150 }, { x: 180, y: 250 } ], 51 [ { x: 115, y: 125 }, { x: 185, y: 275 } ], 52 [ { x: 110, y: 100 }, { x: 190, y: 300 } ], 53 [ { x: 105, y: 75 }, { x: 195, y: 325 } ], 54 [ { x: 100, y: 50 }, { x: 200, y: 350 } ], 55 ]; 56 57 var touchIds = [0, 1]; 58 await synthesizeNativeTouchSequences(document.getElementById("target"), zoom_in, null, touchIds); 59 60 dump("All touch events synthesized, waiting for final pointerup...\n"); 61 await pointersUpPromise; 62 63 // Should get at least one pointermove per pointer, even if the events 64 // get coalesced somewhere. 65 is(pointersDown, 2, "Got expected numbers of pointers recorded"); 66 ok(pointerMoveCount >= 2, "Got " + pointerMoveCount + " pointermove events"); 67 } 68 69 waitUntilApzStable() 70 .then(test) 71 .then(subtestDone, subtestFailed); 72 73 </script> 74 <style> 75 body { 76 height: 5000px; 77 } 78 #target { 79 touch-action: pan-x pan-y; 80 height: 400px; 81 } 82 </style> 83 </head> 84 <body> 85 <div id="target" onwheel="return false;"> 86 A two-finger pinch action here should send pointer events to content. 87 </div> 88 </body> 89 </html>