Pointer events: Allow hover events from trackpad (#108116)
This commit is contained in:
@@ -1035,10 +1035,7 @@ class PointerHoverEvent extends PointerEvent with _PointerEventDescription, _Cop
|
|||||||
super.tilt,
|
super.tilt,
|
||||||
super.synthesized,
|
super.synthesized,
|
||||||
super.embedderId,
|
super.embedderId,
|
||||||
}) : // Dart doesn't support comparing enums with == in const contexts yet.
|
}) : super(
|
||||||
// https://github.com/dart-lang/language/issues/1811
|
|
||||||
assert(!identical(kind, PointerDeviceKind.trackpad)),
|
|
||||||
super(
|
|
||||||
down: false,
|
down: false,
|
||||||
pressure: 0.0,
|
pressure: 0.0,
|
||||||
);
|
);
|
||||||
@@ -1156,7 +1153,9 @@ class PointerEnterEvent extends PointerEvent with _PointerEventDescription, _Cop
|
|||||||
super.down,
|
super.down,
|
||||||
super.synthesized,
|
super.synthesized,
|
||||||
super.embedderId,
|
super.embedderId,
|
||||||
}) : assert(!identical(kind, PointerDeviceKind.trackpad)),
|
}) : // Dart doesn't support comparing enums with == in const contexts yet.
|
||||||
|
// https://github.com/dart-lang/language/issues/1811
|
||||||
|
assert(!identical(kind, PointerDeviceKind.trackpad)),
|
||||||
super(
|
super(
|
||||||
pressure: 0.0,
|
pressure: 0.0,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -844,6 +844,17 @@ void main() {
|
|||||||
expect(event.synthesized, empty.synthesized);
|
expect(event.synthesized, empty.synthesized);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Ensure certain event types are allowed', () {
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/107962
|
||||||
|
expect(const PointerHoverEvent(kind: PointerDeviceKind.trackpad), isNotNull);
|
||||||
|
|
||||||
|
// The test passes if it compiles.
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Ensure certain event types are not allowed', () {
|
||||||
|
expect(() => PointerDownEvent(kind: PointerDeviceKind.trackpad), throwsAssertionError);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _expectTransformedEvent({
|
void _expectTransformedEvent({
|
||||||
|
|||||||
Reference in New Issue
Block a user