Bug 1159985 - In APZ gtests, allow panning in both directions. r=kats

--HG--
extra : source : 6869f19b8b653ee012d0d0bc7e0f7f473983820d
This commit is contained in:
Botond Ballo 2015-05-11 22:06:03 -04:00
Родитель 2904d8d719
Коммит 23e426ca66
1 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -495,8 +495,8 @@ TapAndCheckStatus(const nsRefPtr<InputReceiver>& aTarget, int aX, int aY,
template<class InputReceiver> static void
Pan(const nsRefPtr<InputReceiver>& aTarget,
TimeStamp& aTime,
int aTouchStartY,
int aTouchEndY,
const ScreenPoint& aTouchStart,
const ScreenPoint& aTouchEnd,
bool aKeepFingerDown = false,
nsTArray<uint32_t>* aAllowedTouchBehaviors = nullptr,
nsEventStatus (*aOutEventStatuses)[4] = nullptr,
@ -519,7 +519,7 @@ Pan(const nsRefPtr<InputReceiver>& aTarget,
}
// Make sure the move is large enough to not be handled as a tap
nsEventStatus status = TouchDown(aTarget, 10, aTouchStartY + OVERCOME_TOUCH_TOLERANCE, aTime, aOutInputBlockId);
nsEventStatus status = TouchDown(aTarget, aTouchStart.x, aTouchStart.y + OVERCOME_TOUCH_TOLERANCE, aTime, aOutInputBlockId);
if (aOutEventStatuses) {
(*aOutEventStatuses)[0] = status;
}
@ -536,14 +536,14 @@ Pan(const nsRefPtr<InputReceiver>& aTarget,
}
}
status = TouchMove(aTarget, 10, aTouchStartY, aTime);
status = TouchMove(aTarget, aTouchStart.x, aTouchStart.y, aTime);
if (aOutEventStatuses) {
(*aOutEventStatuses)[1] = status;
}
aTime += TIME_BETWEEN_TOUCH_EVENT;
status = TouchMove(aTarget, 10, aTouchEndY, aTime);
status = TouchMove(aTarget, aTouchEnd.x, aTouchEnd.y, aTime);
if (aOutEventStatuses) {
(*aOutEventStatuses)[2] = status;
}
@ -551,7 +551,7 @@ Pan(const nsRefPtr<InputReceiver>& aTarget,
aTime += TIME_BETWEEN_TOUCH_EVENT;
if (!aKeepFingerDown) {
status = TouchUp(aTarget, 10, aTouchEndY, aTime);
status = TouchUp(aTarget, aTouchEnd.x, aTouchEnd.y, aTime);
} else {
status = nsEventStatus_eIgnore;
}
@ -564,6 +564,23 @@ Pan(const nsRefPtr<InputReceiver>& aTarget,
// them immediately after they start, without time having elapsed.
}
// A version of Pan() that only takes y coordinates rather than (x, y) points
// for the touch start and end points, and uses 10 for the x coordinates.
// This is for convenience, as most tests only need to pan in one direction.
template<class InputReceiver> static void
Pan(const nsRefPtr<InputReceiver>& aTarget,
TimeStamp& aTime,
int aTouchStartY,
int aTouchEndY,
bool aKeepFingerDown = false,
nsTArray<uint32_t>* aAllowedTouchBehaviors = nullptr,
nsEventStatus (*aOutEventStatuses)[4] = nullptr,
uint64_t* aOutInputBlockId = nullptr)
{
::Pan(aTarget, aTime, ScreenPoint(10, aTouchStartY), ScreenPoint(10, aTouchEndY),
aKeepFingerDown, aAllowedTouchBehaviors, aOutEventStatuses, aOutInputBlockId);
}
/*
* Dispatches mock touch events to the apzc and checks whether apzc properly
* consumed them and triggered scrolling behavior.