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
044dfdb4
Unverified
Commit
044dfdb4
authored
Apr 19, 2018
by
Jacob Richman
Committed by
GitHub
Apr 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak theme_test so it passes when --track-widget-creation is used. (#16717)
parent
ec7b46e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
22 deletions
+9
-22
theme_test.dart
packages/flutter/test/material/theme_test.dart
+9
-22
No files found.
packages/flutter/test/material/theme_test.dart
View file @
044dfdb4
...
@@ -299,43 +299,30 @@ void main() {
...
@@ -299,43 +299,30 @@ void main() {
testBuildCalled
=
0
;
testBuildCalled
=
0
;
ThemeData
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF000000
));
ThemeData
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF000000
));
await
tester
.
pumpWidget
(
Widget
buildTheme
()
{
new
Theme
(
return
new
Theme
(
data:
themeData
,
data:
themeData
,
child:
const
Test
(),
child:
const
Test
(),
),
);
);
}
await
tester
.
pumpWidget
(
buildTheme
());
expect
(
testBuildCalled
,
1
);
expect
(
testBuildCalled
,
1
);
// Pump the same widgets again.
// Pump the same widgets again.
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
buildTheme
());
new
Theme
(
data:
themeData
,
child:
const
Test
(),
),
);
// No repeated build calls to the child since it's the same theme data.
// No repeated build calls to the child since it's the same theme data.
expect
(
testBuildCalled
,
1
);
expect
(
testBuildCalled
,
1
);
// New instance of theme data but still the same content.
// New instance of theme data but still the same content.
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF000000
));
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF000000
));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
buildTheme
());
new
Theme
(
data:
themeData
,
child:
const
Test
(),
),
);
// Still no repeated calls.
// Still no repeated calls.
expect
(
testBuildCalled
,
1
);
expect
(
testBuildCalled
,
1
);
// Different now.
// Different now.
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF222222
));
themeData
=
new
ThemeData
(
primaryColor:
const
Color
(
0xFF222222
));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
buildTheme
());
new
Theme
(
data:
themeData
,
child:
const
Test
(),
),
);
// Should call build again.
// Should call build again.
expect
(
testBuildCalled
,
2
);
expect
(
testBuildCalled
,
2
);
},
},
...
...
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