forked from firka/flutter
[leak-tracking] Add leak tracking in test/rendering -2 (#136310)
This commit is contained in:
@@ -5,9 +5,10 @@
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
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.
|
||||
// Asserts that both layers get a handle, and that all layers get correctly
|
||||
// released.
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
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 Widget layoutCounter = Center(
|
||||
key: GlobalKey(),
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
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.
|
||||
await tester.pumpWidget(const RelayoutBoundariesCrash());
|
||||
tester.state<RelayoutBoundariesCrashState>(find.byType(RelayoutBoundariesCrash))._toggleMode();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
void main() {
|
||||
group('SystemChrome - style', () {
|
||||
@@ -37,8 +38,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('status bar', () {
|
||||
testWidgets(
|
||||
"statusBarColor isn't set for unannotated view",
|
||||
testWidgetsWithLeakTracking("statusBarColor isn't set for unannotated view",
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const SizedBox.expand());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -47,8 +47,7 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'statusBarColor is set for annotated view',
|
||||
testWidgetsWithLeakTracking('statusBarColor is set for annotated view',
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
@@ -67,8 +66,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.mobile(),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
"statusBarColor isn't set when view covers less than half of the system status bar",
|
||||
testWidgetsWithLeakTracking("statusBarColor isn't set when view covers less than half of the system status bar",
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
const double lessThanHalfOfTheStatusBarHeight =
|
||||
@@ -92,8 +90,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.mobile(),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'statusBarColor is set when view covers more than half of tye system status bar',
|
||||
testWidgetsWithLeakTracking('statusBarColor is set when view covers more than half of tye system status bar',
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
const double moreThanHalfOfTheStatusBarHeight =
|
||||
@@ -122,8 +119,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('navigation color (Android only)', () {
|
||||
testWidgets(
|
||||
"systemNavigationBarColor isn't set for non Android device",
|
||||
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for non Android device",
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
@@ -142,8 +138,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
"systemNavigationBarColor isn't set for unannotated view",
|
||||
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set for unannotated view",
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const SizedBox.expand());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -153,8 +148,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'systemNavigationBarColor is set for annotated view',
|
||||
testWidgetsWithLeakTracking('systemNavigationBarColor is set for annotated view',
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
await tester.pumpWidget(const AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
@@ -173,8 +167,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
"systemNavigationBarColor isn't set when view covers less than half of navigation bar",
|
||||
testWidgetsWithLeakTracking("systemNavigationBarColor isn't set when view covers less than half of navigation bar",
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
const double lessThanHalfOfTheNavigationBarHeight =
|
||||
@@ -198,8 +191,7 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'systemNavigationBarColor is set when view covers more than half of navigation bar',
|
||||
testWidgetsWithLeakTracking('systemNavigationBarColor is set when view covers more than half of navigation bar',
|
||||
(WidgetTester tester) async {
|
||||
setupTestDevice(tester);
|
||||
const double moreThanHalfOfTheNavigationBarHeight =
|
||||
@@ -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);
|
||||
await tester.pumpWidget(
|
||||
const Column(children: <Widget>[
|
||||
@@ -253,7 +245,7 @@ void main() {
|
||||
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.green);
|
||||
}, 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);
|
||||
await tester.pumpWidget(
|
||||
const Column(children: <Widget>[
|
||||
@@ -273,7 +265,7 @@ void main() {
|
||||
expect(SystemChrome.latestStyle?.systemNavigationBarColor, Colors.blue);
|
||||
}, 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);
|
||||
await tester.pumpWidget(
|
||||
const Column(children: <Widget>[
|
||||
|
||||
Reference in New Issue
Block a user