Bug 1586496 - Add a gtest. r=tnikkel
authorBotond Ballo <botond@mozilla.com>
Fri, 01 Nov 2019 23:00:42 +0000
changeset 500257 8aa8ed80ea4325031cd613b5f85a3d694231c2ba
parent 500256 7cec59e15970dca1fa78f73ac3697445ebd50319
child 500258 bfca32aadf0733f768435c4f12c0564975b80c6e
push id36757
push userapavel@mozilla.com
push dateSat, 02 Nov 2019 09:54:21 +0000
treeherdermozilla-central@8aa8ed80ea43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1586496
milestone72.0a1
first release with
nightly linux32
8aa8ed80ea43 / 72.0a1 / 20191102095421 / files
nightly linux64
8aa8ed80ea43 / 72.0a1 / 20191102095421 / files
nightly mac
8aa8ed80ea43 / 72.0a1 / 20191102095421 / files
nightly win32
8aa8ed80ea43 / 72.0a1 / 20191102095421 / files
nightly win64
8aa8ed80ea43 / 72.0a1 / 20191102095421 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1586496 - Add a gtest. r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D51480
gfx/layers/apz/test/gtest/TestGestureDetector.cpp
--- a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
+++ b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "APZCBasicTester.h"
 #include "APZTestCommon.h"
+#include "mozilla/StaticPrefs_apz.h"
 
 // Note: There are additional tests that test gesture detection behaviour
 //       with multiple APZCs in TestTreeManager.cpp.
 
 class APZCGestureDetectorTester : public APZCBasicTester {
  public:
   APZCGestureDetectorTester()
       : APZCBasicTester(AsyncPanZoomController::USE_GESTURE_DETECTOR) {}
@@ -210,16 +211,38 @@ TEST_F(APZCGestureDetectorTester, Pan_Wi
 
   // Clear out any remaining fling animation and pending tasks
   apzc->AdvanceAnimationsUntilEnd();
   while (mcc->RunThroughDelayedTasks())
     ;
   apzc->AssertStateIsReset();
 }
 
+TEST_F(APZCGestureDetectorTester, SecondTapIsFar_Bug1586496) {
+  SCOPED_GFX_PREF_BOOL("layout.css.touch_action.enabled", false);
+
+  // Test that we receive two single-tap events when two tap gestures are
+  // close in time but far in distance.
+  EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, _, 0, apzc->GetGuid(), _))
+      .Times(2);
+
+  TimeDuration brief =
+      TimeDuration::FromMilliseconds(StaticPrefs::apz_max_tap_time() / 10);
+
+  ScreenIntPoint point(10, 10);
+  Tap(apzc, point, brief);
+
+  mcc->AdvanceBy(brief);
+
+  point.x += apzc->GetSecondTapTolerance() * 2;
+  point.y += apzc->GetSecondTapTolerance() * 2;
+
+  Tap(apzc, point, brief);
+}
+
 class APZCFlingStopTester : public APZCGestureDetectorTester {
  protected:
   // Start a fling, and then tap while the fling is ongoing. When
   // aSlow is false, the tap will happen while the fling is at a
   // high velocity, and we check that the tap doesn't trigger sending a tap
   // to content. If aSlow is true, the tap will happen while the fling
   // is at a slow velocity, and we check that the tap does trigger sending
   // a tap to content. See bug 1022956.