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();
  }

  @override
  void updateKeyboardInfo(String keyboardInfoJson) {
    throw UnimplementedError();
  }

  @override
  void refreshCharacterList() {
    throw UnimplementedError();
  }

  @override
  void refreshData() {
    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');
  });
}
