Skip to content

Commit 4d438d6

Browse files
committed
Implementando testes || Do 16 ao 35
1 parent a1cce38 commit 4d438d6

File tree

7 files changed

+162
-124
lines changed

7 files changed

+162
-124
lines changed

android/settings_aar.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ':app'

integration_test/app_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import 'package:flutter/material.dart';
99
import 'package:flutter_test/flutter_test.dart';
10-
import 'package:integration_test/integration_test.dart';
10+
//import 'package:integration_test/integration_test.dart';
1111

1212
import 'package:studying_widget_test/main.dart' as app;
1313

integration_test/driver.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
//
44
// flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart
55

6-
import 'package:integration_test/integration_test_driver.dart';
6+
//import 'package:integration_test/integration_test_driver.dart';
77

8-
Future<void> main() => integrationDriver();
8+
//Future<void> main() => integrationDriver();

lib/main.dart

+91-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart';
23
import 'package:flutter/rendering.dart';
34

@@ -55,6 +56,7 @@ class MyHomePage extends StatefulWidget {
5556

5657
class _MyHomePageState extends State<MyHomePage> {
5758
int _counter = 0;
59+
bool visible = true;
5860

5961
void _incrementCounter() {
6062
setState(() {
@@ -117,10 +119,18 @@ class _MyHomePageState extends State<MyHomePage> {
117119
type: MaterialType.transparency,
118120
child: const SizedBox(width: 100.0, height: 100.0),
119121
),
122+
Card(
123+
child: Container(
124+
key: Key('2-18'),
125+
),
126+
),
120127
],
121128
)),
122129
floatingActionButton: FloatingActionButton(
123-
onPressed: _incrementCounter,
130+
onPressed: () async {
131+
await Navigator.of(context)
132+
.push(MaterialPageRoute(builder: (context) => MyOtherPage()));
133+
},
124134
tooltip: 'Increment',
125135
child: Icon(Icons.add),
126136
), // This trailing comma makes auto-formatting nicer for build methods.
@@ -133,3 +143,83 @@ class _MyHomePageState extends State<MyHomePage> {
133143
);
134144
}
135145
}
146+
147+
//Exemplo abaixo retirado de: https://github.com/flutter/flutter/blob/de884f1afe1daa12def5ecaa08ab03e6af406d39/packages/flutter/test/cupertino/scaffold_test.dart
148+
//Para estudar o teste isOffstage
149+
class MyOtherPage extends StatelessWidget {
150+
MyOtherPage({Key key}) : super(key: key);
151+
152+
// This widget is the home page of your application. It is stateful, meaning
153+
// that it has a State object (defined below) that contains fields that affect
154+
// how it looks.
155+
156+
// This class is the configuration for the state. It holds the values (in this
157+
// case the title) provided by the parent (in this case the App widget) and
158+
// used by the build method of the State. Fields in a Widget subclass are
159+
// always marked "final".
160+
@override
161+
Widget build(BuildContext context) {
162+
// This method is rerun every time setState is called, for instance as done
163+
// by the _incrementCounter method above.
164+
//
165+
// The Flutter framework has been optimized to make rerunning build methods
166+
// fast, so that you can just rebuild anything that needs updating rather
167+
// than having to individually change instances of widgets.
168+
return Scaffold(
169+
appBar: AppBar(),
170+
body: CupertinoTabScaffold(
171+
tabBar: CupertinoTabBar(
172+
items: <BottomNavigationBarItem>[
173+
BottomNavigationBarItem(
174+
icon: Icon(Icons.water_damage),
175+
label: 'Tab 1',
176+
),
177+
BottomNavigationBarItem(
178+
icon: Icon(Icons.home),
179+
label: 'Tab 2',
180+
),
181+
],
182+
),
183+
tabBuilder: (context, index) {
184+
// For 1-indexed readability.
185+
++index;
186+
return CupertinoTabView(
187+
builder: (BuildContext context) {
188+
return CupertinoPageScaffold(
189+
navigationBar: CupertinoNavigationBar(
190+
middle: Text('Page 1 of tab $index'),
191+
),
192+
child: Center(
193+
child: CupertinoButton(
194+
child: const Text('Next'),
195+
onPressed: () {
196+
Navigator.of(context).push(
197+
CupertinoPageRoute<void>(
198+
builder: (BuildContext context) {
199+
return CupertinoPageScaffold(
200+
navigationBar: CupertinoNavigationBar(
201+
middle: Text('Page 2 of tab $index'),
202+
),
203+
child: Center(
204+
child: CupertinoButton(
205+
child: const Text('Back'),
206+
onPressed: () {
207+
Navigator.of(context).pop();
208+
},
209+
),
210+
),
211+
);
212+
},
213+
),
214+
);
215+
},
216+
),
217+
),
218+
);
219+
},
220+
);
221+
},
222+
),
223+
);
224+
}
225+
}

