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
31a1886a
Commit
31a1886a
authored
Aug 26, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #842 from abarth/test_mimic
Add a basic test for Mimic tree movement
parents
46e3c47f
240e807f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
build_utils.dart
packages/unit/test/widget/build_utils.dart
+9
-0
mimic_test.dart
packages/unit/test/widget/mimic_test.dart
+74
-0
No files found.
packages/unit/test/widget/build_utils.dart
View file @
31a1886a
...
@@ -40,6 +40,15 @@ class WidgetTester {
...
@@ -40,6 +40,15 @@ class WidgetTester {
TestApp
_app
;
TestApp
_app
;
RenderView
_renderView
;
RenderView
_renderView
;
void
walkWidgets
(
WidgetTreeWalker
walker
)
{
void
walk
(
Widget
widget
)
{
walker
(
widget
);
widget
.
walkChildren
(
walk
);
}
_app
.
walkChildren
(
walk
);
}
void
pumpFrame
(
WidgetBuilder
builder
)
{
void
pumpFrame
(
WidgetBuilder
builder
)
{
_app
.
builder
=
builder
;
_app
.
builder
=
builder
;
Component
.
flushBuild
();
Component
.
flushBuild
();
...
...
packages/unit/test/widget/mimic_test.dart
0 → 100644
View file @
31a1886a
import
'package:sky/widgets.dart'
;
import
'package:test/test.dart'
;
import
'build_utils.dart'
;
void
main
(
)
{
test
(
'Mimic can track tree movements'
,
()
{
GlobalKey
globalKey
=
new
GlobalKey
();
WidgetTester
tester
=
new
WidgetTester
();
tester
.
pumpFrame
(()
{
return
new
Flex
([
new
Mimicable
(
key:
globalKey
,
child:
new
Container
(
key:
new
Key
.
stringify
(
'inner'
),
height:
10.0
,
width:
10.0
)
)
]);
});
bool
mimicReady
=
false
;
tester
.
pumpFrame
(()
{
return
new
Flex
([
new
Mimicable
(
key:
globalKey
,
child:
new
Container
(
height:
10.0
,
width:
10.0
)
),
new
SizedBox
(
height:
10.0
,
width:
10.0
,
child:
new
Mimic
(
original:
globalKey
,
onMimicReady:
()
{
mimicReady
=
true
;
}
)
)
]);
});
expect
(
mimicReady
,
isTrue
);
tester
.
pumpFrame
(()
{
return
new
Flex
([
new
Container
(
key:
new
Key
.
stringify
(
'outer'
),
height:
10.0
,
width:
10.0
,
child:
new
Mimicable
(
key:
globalKey
,
child:
new
Container
(
key:
new
Key
.
stringify
(
'inner'
),
height:
10.0
,
width:
10.0
)
)
),
new
SizedBox
(
height:
10.0
,
width:
10.0
,
child:
new
Mimic
(
original:
globalKey
)
)
]);
});
});
}
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