The missing ingredient seems to be that the Linux widget code generates pan gesture events with [mSimulateMomentum=true](https://searchfox.org/mozilla-central/rev/e94c6cb9649bfe4e6a3888460f41bcd4fe30a6ca/widget/gtk/nsWindow.cpp#4921) but the test code does not. The following additional change makes the test fail in the expected way for me: ``` diff --git a/gfx/layers/apz/test/gtest/InputUtils.h b/gfx/layers/apz/test/gtest/InputUtils.h --- a/gfx/layers/apz/test/gtest/InputUtils.h +++ b/gfx/layers/apz/test/gtest/InputUtils.h @@ -126,9 +126,11 @@ APZEventResult PanGesture(PanGestureInpu const RefPtr<InputReceiver>& aTarget, const ScreenIntPoint& aPoint, const ScreenPoint& aDelta, TimeStamp aTime, - Modifiers aModifiers = MODIFIER_NONE) { + Modifiers aModifiers = MODIFIER_NONE, + bool aSimulateMomentum = false) { PanGestureInput input(aType, MillisecondsSinceStartup(aTime), aTime, aPoint, aDelta, aModifiers); + input.mSimulateMomentum = aSimulateMomentum; return aTarget->ReceiveInputEvent(input); } diff --git a/gfx/layers/apz/test/gtest/TestOverscroll.cpp b/gfx/layers/apz/test/gtest/TestOverscroll.cpp --- a/gfx/layers/apz/test/gtest/TestOverscroll.cpp +++ b/gfx/layers/apz/test/gtest/TestOverscroll.cpp @@ -370,10 +370,10 @@ TEST_F(APZCOverscrollTester, StuckInOver mcc->AdvanceByMillis(5); apzc->AdvanceAnimations(mcc->GetSampleTime()); PanGesture(PanGestureInput::PANGESTURE_END, apzc, ScreenIntPoint(50, 80), - ScreenPoint(0, 0), mcc->Time()); + ScreenPoint(0, 0), mcc->Time(), MODIFIER_NONE, true); SampleAnimationOnce(); PanGesture(PanGestureInput::PANGESTURE_END, apzc, ScreenIntPoint(50, 80), - ScreenPoint(0, 0), mcc->Time()); + ScreenPoint(0, 0), mcc->Time(), MODIFIER_NONE, true); EXPECT_TRUE(apzc->IsOverscrolled()); ```
Bug 1767337 Comment 12 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The missing ingredient seems to be that the Linux widget code generates pan gesture events with [mSimulateMomentum=true](https://searchfox.org/mozilla-central/rev/e94c6cb9649bfe4e6a3888460f41bcd4fe30a6ca/widget/gtk/nsWindow.cpp#4921) but the test code does not. The following additional change makes the test fail in the expected way for me: ```diff diff --git a/gfx/layers/apz/test/gtest/InputUtils.h b/gfx/layers/apz/test/gtest/InputUtils.h --- a/gfx/layers/apz/test/gtest/InputUtils.h +++ b/gfx/layers/apz/test/gtest/InputUtils.h @@ -126,9 +126,11 @@ APZEventResult PanGesture(PanGestureInpu const RefPtr<InputReceiver>& aTarget, const ScreenIntPoint& aPoint, const ScreenPoint& aDelta, TimeStamp aTime, - Modifiers aModifiers = MODIFIER_NONE) { + Modifiers aModifiers = MODIFIER_NONE, + bool aSimulateMomentum = false) { PanGestureInput input(aType, MillisecondsSinceStartup(aTime), aTime, aPoint, aDelta, aModifiers); + input.mSimulateMomentum = aSimulateMomentum; return aTarget->ReceiveInputEvent(input); } diff --git a/gfx/layers/apz/test/gtest/TestOverscroll.cpp b/gfx/layers/apz/test/gtest/TestOverscroll.cpp --- a/gfx/layers/apz/test/gtest/TestOverscroll.cpp +++ b/gfx/layers/apz/test/gtest/TestOverscroll.cpp @@ -370,10 +370,10 @@ TEST_F(APZCOverscrollTester, StuckInOver mcc->AdvanceByMillis(5); apzc->AdvanceAnimations(mcc->GetSampleTime()); PanGesture(PanGestureInput::PANGESTURE_END, apzc, ScreenIntPoint(50, 80), - ScreenPoint(0, 0), mcc->Time()); + ScreenPoint(0, 0), mcc->Time(), MODIFIER_NONE, true); SampleAnimationOnce(); PanGesture(PanGestureInput::PANGESTURE_END, apzc, ScreenIntPoint(50, 80), - ScreenPoint(0, 0), mcc->Time()); + ScreenPoint(0, 0), mcc->Time(), MODIFIER_NONE, true); EXPECT_TRUE(apzc->IsOverscrolled()); ```