| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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> initPlugin() {
- throw UnimplementedError();
- }
- @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();
- }
- @override
- Future<bool> isDefaultKeyboard() {
- 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');
- });
- }
|