| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import 'package:flutter_test/flutter_test.dart';
- import 'package:keyboard_android/keyboard_android.dart';
- import 'package:keyboard_android/keyboard_android_platform_interface.dart';
- import 'package:keyboard_android/keyboard_android_method_channel.dart';
- import 'package:plugin_platform_interface/plugin_platform_interface.dart';
- class MockKeyboardAndroidPlatform
- with MockPlatformInterfaceMixin
- implements KeyboardAndroidPlatform {
- @override
- Future<String?> getPlatformVersion() => Future.value('42');
- @override
- Future<void> enableFloatingWindow(bool enable) {
- throw UnimplementedError();
- }
- @override
- Future<bool> isTargetKeyboardEnabled() {
- throw UnimplementedError();
- }
- @override
- Future<void> openInputMethodSettings() {
- throw UnimplementedError();
- }
- @override
- Future<bool> hasFloatingWindowPermission() {
- throw UnimplementedError();
- }
- @override
- void jumpFloatingWindowSetting() {
- throw UnimplementedError();
- }
- }
- void main() {
- final KeyboardAndroidPlatform initialPlatform =
- KeyboardAndroidPlatform.instance;
- test('$MethodChannelKeyboardAndroid is the default instance', () {
- expect(initialPlatform, isInstanceOf<MethodChannelKeyboardAndroid>());
- });
- test('getPlatformVersion', () async {
- KeyboardAndroid keyboardAndroidPlugin = KeyboardAndroid();
- MockKeyboardAndroidPlatform fakePlatform = MockKeyboardAndroidPlatform();
- KeyboardAndroidPlatform.instance = fakePlatform;
- expect(await keyboardAndroidPlugin.getPlatformVersion(), '42');
- });
- }
|