From cc6af7fafe3297382da06e8da97fb800f607af11 Mon Sep 17 00:00:00 2001 From: commitimpush Date: Thu, 1 Sep 2022 14:35:38 +0200 Subject: [PATCH] something --- .flutter-plugins-dependencies | 2 +- example/.gitignore | 2 +- example/lib/main.dart | 4 +++- example/test/main_test.dart | 23 +++++++++++++++++++++++ lib/src/ui/image_picker_ui.dart | 1 + 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 example/test/main_test.dart diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 7d69a8a..b947bc2 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_ios-0.8.5+6\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.7\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_android-0.8.5+2\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.1.8\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]}],"date_created":"2022-09-01 11:06:25.920284","version":"3.0.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_ios-0.8.5+6\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.7\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_android-0.8.5+2\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.1.8\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]}],"date_created":"2022-09-01 12:25:01.884569","version":"3.0.5"} \ No newline at end of file diff --git a/example/.gitignore b/example/.gitignore index a8e938c..79cf399 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -19,7 +19,7 @@ migrate_working_dir/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ diff --git a/example/lib/main.dart b/example/lib/main.dart index be8ead6..0b6a9ea 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -77,7 +77,9 @@ class _ImagePickerExampleHomePageState ), SizedBox(height: whiteSpace / 2), ElevatedButton( - onPressed: pickImage, child: const Text('Pick Image')), + onPressed: pickImage, + key: const Key("PickImageButton"), + child: const Text('Pick Image')), SizedBox(height: whiteSpace), ], ), diff --git a/example/test/main_test.dart b/example/test/main_test.dart new file mode 100644 index 0000000..958b189 --- /dev/null +++ b/example/test/main_test.dart @@ -0,0 +1,23 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../lib/main.dart'; + +void main() { + testWidgets("Test Main widget", ((WidgetTester tester) async { + // Initialization + final openImagePickerButton = find.byKey(const ValueKey("PickImageButton")); + + // Execute Test + await tester.pumpWidget(const MaterialApp( + home: + ImagePickerExampleHomePage(title: 'Flutter Image Picker Example'))); + await tester.tap(openImagePickerButton); + await tester.pump(); + + // Check Result + // expect(, findsOneWidget); + })); +} diff --git a/lib/src/ui/image_picker_ui.dart b/lib/src/ui/image_picker_ui.dart index 28c965b..5ff221a 100644 --- a/lib/src/ui/image_picker_ui.dart +++ b/lib/src/ui/image_picker_ui.dart @@ -91,6 +91,7 @@ class ImagePickerUI { mainAxisSize: MainAxisSize.min, children: [ IconButton( + key: Key(bottomText), icon: Icon(icon), iconSize: iconSize, onPressed: () => _imagePickerService.pickImage(imageSource, context),