Unverified Commit 86c9b8ea authored by droidbg's avatar droidbg Committed by GitHub

[leak-tracking] Add leak tracking in test/rendering -2 (#136310)

parent 8f14104c
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('Tracks picture layers accurately when painting is interleaved with a pushLayer', (WidgetTester tester) async { testWidgetsWithLeakTracking('Tracks picture layers accurately when painting is interleaved with a pushLayer', (WidgetTester tester) async {
// Creates a RenderObject that will paint into multiple picture layers. // Creates a RenderObject that will paint into multiple picture layers.
// Asserts that both layers get a handle, and that all layers get correctly // Asserts that both layers get a handle, and that all layers get correctly
// released. // released.
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('relayout boundary change does not trigger relayout', (WidgetTester tester) async { testWidgetsWithLeakTracking('relayout boundary change does not trigger relayout', (WidgetTester tester) async {
final RenderLayoutCount renderLayoutCount = RenderLayoutCount(); final RenderLayoutCount renderLayoutCount = RenderLayoutCount();
final Widget layoutCounter = Center( final Widget layoutCounter = Center(
key: GlobalKey(), key: GlobalKey(),
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('repaint boundary with constraint changes', (WidgetTester tester) async { testWidgetsWithLeakTracking('repaint boundary with constraint changes', (WidgetTester tester) async {
// Regression test for as https://github.com/flutter/flutter/issues/39151. // Regression test for as https://github.com/flutter/flutter/issues/39151.
await tester.pumpWidget(const RelayoutBoundariesCrash()); await tester.pumpWidget(const RelayoutBoundariesCrash());
tester.state<RelayoutBoundariesCrashState>(find.byType(RelayoutBoundariesCrash))._toggleMode(); tester.state<RelayoutBoundariesCrashState>(find.byType(RelayoutBoundariesCrash))._toggleMode();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
group('SystemChrome - style', () { group('SystemChrome - style', () {
...@@ -37,8 +38,7 @@ void main() { ...@@ -37,8 +38,7 @@ void main() {
}); });
group('status bar', () { group('status bar', () {
testWidgets( testWidgetsWithLeakTracking("statusBarColor isn't set for unannotated view",
"statusBarColor isn't set for unannotated view",
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(const SizedBox.expand()); await tester.pumpWidget(const SizedBox.expand());
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -47,8 +47,7 @@ void main() { ...@@ -47,8 +47,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking('statusBarColor is set for annotated view',
'statusBarColor is set for annotated view',
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>( await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
...@@ -67,8 +66,7 @@ void main() { ...@@ -67,8 +66,7 @@ void main() {
variant: TargetPlatformVariant.mobile(), variant: TargetPlatformVariant.mobile(),
); );
testWidgets( testWidgetsWithLeakTracking("statusBarColor isn't set when view covers less than half of the system status bar",
"statusBarColor isn't set when view covers less than half of the system status bar",
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
const double lessThanHalfOfTheStatusBarHeight = const double lessThanHalfOfTheStatusBarHeight =
...@@ -92,8 +90,7 @@ void main() { ...@@ -92,8 +90,7 @@ void main() {
variant: TargetPlatformVariant.mobile(), variant: TargetPlatformVariant.mobile(),
); );
testWidgets( testWidgetsWithLeakTracking('statusBarColor is set when view covers more than half of tye system status bar',
'statusBarColor is set when view covers more than half of tye system status bar',
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
const double moreThanHalfOfTheStatusBarHeight = const double moreThanHalfOfTheStatusBarHeight =
...@@ -122,8 +119,7 @@ void main() { ...@@ -122,8 +119,7 @@ void main() {
}); });
group('navigation color (Android only)', () { group('navigation color (Android only)', () {
testWidgets( testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for non Android device",
"systemNavigationBarColor isn't set for non Android device",
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>( await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
...@@ -142,8 +138,7 @@ void main() { ...@@ -142,8 +138,7 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.iOS), variant: TargetPlatformVariant.only(TargetPlatform.iOS),
); );
testWidgets( testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for unannotated view",
"systemNavigationBarColor isn't set for unannotated view",
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(const SizedBox.expand()); await tester.pumpWidget(const SizedBox.expand());
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -153,8 +148,7 @@ void main() { ...@@ -153,8 +148,7 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.android), variant: TargetPlatformVariant.only(TargetPlatform.android),
); );
testWidgets( testWidgetsWithLeakTracking('systemNavigationBarColor is set for annotated view',
'systemNavigationBarColor is set for annotated view',
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>( await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
...@@ -173,8 +167,7 @@ void main() { ...@@ -173,8 +167,7 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.android), variant: TargetPlatformVariant.only(TargetPlatform.android),
); );
testWidgets( testWidgetsWithLeakTracking("systemNavigationBarColor isn't set when view covers less than half of navigation bar",
"systemNavigationBarColor isn't set when view covers less than half of navigation bar",
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
const double lessThanHalfOfTheNavigationBarHeight = const double lessThanHalfOfTheNavigationBarHeight =
...@@ -198,8 +191,7 @@ void main() { ...@@ -198,8 +191,7 @@ void main() {
variant: TargetPlatformVariant.only(TargetPlatform.android), variant: TargetPlatformVariant.only(TargetPlatform.android),
); );
testWidgets( testWidgetsWithLeakTracking('systemNavigationBarColor is set when view covers more than half of navigation bar',
'systemNavigationBarColor is set when view covers more than half of navigation bar',
(WidgetTester tester) async { (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
const double moreThanHalfOfTheNavigationBarHeight = const double moreThanHalfOfTheNavigationBarHeight =
...@@ -227,7 +219,7 @@ void main() { ...@@ -227,7 +219,7 @@ void main() {
); );
}); });
testWidgets('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async { testWidgetsWithLeakTracking('Top AnnotatedRegion provides status bar overlay style and bottom AnnotatedRegion provides navigation bar overlay style', (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget( await tester.pumpWidget(
const Column(children: <Widget>[ const Column(children: <Widget>[
...@@ -253,7 +245,7 @@ void main() { ...@@ -253,7 +245,7 @@ void main() {
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.green); expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.green);
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); }, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgets('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async { testWidgetsWithLeakTracking('Top only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget( await tester.pumpWidget(
const Column(children: <Widget>[ const Column(children: <Widget>[
...@@ -273,7 +265,7 @@ void main() { ...@@ -273,7 +265,7 @@ void main() {
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.blue); expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.blue);
}, variant: TargetPlatformVariant.only(TargetPlatform.android)); }, variant: TargetPlatformVariant.only(TargetPlatform.android));
testWidgets('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async { testWidgetsWithLeakTracking('Bottom only AnnotatedRegion provides status bar and navigation bar style properties', (WidgetTester tester) async {
setupTestDevice(tester); setupTestDevice(tester);
await tester.pumpWidget( await tester.pumpWidget(
const Column(children: <Widget>[ const Column(children: <Widget>[
......
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