File tree 4 files changed +24
-2
lines changed
packages/image_picker/image_picker 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
+
1
5
## 0.6.7+18
2
6
3
7
* 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.
27
27
class ImagePicker {
28
28
/// The platform interface that drives this plugin
29
29
@visibleForTesting
30
- static ImagePickerPlatform platform = ImagePickerPlatform .instance;
30
+ static ImagePickerPlatform get platform => ImagePickerPlatform .instance;
31
31
32
32
/// Returns a [File] object pointing to the image that was picked.
33
33
///
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: image_picker
2
2
description : Flutter plugin for selecting images from the Android and iOS image
3
3
library, and taking new pictures with the camera.
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
5
- version : 0.6.7+18
5
+ version : 0.6.7+19
6
6
7
7
flutter :
8
8
plugin :
@@ -25,7 +25,9 @@ dev_dependencies:
25
25
sdk : flutter
26
26
integration_test :
27
27
path : ../../integration_test
28
+ mockito : ^4.1.3
28
29
pedantic : ^1.8.0
30
+ plugin_platform_interface : ^1.0.3
29
31
30
32
environment :
31
33
sdk : " >=2.1.0 <3.0.0"
Original file line number Diff line number Diff line change 5
5
import 'package:flutter/services.dart' ;
6
6
import 'package:flutter_test/flutter_test.dart' ;
7
7
import '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' ;
8
11
9
12
void main () {
10
13
TestWidgetsFlutterBinding .ensureInitialized ();
@@ -26,6 +29,15 @@ void main() {
26
29
log.clear ();
27
30
});
28
31
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
+
29
41
group ('#pickImage' , () {
30
42
test ('passes the image source argument correctly' , () async {
31
43
await picker.getImage (source: ImageSource .camera);
@@ -336,3 +348,7 @@ void main() {
336
348
});
337
349
});
338
350
}
351
+
352
+ class MockPlatform extends Mock
353
+ with MockPlatformInterfaceMixin
354
+ implements ImagePickerPlatform {}
You can’t perform that action at this time.
0 commit comments