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
9e1b4b22
Unverified
Commit
9e1b4b22
authored
Jul 01, 2019
by
Dan Field
Committed by
GitHub
Jul 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for about page (#35290)
parent
9c31f9f4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
1 deletion
+80
-1
licenses.dart
packages/flutter/lib/src/foundation/licenses.dart
+9
-0
about_test.dart
packages/flutter/test/material/about_test.dart
+71
-1
No files found.
packages/flutter/lib/src/foundation/licenses.dart
View file @
9e1b4b22
...
...
@@ -4,6 +4,8 @@
import
'dart:async'
;
import
'package:meta/meta.dart'
show
visibleForTesting
;
/// Signature for callbacks passed to [LicenseRegistry.addLicense].
typedef
LicenseEntryCollector
=
Stream
<
LicenseEntry
>
Function
();
...
...
@@ -306,4 +308,11 @@ class LicenseRegistry {
for
(
LicenseEntryCollector
collector
in
_collectors
)
yield
*
collector
();
}
/// Resets the internal state of [LicenseRegistry]. Intended for use in
/// testing.
@visibleForTesting
static
void
reset
()
{
_collectors
=
null
;
}
}
packages/flutter/test/material/about_test.dart
View file @
9e1b4b22
...
...
@@ -9,6 +9,10 @@ import 'package:flutter/material.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
tearDown
(()
{
LicenseRegistry
.
reset
();
});
testWidgets
(
'AboutListTile control test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -131,6 +135,72 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
tester
.
getTopLeft
(
find
.
text
(
'DEF'
)),
const
Offset
(
8.0
+
safeareaPadding
,
527.0
));
expect
(
tester
.
getTopLeft
(
find
.
text
(
'DEF'
)),
const
Offset
(
8.0
+
safeareaPadding
,
287.0
));
},
skip:
isBrowser
);
testWidgets
(
'LicensePage returns early if unmounted'
,
(
WidgetTester
tester
)
async
{
final
Completer
<
LicenseEntry
>
licenseCompleter
=
Completer
<
LicenseEntry
>();
LicenseRegistry
.
addLicense
(()
{
return
Stream
<
LicenseEntry
>.
fromFuture
(
licenseCompleter
.
future
);
});
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
LicensePage
(),
),
);
await
tester
.
pump
();
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Placeholder
(),
),
);
await
tester
.
pumpAndSettle
();
final
FakeLicenseEntry
licenseEntry
=
FakeLicenseEntry
();
licenseCompleter
.
complete
(
licenseEntry
);
expect
(
licenseEntry
.
paragraphsCalled
,
false
);
},
skip:
isBrowser
);
testWidgets
(
'LicensePage returns late if unmounted'
,
(
WidgetTester
tester
)
async
{
final
Completer
<
LicenseEntry
>
licenseCompleter
=
Completer
<
LicenseEntry
>();
LicenseRegistry
.
addLicense
(()
{
return
Stream
<
LicenseEntry
>.
fromFuture
(
licenseCompleter
.
future
);
});
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
LicensePage
(),
),
);
await
tester
.
pump
();
final
FakeLicenseEntry
licenseEntry
=
FakeLicenseEntry
();
licenseCompleter
.
complete
(
licenseEntry
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Placeholder
(),
),
);
await
tester
.
pumpAndSettle
();
expect
(
licenseEntry
.
paragraphsCalled
,
true
);
},
skip:
isBrowser
);
}
class
FakeLicenseEntry
extends
LicenseEntry
{
FakeLicenseEntry
();
bool
get
paragraphsCalled
=>
_paragraphsCalled
;
bool
_paragraphsCalled
=
false
;
@override
Iterable
<
String
>
packages
=
<
String
>[];
@override
Iterable
<
LicenseParagraph
>
get
paragraphs
{
_paragraphsCalled
=
true
;
return
<
LicenseParagraph
>[];
}
}
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