2023-04-04 04:50:22 +00:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart' as flutter_test;
|
|
|
|
|
|
|
|
class FlowyTestKeyboard {
|
2023-04-10 07:10:42 +00:00
|
|
|
static Future<void> simulateKeyDownEvent(
|
|
|
|
List<LogicalKeyboardKey> keys, {
|
|
|
|
required flutter_test.WidgetTester tester,
|
2024-05-23 03:07:09 +00:00
|
|
|
bool withKeyUp = false,
|
2023-04-10 07:10:42 +00:00
|
|
|
}) async {
|
2023-04-04 04:50:22 +00:00
|
|
|
for (final LogicalKeyboardKey key in keys) {
|
|
|
|
await flutter_test.simulateKeyDownEvent(key);
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
}
|
2024-05-23 03:07:09 +00:00
|
|
|
|
|
|
|
if (withKeyUp) {
|
|
|
|
for (final LogicalKeyboardKey key in keys) {
|
|
|
|
await flutter_test.simulateKeyUpEvent(key);
|
|
|
|
await tester.pumpAndSettle();
|
|
|
|
}
|
|
|
|
}
|
2023-04-04 04:50:22 +00:00
|
|
|
}
|
|
|
|
}
|