Unverified Commit f84831c1 authored by droidbg's avatar droidbg Committed by GitHub

[leak-tracking] Add leak tracking in test/rendering - 1 (#136275)

parent f2931dbd
...@@ -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('overflow indicator is not shown when not overflowing', (WidgetTester tester) async { testWidgetsWithLeakTracking('overflow indicator is not shown when not overflowing', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const Center( const Center(
child: UnconstrainedBox( child: UnconstrainedBox(
...@@ -18,7 +19,7 @@ void main() { ...@@ -18,7 +19,7 @@ void main() {
expect(find.byType(UnconstrainedBox), isNot(paints..rect())); expect(find.byType(UnconstrainedBox), isNot(paints..rect()));
}); });
testWidgets('overflow indicator is shown when overflowing', (WidgetTester tester) async { testWidgetsWithLeakTracking('overflow indicator is shown when overflowing', (WidgetTester tester) async {
const UnconstrainedBox box = UnconstrainedBox( const UnconstrainedBox box = UnconstrainedBox(
child: SizedBox(width: 200.0, height: 200.0), child: SizedBox(width: 200.0, height: 200.0),
); );
...@@ -54,7 +55,7 @@ void main() { ...@@ -54,7 +55,7 @@ void main() {
expect(find.byType(UnconstrainedBox), paints..rect()); expect(find.byType(UnconstrainedBox), paints..rect());
}); });
testWidgets('overflow indicator is not shown when constraint size is zero.', (WidgetTester tester) async { testWidgetsWithLeakTracking('overflow indicator is not shown when constraint size is zero.', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const Center( const Center(
child: SizedBox( child: SizedBox(
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
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';
/// Unit tests error.dart's usage via ErrorWidget. /// Unit tests error.dart's usage via ErrorWidget.
void main() { void main() {
const String errorMessage = 'Some error message'; const String errorMessage = 'Some error message';
testWidgets('test draw error paragraph', (WidgetTester tester) async { testWidgetsWithLeakTracking('test draw error paragraph', (WidgetTester tester) async {
await tester.pumpWidget(ErrorWidget(Exception(errorMessage))); await tester.pumpWidget(ErrorWidget(Exception(errorMessage)));
expect( expect(
find.byType(ErrorWidget), find.byType(ErrorWidget),
......
...@@ -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('Flex overflow indicator', (WidgetTester tester) async { testWidgetsWithLeakTracking('Flex overflow indicator', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
const Center( const Center(
child: Column( child: Column(
......
...@@ -9,12 +9,12 @@ library; ...@@ -9,12 +9,12 @@ library;
import 'package:flutter/material.dart'; import 'package:flutter/material.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';
// TODO(hansmuller): when https://github.com/flutter/flutter/issues/17700 // TODO(hansmuller): when https://github.com/flutter/flutter/issues/17700
// is fixed, these tests should be updated to use a real font (not Ahem). // is fixed, these tests should be updated to use a real font (not Ahem).
void main() { void main() {
testWidgets( testWidgetsWithLeakTracking(
'Material2 - RichText TextSpan styles with different locales', 'Material2 - RichText TextSpan styles with different locales',
(WidgetTester tester) async { (WidgetTester tester) async {
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking(
'Material3 - RichText TextSpan styles with different locales', 'Material3 - RichText TextSpan styles with different locales',
(WidgetTester tester) async { (WidgetTester tester) async {
...@@ -106,7 +106,7 @@ void main() { ...@@ -106,7 +106,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking(
'Material2 - Text with locale-specific glyphs, ambient locale', 'Material2 - Text with locale-specific glyphs, ambient locale',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -158,7 +158,7 @@ void main() { ...@@ -158,7 +158,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking(
'Material3 - Text with locale-specific glyphs, ambient locale', 'Material3 - Text with locale-specific glyphs, ambient locale',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -210,7 +210,7 @@ void main() { ...@@ -210,7 +210,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking(
'Material2 - Text with locale-specific glyphs, explicit locale', 'Material2 - Text with locale-specific glyphs, explicit locale',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,7 @@ void main() {
}, },
); );
testWidgets( testWidgetsWithLeakTracking(
'Material3 - Text with locale-specific glyphs, explicit locale', 'Material3 - Text with locale-specific glyphs, explicit locale',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
// found in the LICENSE file. // found in the LICENSE file.
// THIS TEST IS SENSITIVE TO LINE NUMBERS AT THE TOP OF THIS FILE // THIS TEST IS SENSITIVE TO LINE NUMBERS AT THE TOP OF THIS FILE
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
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';
class RenderFoo extends RenderShiftedBox { class RenderFoo extends RenderShiftedBox {
RenderFoo({ RenderBox? child }) : super(child); RenderFoo({ RenderBox? child }) : super(child);
...@@ -32,7 +32,7 @@ class Foo extends SingleChildRenderObjectWidget { ...@@ -32,7 +32,7 @@ class Foo extends SingleChildRenderObjectWidget {
// END OF SENSITIVE SECTION // END OF SENSITIVE SECTION
void main() { void main() {
testWidgets('Stack parsing in non-normalized constraints error', (WidgetTester tester) async { testWidgetsWithLeakTracking('Stack parsing in non-normalized constraints error', (WidgetTester tester) async {
await tester.pumpWidget(const Foo(child: Placeholder()), Duration.zero, EnginePhase.layout); await tester.pumpWidget(const Foo(child: Placeholder()), Duration.zero, EnginePhase.layout);
final Object? exception = tester.takeException(); final Object? exception = tester.takeException();
final String text = exception.toString(); final String text = exception.toString();
......
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