diff --git a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp index dc9eff237418..0e36e64e4014 100644 --- a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp +++ b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp @@ -6,6 +6,7 @@ #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. @@ -215,6 +216,28 @@ TEST_F(APZCGestureDetectorTester, Pan_With_Tap) { 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