Unverified Commit c8a4c8b8 authored by Tong Mu's avatar Tong Mu Committed by GitHub

Pointer events: Allow hover events from trackpad (#108116)

parent fc3471fd
......@@ -1035,10 +1035,7 @@ class PointerHoverEvent extends PointerEvent with _PointerEventDescription, _Cop
super.tilt,
super.synthesized,
super.embedderId,
}) : // 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(
down: false,
pressure: 0.0,
);
......@@ -1156,7 +1153,9 @@ class PointerEnterEvent extends PointerEvent with _PointerEventDescription, _Cop
super.down,
super.synthesized,
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(
pressure: 0.0,
);
......
......@@ -844,6 +844,17 @@ void main() {
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({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment