robolectric/robolectric — pull request #1423 by tec27 (2014-12-13 02:22:27+00:00)
Title: Implement a shadow for VelocityTracker.

This shadow allows touch-based UIs to be tested through
Robolectric with actual MotionEvents (e.g. ViewPagers). The velocity
computation algorithm is based off of the LegacyVelocityTrackerStrategy
in AOSP
(https://android.googlesource.com/platform/frameworks/base.git/+/android-4.2.2_r1/libs/androidfw/VelocityTracker.cpp#812).
I chose this strategy because, while not ideal for usage on real
devices, it's straightforward to implement in a Shadow and easy to
intuitively choose values for in tests.

This implementation represents the full API of VelocityTracker,
including support for handling multiple pointers at once.