mirror of
https://github.com/flutter/flutter
synced 2024-09-13 21:32:11 +00:00
[leak-tracking] Add leak tracking in test/rendering - 1 (#136275)
This commit is contained in:
parent
f2931dbd8c
commit
f84831c169
|
@ -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('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(
|
||||
const Center(
|
||||
child: UnconstrainedBox(
|
||||
|
@ -18,7 +19,7 @@ void main() {
|
|||
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(
|
||||
child: SizedBox(width: 200.0, height: 200.0),
|
||||
);
|
||||
|
@ -54,7 +55,7 @@ void main() {
|
|||
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(
|
||||
const Center(
|
||||
child: SizedBox(
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
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';
|
||||
|
||||
/// Unit tests error.dart's usage via ErrorWidget.
|
||||
void main() {
|
||||
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)));
|
||||
expect(
|
||||
find.byType(ErrorWidget),
|
||||
|
|
|
@ -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('Flex overflow indicator', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Flex overflow indicator', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const Center(
|
||||
child: Column(
|
||||
|
|
|
@ -9,12 +9,12 @@ library;
|
|||
|
||||
import 'package:flutter/material.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
|
||||
// is fixed, these tests should be updated to use a real font (not Ahem).
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material2 - RichText TextSpan styles with different locales',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
|
@ -60,7 +60,7 @@ void main() {
|
|||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material3 - RichText TextSpan styles with different locales',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
|
@ -106,7 +106,7 @@ void main() {
|
|||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material2 - Text with locale-specific glyphs, ambient locale',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
|
@ -158,7 +158,7 @@ void main() {
|
|||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material3 - Text with locale-specific glyphs, ambient locale',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
|
@ -210,7 +210,7 @@ void main() {
|
|||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material2 - Text with locale-specific glyphs, explicit locale',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
|
@ -254,7 +254,7 @@ void main() {
|
|||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
testWidgetsWithLeakTracking(
|
||||
'Material3 - Text with locale-specific glyphs, explicit locale',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
// THIS TEST IS SENSITIVE TO LINE NUMBERS AT THE TOP OF THIS FILE
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
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';
|
||||
|
||||
class RenderFoo extends RenderShiftedBox {
|
||||
RenderFoo({ RenderBox? child }) : super(child);
|
||||
|
@ -32,7 +32,7 @@ class Foo extends SingleChildRenderObjectWidget {
|
|||
// END OF SENSITIVE SECTION
|
||||
|
||||
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);
|
||||
final Object? exception = tester.takeException();
|
||||
final String text = exception.toString();
|
||||
|
|
Loading…
Reference in a new issue