Improve slider's value indicator display test (#139198)
The previous test for #128137 does not effectively regress and verify #123313 because the issue is specific to desktop platforms.
This commit is contained in:
@@ -987,14 +987,25 @@ abstract class WidgetController {
|
||||
/// For example, a test that verifies that tapping a disabled button does not
|
||||
/// trigger the button would set `warnIfMissed` to false, because the button
|
||||
/// would ignore the tap.
|
||||
Future<void> tap(finders.FinderBase<Element> finder, {int? pointer, int buttons = kPrimaryButton, bool warnIfMissed = true}) {
|
||||
return tapAt(getCenter(finder, warnIfMissed: warnIfMissed, callee: 'tap'), pointer: pointer, buttons: buttons);
|
||||
Future<void> tap(
|
||||
finders.FinderBase<Element> finder, {
|
||||
int? pointer,
|
||||
int buttons = kPrimaryButton,
|
||||
bool warnIfMissed = true,
|
||||
PointerDeviceKind kind = PointerDeviceKind.touch,
|
||||
}) {
|
||||
return tapAt(getCenter(finder, warnIfMissed: warnIfMissed, callee: 'tap'), pointer: pointer, buttons: buttons, kind: kind);
|
||||
}
|
||||
|
||||
/// Dispatch a pointer down / pointer up sequence at the given location.
|
||||
Future<void> tapAt(Offset location, {int? pointer, int buttons = kPrimaryButton}) {
|
||||
Future<void> tapAt(
|
||||
Offset location, {
|
||||
int? pointer,
|
||||
int buttons = kPrimaryButton,
|
||||
PointerDeviceKind kind = PointerDeviceKind.touch,
|
||||
}) {
|
||||
return TestAsyncUtils.guard<void>(() async {
|
||||
final TestGesture gesture = await startGesture(location, pointer: pointer, buttons: buttons);
|
||||
final TestGesture gesture = await startGesture(location, pointer: pointer, buttons: buttons, kind: kind);
|
||||
await gesture.up();
|
||||
});
|
||||
}
|
||||
@@ -1012,9 +1023,20 @@ abstract class WidgetController {
|
||||
/// * [tap], which presses and releases a pointer at the given location.
|
||||
/// * [longPress], which presses and releases a pointer with a gap in
|
||||
/// between long enough to trigger the long-press gesture.
|
||||
Future<TestGesture> press(finders.FinderBase<Element> finder, {int? pointer, int buttons = kPrimaryButton, bool warnIfMissed = true}) {
|
||||
Future<TestGesture> press(
|
||||
finders.FinderBase<Element> finder, {
|
||||
int? pointer,
|
||||
int buttons = kPrimaryButton,
|
||||
bool warnIfMissed = true,
|
||||
PointerDeviceKind kind = PointerDeviceKind.touch,
|
||||
}) {
|
||||
return TestAsyncUtils.guard<TestGesture>(() {
|
||||
return startGesture(getCenter(finder, warnIfMissed: warnIfMissed, callee: 'press'), pointer: pointer, buttons: buttons);
|
||||
return startGesture(
|
||||
getCenter(finder, warnIfMissed: warnIfMissed, callee: 'press'),
|
||||
pointer: pointer,
|
||||
buttons: buttons,
|
||||
kind: kind,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1030,15 +1052,31 @@ abstract class WidgetController {
|
||||
/// later verify that long-pressing the same location (using the same finder)
|
||||
/// has no effect (since the widget is now obscured), setting `warnIfMissed`
|
||||
/// to false on that second call.
|
||||
Future<void> longPress(finders.FinderBase<Element> finder, {int? pointer, int buttons = kPrimaryButton, bool warnIfMissed = true}) {
|
||||
return longPressAt(getCenter(finder, warnIfMissed: warnIfMissed, callee: 'longPress'), pointer: pointer, buttons: buttons);
|
||||
Future<void> longPress(
|
||||
finders.FinderBase<Element> finder, {
|
||||
int? pointer,
|
||||
int buttons = kPrimaryButton,
|
||||
bool warnIfMissed = true,
|
||||
PointerDeviceKind kind = PointerDeviceKind.touch,
|
||||
}) {
|
||||
return longPressAt(
|
||||
getCenter(finder, warnIfMissed: warnIfMissed, callee: 'longPress'),
|
||||
pointer: pointer,
|
||||
buttons: buttons,
|
||||
kind: kind,
|
||||
);
|
||||
}
|
||||
|
||||
/// Dispatch a pointer down / pointer up sequence at the given location with
|
||||
/// a delay of [kLongPressTimeout] + [kPressTimeout] between the two events.
|
||||
Future<void> longPressAt(Offset location, {int? pointer, int buttons = kPrimaryButton}) {
|
||||
Future<void> longPressAt(
|
||||
Offset location, {
|
||||
int? pointer,
|
||||
int buttons = kPrimaryButton,
|
||||
PointerDeviceKind kind = PointerDeviceKind.touch,
|
||||
}) {
|
||||
return TestAsyncUtils.guard<void>(() async {
|
||||
final TestGesture gesture = await startGesture(location, pointer: pointer, buttons: buttons);
|
||||
final TestGesture gesture = await startGesture(location, pointer: pointer, buttons: buttons, kind: kind);
|
||||
await pump(kLongPressTimeout + kPressTimeout);
|
||||
await gesture.up();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user