8
8
import 'package:app/home_page.dart' ;
9
9
import 'package:flutter/material.dart' ;
10
10
import 'package:flutter_quill/flutter_quill.dart' ;
11
+ import 'package:flutter_quill_extensions/embeds/toolbar/image_button.dart' ;
11
12
import 'package:flutter_test/flutter_test.dart' ;
12
13
import 'package:flutter_quill/flutter_quill_test.dart' ;
13
14
@@ -26,9 +27,11 @@ void main() {
26
27
when (platformServiceMock.isWebPlatform ()).thenAnswer ((_) => false );
27
28
28
29
// Build our app and trigger a frame.
29
- await tester.pumpWidget (App (
30
- platformService: platformServiceMock,
31
- ),);
30
+ await tester.pumpWidget (
31
+ App (
32
+ platformService: platformServiceMock,
33
+ ),
34
+ );
32
35
await tester.pumpAndSettle ();
33
36
34
37
// Expect to find the normal page setup
@@ -40,6 +43,35 @@ void main() {
40
43
await tester.pumpAndSettle ();
41
44
});
42
45
46
+ testWidgets ('Select image' , (WidgetTester tester) async {
47
+ final platformServiceMock = MockPlatformService ();
48
+
49
+ // Platform is mobile
50
+ when (platformServiceMock.isWebPlatform ()).thenAnswer ((_) => false );
51
+
52
+ // Build our app and trigger a frame.
53
+ await tester.pumpWidget (
54
+ App (
55
+ platformService: platformServiceMock,
56
+ ),
57
+ );
58
+ await tester.pumpAndSettle ();
59
+
60
+ // Expect to find the normal page setup
61
+ expect (find.text ('Flutter Quill' ), findsOneWidget);
62
+
63
+ // Enter 'hi' into Quill Editor.
64
+ await tester.tap (find.byType (QuillEditor ));
65
+ await tester.quillEnterText (find.byType (QuillEditor ), 'hi\n ' );
66
+ await tester.pumpAndSettle ();
67
+
68
+ final imageButton = find.byType (ImageButton );
69
+ await tester.tap (imageButton);
70
+ await tester.pumpAndSettle ();
71
+
72
+ //TODO add image picker
73
+ });
74
+
43
75
testWidgets ('Normal setup (web version)' , (WidgetTester tester) async {
44
76
tester.view.physicalSize = const Size (400 , 600 );
45
77
tester.view.devicePixelRatio = 1.0 ;
@@ -49,9 +81,11 @@ void main() {
49
81
when (platformServiceMock.isWebPlatform ()).thenAnswer ((_) => true );
50
82
51
83
// Build our app and trigger a frame.
52
- await tester.pumpWidget (App (
53
- platformService: platformServiceMock,
54
- ),);
84
+ await tester.pumpWidget (
85
+ App (
86
+ platformService: platformServiceMock,
87
+ ),
88
+ );
55
89
await tester.pumpAndSettle ();
56
90
57
91
// Expect to find the normal page setup
0 commit comments