This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed
packages/image_picker/image_picker Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ ## 0.6.7+19
2+
3+ * Do not copy static field to another static field.
4+
15## 0.6.7+18
26
37* Fix outdated links across a number of markdown files ([ #3276 ] ( https://github.com/flutter/plugins/pull/3276 ) )
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export 'package:image_picker_platform_interface/image_picker_platform_interface.
2727class ImagePicker {
2828 /// The platform interface that drives this plugin
2929 @visibleForTesting
30- static ImagePickerPlatform platform = ImagePickerPlatform .instance;
30+ static ImagePickerPlatform get platform => ImagePickerPlatform .instance;
3131
3232 /// Returns a [File] object pointing to the image that was picked.
3333 ///
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: image_picker
22description : Flutter plugin for selecting images from the Android and iOS image
33 library, and taking new pictures with the camera.
44homepage : https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
5- version : 0.6.7+18
5+ version : 0.6.7+19
66
77flutter :
88 plugin :
@@ -25,7 +25,9 @@ dev_dependencies:
2525 sdk : flutter
2626 integration_test :
2727 path : ../../integration_test
28+ mockito : ^4.1.3
2829 pedantic : ^1.8.0
30+ plugin_platform_interface : ^1.0.3
2931
3032environment :
3133 sdk : " >=2.1.0 <3.0.0"
Original file line number Diff line number Diff line change 55import 'package:flutter/services.dart' ;
66import 'package:flutter_test/flutter_test.dart' ;
77import 'package:image_picker/image_picker.dart' ;
8+ import 'package:image_picker_platform_interface/image_picker_platform_interface.dart' ;
9+ import 'package:mockito/mockito.dart' ;
10+ import 'package:plugin_platform_interface/plugin_platform_interface.dart' ;
811
912void main () {
1013 TestWidgetsFlutterBinding .ensureInitialized ();
@@ -26,6 +29,15 @@ void main() {
2629 log.clear ();
2730 });
2831
32+ test ('ImagePicker platform instance overrides the actual platform used' ,
33+ () {
34+ final ImagePickerPlatform savedPlatform = ImagePickerPlatform .instance;
35+ final MockPlatform mockPlatform = MockPlatform ();
36+ ImagePickerPlatform .instance = mockPlatform;
37+ expect (ImagePicker .platform, mockPlatform);
38+ ImagePickerPlatform .instance = savedPlatform;
39+ });
40+
2941 group ('#pickImage' , () {
3042 test ('passes the image source argument correctly' , () async {
3143 await picker.getImage (source: ImageSource .camera);
@@ -336,3 +348,7 @@ void main() {
336348 });
337349 });
338350}
351+
352+ class MockPlatform extends Mock
353+ with MockPlatformInterfaceMixin
354+ implements ImagePickerPlatform {}
You can’t perform that action at this time.
0 commit comments