Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8f708bfb
Commit
8f708bfb
authored
Jan 12, 2017
by
Adam Barth
Committed by
GitHub
Jan 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test AboutDrawerItem (#7453)
Also, fix a few minor bugs found by the test.
parent
a8cd2125
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
12 deletions
+106
-12
licenses.dart
packages/flutter/lib/src/foundation/licenses.dart
+1
-1
about.dart
packages/flutter/lib/src/material/about.dart
+2
-0
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+1
-4
about_test.dart
packages/flutter/test/material/about_test.dart
+97
-0
binding.dart
packages/flutter_test/lib/src/binding.dart
+1
-2
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+4
-5
No files found.
packages/flutter/lib/src/foundation/licenses.dart
View file @
8f708bfb
...
@@ -286,4 +286,4 @@ class LicenseRegistry {
...
@@ -286,4 +286,4 @@ class LicenseRegistry {
for
(
LicenseEntryCollector
collector
in
_collectors
)
for
(
LicenseEntryCollector
collector
in
_collectors
)
yield
*
collector
();
yield
*
collector
();
}
}
}
}
\ No newline at end of file
packages/flutter/lib/src/material/about.dart
View file @
8f708bfb
...
@@ -379,6 +379,8 @@ class _LicensePageState extends State<LicensePage> {
...
@@ -379,6 +379,8 @@ class _LicensePageState extends State<LicensePage> {
Future
<
Null
>
_initLicenses
()
async
{
Future
<
Null
>
_initLicenses
()
async
{
await
for
(
LicenseEntry
license
in
LicenseRegistry
.
licenses
)
{
await
for
(
LicenseEntry
license
in
LicenseRegistry
.
licenses
)
{
if
(!
mounted
)
return
;
setState
(()
{
setState
(()
{
_licenses
.
add
(
new
Padding
(
_licenses
.
add
(
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
18.0
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
18.0
),
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
8f708bfb
...
@@ -133,10 +133,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -133,10 +133,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
@override
@override
void
dispose
()
{
void
dispose
()
{
_historyEntry
?.
remove
();
_historyEntry
?.
remove
();
_controller
_controller
.
dispose
();
..
removeListener
(
_animationChanged
)
..
removeStatusListener
(
_animationStatusChanged
)
..
stop
();
super
.
dispose
();
super
.
dispose
();
}
}
...
...
packages/flutter/test/material/about_test.dart
0 → 100644
View file @
8f708bfb
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'AboutDrawerItem control test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MaterialApp
(
title:
'Pirate app'
,
home:
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'Home'
),
),
drawer:
new
Drawer
(
child:
new
Block
(
children:
<
Widget
>[
new
AboutDrawerItem
(
applicationVersion:
'0.1.2'
,
applicationIcon:
new
FlutterLogo
(),
applicationLegalese:
'I am the very model of a modern major general.'
,
aboutBoxChildren:
<
Widget
>[
new
Text
(
'About box'
),
]
),
],
),
),
),
),
);
expect
(
find
.
text
(
'About Pirate app'
),
findsNothing
);
expect
(
find
.
text
(
'0.1.2'
),
findsNothing
);
expect
(
find
.
text
(
'About box'
),
findsNothing
);
await
tester
.
tap
(
find
.
byType
(
IconButton
));
await
tester
.
pumpUntilNoTransientCallbacks
(
const
Duration
(
milliseconds:
100
));
expect
(
find
.
text
(
'About Pirate app'
),
findsOneWidget
);
expect
(
find
.
text
(
'0.1.2'
),
findsNothing
);
expect
(
find
.
text
(
'About box'
),
findsNothing
);
await
tester
.
tap
(
find
.
text
(
'About Pirate app'
));
await
tester
.
pumpUntilNoTransientCallbacks
(
const
Duration
(
milliseconds:
100
));
expect
(
find
.
text
(
'About Pirate app'
),
findsOneWidget
);
expect
(
find
.
text
(
'0.1.2'
),
findsOneWidget
);
expect
(
find
.
text
(
'About box'
),
findsOneWidget
);
LicenseRegistry
.
addLicense
(()
{
return
new
Stream
<
LicenseEntry
>.
fromIterable
(<
LicenseEntry
>[
new
LicenseEntryWithLineBreaks
(<
String
>[
'Pirate package '
],
'Pirate license'
)
]);
});
await
tester
.
tap
(
find
.
text
(
'VIEW LICENSES'
));
await
tester
.
pumpUntilNoTransientCallbacks
(
const
Duration
(
milliseconds:
100
));
expect
(
find
.
text
(
'Pirate license'
),
findsOneWidget
);
});
testWidgets
(
'AboutDrawerItem control test'
,
(
WidgetTester
tester
)
async
{
List
<
String
>
log
=
<
String
>[];
Future
<
Null
>
licenseFuture
;
LicenseRegistry
.
addLicense
(()
{
log
.
add
(
'license1'
);
licenseFuture
=
tester
.
pumpWidget
(
new
Container
());
return
new
Stream
<
LicenseEntry
>.
fromIterable
(<
LicenseEntry
>[]);
});
LicenseRegistry
.
addLicense
(()
{
log
.
add
(
'license2'
);
return
new
Stream
<
LicenseEntry
>.
fromIterable
(<
LicenseEntry
>[
new
LicenseEntryWithLineBreaks
(<
String
>[
'Another package '
],
'Another license'
)
]);
});
await
tester
.
pumpWidget
(
new
Center
(
child:
new
LicensePage
()
));
expect
(
licenseFuture
,
isNotNull
);
await
licenseFuture
;
// We should not hit an exception here.
await
tester
.
idle
();
expect
(
log
,
equals
(<
String
>[
'license1'
,
'license2'
]));
});
}
packages/flutter_test/lib/src/binding.dart
View file @
8f708bfb
...
@@ -11,7 +11,6 @@ import 'package:flutter/gestures.dart';
...
@@ -11,7 +11,6 @@ import 'package:flutter/gestures.dart';
import
'package:flutter/http.dart'
as
http
;
import
'package:flutter/http.dart'
as
http
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:quiver/testing/async.dart'
;
import
'package:quiver/testing/async.dart'
;
...
@@ -84,8 +83,8 @@ const Size _kDefaultTestViewportSize = const Size(800.0, 600.0);
...
@@ -84,8 +83,8 @@ const Size _kDefaultTestViewportSize = const Size(800.0, 600.0);
abstract
class
TestWidgetsFlutterBinding
extends
BindingBase
abstract
class
TestWidgetsFlutterBinding
extends
BindingBase
with
SchedulerBinding
,
with
SchedulerBinding
,
GestureBinding
,
GestureBinding
,
ServicesBinding
,
RendererBinding
,
RendererBinding
,
// Services binding omitted to avoid dragging in the licenses code.
WidgetsBinding
{
WidgetsBinding
{
/// Creates and initializes the binding. This function is
/// Creates and initializes the binding. This function is
/// idempotent; calling it a second time will just return the
/// idempotent; calling it a second time will just return the
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
8f708bfb
...
@@ -8,7 +8,6 @@ import 'package:flutter/gestures.dart';
...
@@ -8,7 +8,6 @@ import 'package:flutter/gestures.dart';
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:meta/meta.dart'
;
import
'package:test/test.dart'
as
test_package
;
import
'package:test/test.dart'
as
test_package
;
import
'all_elements.dart'
;
import
'all_elements.dart'
;
...
@@ -213,10 +212,10 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -213,10 +212,10 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
///
///
/// Alternatively, one can check that the return value from this function
/// Alternatively, one can check that the return value from this function
/// matches the expected number of pumps.
/// matches the expected number of pumps.
Future
<
int
>
pumpUntilNoTransientCallbacks
(
[
Future
<
int
>
pumpUntilNoTransientCallbacks
(
@required
Duration
duration
,
Duration
duration
,
[
EnginePhase
phase
=
EnginePhase
.
sendSemanticsTree
EnginePhase
phase
=
EnginePhase
.
sendSemanticsTree
])
{
])
{
assert
(
duration
!=
null
);
assert
(
duration
!=
null
);
assert
(
duration
>
Duration
.
ZERO
);
assert
(
duration
>
Duration
.
ZERO
);
int
count
=
0
;
int
count
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment