Unverified Commit 044dfdb4 authored by Jacob Richman's avatar Jacob Richman Committed by GitHub

Tweak theme_test so it passes when --track-widget-creation is used. (#16717)

parent ec7b46e3
......@@ -299,43 +299,30 @@ void main() {
testBuildCalled = 0;
ThemeData themeData = new ThemeData(primaryColor: const Color(0xFF000000));
await tester.pumpWidget(
new Theme(
Widget buildTheme() {
return new Theme(
data: themeData,
child: const Test(),
),
);
);
}
await tester.pumpWidget(buildTheme());
expect(testBuildCalled, 1);
// Pump the same widgets again.
await tester.pumpWidget(
new Theme(
data: themeData,
child: const Test(),
),
);
await tester.pumpWidget(buildTheme());
// No repeated build calls to the child since it's the same theme data.
expect(testBuildCalled, 1);
// New instance of theme data but still the same content.
themeData = new ThemeData(primaryColor: const Color(0xFF000000));
await tester.pumpWidget(
new Theme(
data: themeData,
child: const Test(),
),
);
await tester.pumpWidget(buildTheme());
// Still no repeated calls.
expect(testBuildCalled, 1);
// Different now.
themeData = new ThemeData(primaryColor: const Color(0xFF222222));
await tester.pumpWidget(
new Theme(
data: themeData,
child: const Test(),
),
);
await tester.pumpWidget(buildTheme());
// Should call build again.
expect(testBuildCalled, 2);
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment