mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
808 B
38 lines
808 B
import 'package:flutter/services.dart';
|
|
import 'package:meta/meta.dart';
|
|
import 'package:mocktail/mocktail.dart';
|
|
|
|
import 'helpers.dart';
|
|
|
|
@isTest
|
|
void testRawKeyUpEvents(
|
|
List<LogicalKeyboardKey> keys,
|
|
Function(RawKeyUpEvent) test,
|
|
) {
|
|
for (final key in keys) {
|
|
test(_mockKeyUpEvent(key));
|
|
}
|
|
}
|
|
|
|
RawKeyUpEvent _mockKeyUpEvent(LogicalKeyboardKey key) {
|
|
final event = MockRawKeyUpEvent();
|
|
when(() => event.logicalKey).thenReturn(key);
|
|
return event;
|
|
}
|
|
|
|
@isTest
|
|
void testRawKeyDownEvents(
|
|
List<LogicalKeyboardKey> keys,
|
|
Function(RawKeyDownEvent) test,
|
|
) {
|
|
for (final key in keys) {
|
|
test(_mockKeyDownEvent(key));
|
|
}
|
|
}
|
|
|
|
RawKeyDownEvent _mockKeyDownEvent(LogicalKeyboardKey key) {
|
|
final event = MockRawKeyDownEvent();
|
|
when(() => event.logicalKey).thenReturn(key);
|
|
return event;
|
|
}
|