Remove deprecated kind in GestureRecognizer et al (#119572)
* Remove deprecated kind in GestureRecognizer et al * Fix null case
This commit is contained in:
parent
a27802e2db
commit
3570cce58e
@ -18,11 +18,6 @@ class EagerGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
///
|
///
|
||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
EagerGestureRecognizer({
|
EagerGestureRecognizer({
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
|
@ -125,11 +125,6 @@ class ForcePressGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
this.peakPressure = 0.85,
|
this.peakPressure = 0.85,
|
||||||
this.interpolation = _inverseLerp,
|
this.interpolation = _inverseLerp,
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
}) : assert(peakPressure > startPressure);
|
}) : assert(peakPressure > startPressure);
|
||||||
|
@ -248,11 +248,6 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
|
|||||||
LongPressGestureRecognizer({
|
LongPressGestureRecognizer({
|
||||||
Duration? duration,
|
Duration? duration,
|
||||||
super.postAcceptSlopTolerance = null,
|
super.postAcceptSlopTolerance = null,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
|
@ -75,11 +75,6 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
DragGestureRecognizer({
|
DragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
this.dragStartBehavior = DragStartBehavior.start,
|
this.dragStartBehavior = DragStartBehavior.start,
|
||||||
this.velocityTrackerBuilder = _defaultBuilder,
|
this.velocityTrackerBuilder = _defaultBuilder,
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
@ -554,11 +549,6 @@ class VerticalDragGestureRecognizer extends DragGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
VerticalDragGestureRecognizer({
|
VerticalDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
@ -601,11 +591,6 @@ class HorizontalDragGestureRecognizer extends DragGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
HorizontalDragGestureRecognizer({
|
HorizontalDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
|
@ -215,11 +215,6 @@ abstract class MultiDragGestureRecognizer extends GestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
MultiDragGestureRecognizer({
|
MultiDragGestureRecognizer({
|
||||||
required super.debugOwner,
|
required super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
});
|
});
|
||||||
@ -371,11 +366,6 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
ImmediateMultiDragGestureRecognizer({
|
ImmediateMultiDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
@ -429,11 +419,6 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
HorizontalMultiDragGestureRecognizer({
|
HorizontalMultiDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
@ -487,11 +472,6 @@ class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
VerticalMultiDragGestureRecognizer({
|
VerticalMultiDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
@ -597,11 +577,6 @@ class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||||||
DelayedMultiDragGestureRecognizer({
|
DelayedMultiDragGestureRecognizer({
|
||||||
this.delay = kLongPressTimeout,
|
this.delay = kLongPressTimeout,
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
|
@ -118,11 +118,6 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
DoubleTapGestureRecognizer({
|
DoubleTapGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
super.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
});
|
});
|
||||||
@ -486,11 +481,6 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
|
|||||||
MultiTapGestureRecognizer({
|
MultiTapGestureRecognizer({
|
||||||
this.longTapDelay = Duration.zero,
|
this.longTapDelay = Duration.zero,
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
|
@ -78,15 +78,9 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
|
|||||||
/// {@endtemplate}
|
/// {@endtemplate}
|
||||||
GestureRecognizer({
|
GestureRecognizer({
|
||||||
this.debugOwner,
|
this.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
PointerDeviceKind? kind,
|
|
||||||
Set<PointerDeviceKind>? supportedDevices,
|
Set<PointerDeviceKind>? supportedDevices,
|
||||||
AllowedButtonsFilter? allowedButtonsFilter,
|
AllowedButtonsFilter? allowedButtonsFilter,
|
||||||
}) : assert(kind == null || supportedDevices == null),
|
}) : _supportedDevices = supportedDevices,
|
||||||
_supportedDevices = kind == null ? supportedDevices : <PointerDeviceKind>{ kind },
|
|
||||||
_allowedButtonsFilter = allowedButtonsFilter ?? _defaultButtonAcceptBehavior;
|
_allowedButtonsFilter = allowedButtonsFilter ?? _defaultButtonAcceptBehavior;
|
||||||
|
|
||||||
/// The recognizer's owner.
|
/// The recognizer's owner.
|
||||||
@ -321,11 +315,6 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
OneSequenceGestureRecognizer({
|
OneSequenceGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
});
|
});
|
||||||
@ -535,11 +524,6 @@ abstract class PrimaryPointerGestureRecognizer extends OneSequenceGestureRecogni
|
|||||||
this.preAcceptSlopTolerance = kTouchSlop,
|
this.preAcceptSlopTolerance = kTouchSlop,
|
||||||
this.postAcceptSlopTolerance = kTouchSlop,
|
this.postAcceptSlopTolerance = kTouchSlop,
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
}) : assert(
|
}) : assert(
|
||||||
|
@ -321,11 +321,6 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
ScaleGestureRecognizer({
|
ScaleGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
@Deprecated(
|
|
||||||
'Migrate to supportedDevices. '
|
|
||||||
'This feature was deprecated after v2.3.0-1.0.pre.',
|
|
||||||
)
|
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
this.dragStartBehavior = DragStartBehavior.down,
|
this.dragStartBehavior = DragStartBehavior.down,
|
||||||
|
@ -697,7 +697,6 @@ class TapAndDragGestureRecognizer extends OneSequenceGestureRecognizer with _Tap
|
|||||||
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
|
||||||
TapAndDragGestureRecognizer({
|
TapAndDragGestureRecognizer({
|
||||||
super.debugOwner,
|
super.debugOwner,
|
||||||
super.kind,
|
|
||||||
super.supportedDevices,
|
super.supportedDevices,
|
||||||
super.allowedButtonsFilter,
|
super.allowedButtonsFilter,
|
||||||
}) : _deadline = kPressTimeout,
|
}) : _deadline = kPressTimeout,
|
||||||
|
@ -730,7 +730,7 @@ void main() {
|
|||||||
testGesture('Can filter drags based on device kind', (GestureTester tester) {
|
testGesture('Can filter drags based on device kind', (GestureTester tester) {
|
||||||
final HorizontalDragGestureRecognizer drag =
|
final HorizontalDragGestureRecognizer drag =
|
||||||
HorizontalDragGestureRecognizer(
|
HorizontalDragGestureRecognizer(
|
||||||
kind: PointerDeviceKind.mouse,
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.mouse },
|
||||||
)
|
)
|
||||||
..dragStartBehavior = DragStartBehavior.down;
|
..dragStartBehavior = DragStartBehavior.down;
|
||||||
addTearDown(drag.dispose);
|
addTearDown(drag.dispose);
|
||||||
|
@ -574,19 +574,4 @@ void main() {
|
|||||||
expect(updated, 1);
|
expect(updated, 1);
|
||||||
expect(ended, 1);
|
expect(ended, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ForecePressGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
ForcePressGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('non-allowed pointer does not inadvertently reset the recognizer', (GestureTester tester) {
|
testGesture('non-allowed pointer does not inadvertently reset the recognizer', (GestureTester tester) {
|
||||||
gesture = LongPressGestureRecognizer(kind: PointerDeviceKind.touch);
|
gesture = LongPressGestureRecognizer(
|
||||||
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
||||||
|
);
|
||||||
setUpHandlers();
|
setUpHandlers();
|
||||||
|
|
||||||
// Accept a long-press gesture
|
// Accept a long-press gesture
|
||||||
@ -495,7 +497,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('Can filter long press based on device kind', (GestureTester tester) {
|
testGesture('Can filter long press based on device kind', (GestureTester tester) {
|
||||||
final LongPressGestureRecognizer mouseLongPress = LongPressGestureRecognizer(kind: PointerDeviceKind.mouse);
|
final LongPressGestureRecognizer mouseLongPress = LongPressGestureRecognizer(
|
||||||
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.mouse },
|
||||||
|
);
|
||||||
|
|
||||||
bool mouseLongPressDown = false;
|
bool mouseLongPressDown = false;
|
||||||
mouseLongPress.onLongPress = () {
|
mouseLongPress.onLongPress = () {
|
||||||
@ -697,19 +701,4 @@ void main() {
|
|||||||
longPress.dispose();
|
longPress.dispose();
|
||||||
recognized.clear();
|
recognized.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('LongPressGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
LongPressGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -49,36 +49,6 @@ void main() {
|
|||||||
GestureBinding.instance.handleEvent(up91, HitTestEntry(MockHitTestTarget()));
|
GestureBinding.instance.handleEvent(up91, HitTestEntry(MockHitTestTarget()));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('VerticalDragGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
VerticalDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('HorizontalDragGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
HorizontalDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Recognizers on different button filters:', () {
|
group('Recognizers on different button filters:', () {
|
||||||
final List<String> recognized = <String>[];
|
final List<String> recognized = <String>[];
|
||||||
late HorizontalDragGestureRecognizer primaryRecognizer;
|
late HorizontalDragGestureRecognizer primaryRecognizer;
|
||||||
|
@ -63,8 +63,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('MultiDrag: can filter based on device kind', (GestureTester tester) {
|
testGesture('MultiDrag: can filter based on device kind', (GestureTester tester) {
|
||||||
final DelayedMultiDragGestureRecognizer drag =
|
final DelayedMultiDragGestureRecognizer drag = DelayedMultiDragGestureRecognizer(
|
||||||
DelayedMultiDragGestureRecognizer(kind: PointerDeviceKind.touch);
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
||||||
|
);
|
||||||
|
|
||||||
bool didStartDrag = false;
|
bool didStartDrag = false;
|
||||||
drag.onStart = (Offset position) {
|
drag.onStart = (Offset position) {
|
||||||
@ -89,61 +90,4 @@ void main() {
|
|||||||
expect(didStartDrag, isFalse);
|
expect(didStartDrag, isFalse);
|
||||||
drag.dispose();
|
drag.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ImmediateMultiGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
try {
|
|
||||||
ImmediateMultiDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
} catch(error) {
|
|
||||||
expect(error, isAssertionError);
|
|
||||||
expect(error.toString(), contains('kind == null || supportedDevices == null'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('HorizontalMultiDragGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
HorizontalMultiDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('VerticalMultiDragGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
VerticalMultiDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('DelayedMultiDragGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
DelayedMultiDragGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,10 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('Can filter based on device kind', (GestureTester tester) {
|
testGesture('Can filter based on device kind', (GestureTester tester) {
|
||||||
final MultiTapGestureRecognizer tap =
|
final MultiTapGestureRecognizer tap = MultiTapGestureRecognizer(
|
||||||
MultiTapGestureRecognizer(
|
longTapDelay: kLongPressTimeout,
|
||||||
longTapDelay: kLongPressTimeout,
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
||||||
kind: PointerDeviceKind.touch,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
final List<String> log = <String>[];
|
final List<String> log = <String>[];
|
||||||
|
|
||||||
@ -143,34 +142,4 @@ void main() {
|
|||||||
|
|
||||||
tap.dispose();
|
tap.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('DoubleTapGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
DoubleTapGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('MultiTapGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
MultiTapGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -72,21 +72,6 @@ void main() {
|
|||||||
expect(difference.global, const Offset(40, 40));
|
expect(difference.global, const Offset(40, 40));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('EagerGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
EagerGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('PrimaryPointerGestureRecognizer', () {
|
group('PrimaryPointerGestureRecognizer', () {
|
||||||
testGesture('cleans up state after winning arena', (GestureTester tester) {
|
testGesture('cleans up state after winning arena', (GestureTester tester) {
|
||||||
final List<String> resolutions = <String>[];
|
final List<String> resolutions = <String>[];
|
||||||
|
@ -250,7 +250,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('Rejects scale gestures from unallowed device kinds', (GestureTester tester) {
|
testGesture('Rejects scale gestures from unallowed device kinds', (GestureTester tester) {
|
||||||
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(kind: PointerDeviceKind.touch);
|
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(
|
||||||
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
||||||
|
);
|
||||||
|
|
||||||
bool didStartScale = false;
|
bool didStartScale = false;
|
||||||
scale.onStart = (ScaleStartDetails details) {
|
scale.onStart = (ScaleStartDetails details) {
|
||||||
@ -282,7 +284,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testGesture('Scale gestures starting from allowed device kinds cannot be ended from unallowed devices', (GestureTester tester) {
|
testGesture('Scale gestures starting from allowed device kinds cannot be ended from unallowed devices', (GestureTester tester) {
|
||||||
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(kind: PointerDeviceKind.touch);
|
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(
|
||||||
|
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
||||||
|
);
|
||||||
|
|
||||||
bool didStartScale = false;
|
bool didStartScale = false;
|
||||||
Offset? updatedFocalPoint;
|
Offset? updatedFocalPoint;
|
||||||
@ -1159,21 +1163,6 @@ void main() {
|
|||||||
scale.dispose();
|
scale.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ScaleGestureRecognizer asserts when kind and supportedDevices are both set', (WidgetTester tester) async {
|
|
||||||
expect(
|
|
||||||
() {
|
|
||||||
ScaleGestureRecognizer(
|
|
||||||
kind: PointerDeviceKind.touch,
|
|
||||||
supportedDevices: <PointerDeviceKind>{ PointerDeviceKind.touch },
|
|
||||||
);
|
|
||||||
},
|
|
||||||
throwsA(
|
|
||||||
isA<AssertionError>().having((AssertionError error) => error.toString(),
|
|
||||||
'description', contains('kind == null || supportedDevices == null')),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testGesture('scale trackpadScrollCausesScale', (GestureTester tester) {
|
testGesture('scale trackpadScrollCausesScale', (GestureTester tester) {
|
||||||
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(
|
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(
|
||||||
dragStartBehavior: DragStartBehavior.start,
|
dragStartBehavior: DragStartBehavior.start,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user