mirror of
https://github.com/flutter/flutter
synced 2024-08-25 02:46:31 +00:00
Memory leaks clean up 2 (#145757)
This commit is contained in:
parent
8953ba658f
commit
94c63f825f
|
@ -9,6 +9,7 @@ import 'dart:ui' as ui show Image;
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
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';
|
||||||
|
|
||||||
import '../image_data.dart';
|
import '../image_data.dart';
|
||||||
|
|
||||||
|
@ -36,7 +37,10 @@ Future<void> main() async {
|
||||||
AutomatedTestWidgetsFlutterBinding();
|
AutomatedTestWidgetsFlutterBinding();
|
||||||
TestImageProvider.image = await decodeImageFromList(Uint8List.fromList(kTransparentImage));
|
TestImageProvider.image = await decodeImageFromList(Uint8List.fromList(kTransparentImage));
|
||||||
|
|
||||||
testWidgets('DecoratedBox handles loading images', (WidgetTester tester) async {
|
testWidgets('DecoratedBox handles loading images',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
final GlobalKey key = GlobalKey();
|
final GlobalKey key = GlobalKey();
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
|
@ -59,7 +63,10 @@ Future<void> main() async {
|
||||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Moving a DecoratedBox', (WidgetTester tester) async {
|
testWidgets('Moving a DecoratedBox',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
final Widget subtree = KeyedSubtree(
|
final Widget subtree = KeyedSubtree(
|
||||||
key: GlobalKey(),
|
key: GlobalKey(),
|
||||||
|
|
|
@ -110,6 +110,7 @@ void main() {
|
||||||
expect(find.byKey(key1), findsNothing);
|
expect(find.byKey(key1), findsNothing);
|
||||||
|
|
||||||
final ContextMenuController controller = ContextMenuController();
|
final ContextMenuController controller = ContextMenuController();
|
||||||
|
addTearDown(controller.remove);
|
||||||
|
|
||||||
// Instantiating the controller does not shown it.
|
// Instantiating the controller does not shown it.
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
|
@ -7,13 +7,17 @@ import 'dart:io';
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
import '../image_data.dart';
|
import '../image_data.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
final MockHttpClient client = MockHttpClient();
|
final MockHttpClient client = MockHttpClient();
|
||||||
|
|
||||||
testWidgets('Headers', (WidgetTester tester) async {
|
testWidgets('Headers',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
HttpOverrides.runZoned<Future<void>>(() async {
|
HttpOverrides.runZoned<Future<void>>(() async {
|
||||||
await tester.pumpWidget(Image.network(
|
await tester.pumpWidget(Image.network(
|
||||||
'https://www.example.com/images/frame.png',
|
'https://www.example.com/images/frame.png',
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
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';
|
||||||
|
|
||||||
import '../painting/mocks_for_image_cache.dart';
|
import '../painting/mocks_for_image_cache.dart';
|
||||||
|
|
||||||
|
@ -20,7 +21,10 @@ void main() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ImageIcon sizing - no theme, default size', (WidgetTester tester) async {
|
testWidgets('ImageIcon sizing - no theme, default size',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Center(
|
Center(
|
||||||
child: ImageIcon(image),
|
child: ImageIcon(image),
|
||||||
|
@ -32,7 +36,10 @@ void main() {
|
||||||
expect(find.byType(Image), findsOneWidget);
|
expect(find.byType(Image), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Icon opacity', (WidgetTester tester) async {
|
testWidgets('Icon opacity',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Center(
|
Center(
|
||||||
child: IconTheme(
|
child: IconTheme(
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'dart:ui' as ui show Image;
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.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 TestImageProvider extends ImageProvider<TestImageProvider> {
|
class TestImageProvider extends ImageProvider<TestImageProvider> {
|
||||||
const TestImageProvider(this.image);
|
const TestImageProvider(this.image);
|
||||||
|
@ -27,6 +28,9 @@ class TestImageProvider extends ImageProvider<TestImageProvider> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
LeakTesting.settings = LeakTesting.settings.withIgnoredAll();
|
||||||
|
|
||||||
late ui.Image testImage;
|
late ui.Image testImage;
|
||||||
|
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
|
|
|
@ -2066,7 +2066,10 @@ void main() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Animated GIFs do not require layout for subsequent frames', (WidgetTester tester) async {
|
testWidgets('Animated GIFs do not require layout for subsequent frames',
|
||||||
|
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
final ui.Codec codec = (await tester.runAsync(() {
|
final ui.Codec codec = (await tester.runAsync(() {
|
||||||
return ui.instantiateImageCodec(Uint8List.fromList(kAnimatedGif));
|
return ui.instantiateImageCodec(Uint8List.fromList(kAnimatedGif));
|
||||||
}))!;
|
}))!;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'dart:ui' as ui show Image;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.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';
|
||||||
|
|
||||||
import '../image_data.dart';
|
import '../image_data.dart';
|
||||||
import '../painting/fake_codec.dart';
|
import '../painting/fake_codec.dart';
|
||||||
|
@ -17,7 +18,10 @@ Future<void> main() async {
|
||||||
final FakeCodec fakeCodec = await FakeCodec.fromData(Uint8List.fromList(kAnimatedGif));
|
final FakeCodec fakeCodec = await FakeCodec.fromData(Uint8List.fromList(kAnimatedGif));
|
||||||
final FakeImageProvider fakeImageProvider = FakeImageProvider(fakeCodec);
|
final FakeImageProvider fakeImageProvider = FakeImageProvider(fakeCodec);
|
||||||
|
|
||||||
testWidgets('Obscured image does not animate', (WidgetTester tester) async {
|
testWidgets('Obscured image does not animate',
|
||||||
|
// TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean]
|
||||||
|
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),
|
||||||
|
(WidgetTester tester) async {
|
||||||
final GlobalKey imageKey = GlobalKey();
|
final GlobalKey imageKey = GlobalKey();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
|
Loading…
Reference in a new issue