pubspec.lock

-102
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
5-
dependency: transitive
6-
description:
7-
name: archive
8-
url: "https://pub.dartlang.org"
9-
source: hosted
10-
version: "2.0.13"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.6.0"
184
async:
195
dependency: transitive
206
description:
@@ -57,20 +43,6 @@ packages:
5743
url: "https://pub.dartlang.org"
5844
source: hosted
5945
version: "1.15.0-nullsafety.5"
60-
convert:
61-
dependency: transitive
62-
description:
63-
name: convert
64-
url: "https://pub.dartlang.org"
65-
source: hosted
66-
version: "2.1.1"
67-
crypto:
68-
dependency: transitive
69-
description:
70-
name: crypto
71-
url: "https://pub.dartlang.org"
72-
source: hosted
73-
version: "2.1.5"
7446
cupertino_icons:
7547
dependency: "direct main"
7648
description:
@@ -85,47 +57,16 @@ packages:
8557
url: "https://pub.dartlang.org"
8658
source: hosted
8759
version: "1.2.0-nullsafety.3"
88-
file:
89-
dependency: transitive
90-
description:
91-
name: file
92-
url: "https://pub.dartlang.org"
93-
source: hosted
94-
version: "6.0.0-nullsafety.4"
9560
flutter:
9661
dependency: "direct main"
9762
description: flutter
9863
source: sdk
9964
version: "0.0.0"
100-
flutter_driver:
101-
dependency: transitive
102-
description: flutter
103-
source: sdk
104-
version: "0.0.0"
10565
flutter_test:
10666
dependency: "direct dev"
10767
description: flutter
10868
source: sdk
10969
version: "0.0.0"
110-
fuchsia_remote_debug_protocol:
111-
dependency: transitive
112-
description: flutter
113-
source: sdk
114-
version: "0.0.0"
115-
integration_test:
116-
dependency: "direct dev"
117-
description:
118-
name: integration_test
119-
url: "https://pub.dartlang.org"
120-
source: hosted
121-
version: "1.0.1"
122-
json_rpc_2:
123-
dependency: transitive
124-
description:
125-
name: json_rpc_2
126-
url: "https://pub.dartlang.org"
127-
source: hosted
128-
version: "2.2.2"
12970
matcher:
13071
dependency: transitive
13172
description:
@@ -147,20 +88,6 @@ packages:
14788
url: "https://pub.dartlang.org"
14889
source: hosted
14990
version: "1.8.0-nullsafety.3"
150-
platform:
151-
dependency: transitive
152-
description:
153-
name: platform
154-
url: "https://pub.dartlang.org"
155-
source: hosted
156-
version: "3.0.0-nullsafety.4"
157-
process:
158-
dependency: transitive
159-
description:
160-
name: process
161-
url: "https://pub.dartlang.org"
162-
source: hosted
163-
version: "4.0.0-nullsafety.4"
16491
sky_engine:
16592
dependency: transitive
16693
description: flutter
@@ -194,13 +121,6 @@ packages:
194121
url: "https://pub.dartlang.org"
195122
source: hosted
196123
version: "1.1.0-nullsafety.3"
197-
sync_http:
198-
dependency: transitive
199-
description:
200-
name: sync_http
201-
url: "https://pub.dartlang.org"
202-
source: hosted
203-
version: "0.2.0"
204124
term_glyph:
205125
dependency: transitive
206126
description:
@@ -229,27 +149,5 @@ packages:
229149
url: "https://pub.dartlang.org"
230150
source: hosted
231151
version: "2.1.0-nullsafety.5"
232-
vm_service:
233-
dependency: transitive
234-
description:
235-
name: vm_service
236-
url: "https://pub.dartlang.org"
237-
source: hosted
238-
version: "5.5.0"
239-
web_socket_channel:
240-
dependency: transitive
241-
description:
242-
name: web_socket_channel
243-
url: "https://pub.dartlang.org"
244-
source: hosted
245-
version: "1.1.0"
246-
webdriver:
247-
dependency: transitive
248-
description:
249-
name: webdriver
250-
url: "https://pub.dartlang.org"
251-
source: hosted
252-
version: "2.1.2"
253152
sdks:
254153
dart: ">=2.12.0-0.0 <3.0.0"
255-
flutter: ">=1.12.13+hotfix.5 <2.0.0"

pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies:
3030
cupertino_icons:
3131

3232
dev_dependencies:
33-
integration_test:
3433
flutter_test:
3534
sdk: flutter
3635

0 commit comments

Comments
 (0)