Browse Source
- 将splash路由路径从'/'改为'/splash'以提高可读性 - 修正user_portrait服务中的导入路径 - 删除已不再需要的测试文件newdev_shunjiawei
4 changed files with 2 additions and 58 deletions
@ -1,27 +0,0 @@ |
|||||
import 'package:flutter/services.dart'; |
|
||||
import 'package:flutter_test/flutter_test.dart'; |
|
||||
import 'package:user_portrait/user_portrait_method_channel.dart'; |
|
||||
|
|
||||
void main() { |
|
||||
TestWidgetsFlutterBinding.ensureInitialized(); |
|
||||
|
|
||||
MethodChannelUserPortrait platform = MethodChannelUserPortrait(); |
|
||||
const MethodChannel channel = MethodChannel('user_portrait'); |
|
||||
|
|
||||
setUp(() { |
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( |
|
||||
channel, |
|
||||
(MethodCall methodCall) async { |
|
||||
return '42'; |
|
||||
}, |
|
||||
); |
|
||||
}); |
|
||||
|
|
||||
tearDown(() { |
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null); |
|
||||
}); |
|
||||
|
|
||||
test('getPlatformVersion', () async { |
|
||||
expect(await platform.getPlatformVersion(), '42'); |
|
||||
}); |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
import 'package:flutter_test/flutter_test.dart'; |
|
||||
import 'package:user_portrait/user_portrait.dart'; |
|
||||
import 'package:user_portrait/user_portrait_platform_interface.dart'; |
|
||||
import 'package:user_portrait/user_portrait_method_channel.dart'; |
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
|
||||
|
|
||||
class MockUserPortraitPlatform |
|
||||
with MockPlatformInterfaceMixin |
|
||||
implements UserPortraitPlatform { |
|
||||
|
|
||||
@override |
|
||||
Future<String?> getPlatformVersion() => Future.value('42'); |
|
||||
} |
|
||||
|
|
||||
void main() { |
|
||||
final UserPortraitPlatform initialPlatform = UserPortraitPlatform.instance; |
|
||||
|
|
||||
test('$MethodChannelUserPortrait is the default instance', () { |
|
||||
expect(initialPlatform, isInstanceOf<MethodChannelUserPortrait>()); |
|
||||
}); |
|
||||
|
|
||||
test('getPlatformVersion', () async { |
|
||||
UserPortrait userPortraitPlugin = UserPortrait(); |
|
||||
MockUserPortraitPlatform fakePlatform = MockUserPortraitPlatform(); |
|
||||
UserPortraitPlatform.instance = fakePlatform; |
|
||||
|
|
||||
expect(await userPortraitPlugin.getPlatformVersion(), '42'); |
|
||||
}); |
|
||||
} |
|
||||
Loading…
Reference in new issue