Unverified Commit 94c63f82 authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

Memory leaks clean up 2 (#145757)

parent 8953ba65
......@@ -9,6 +9,7 @@ import 'dart:ui' as ui show Image;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import '../image_data.dart';
......@@ -36,7 +37,10 @@ Future<void> main() async {
AutomatedTestWidgetsFlutterBinding();
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 Completer<void> completer = Completer<void>();
await tester.pumpWidget(
......@@ -59,7 +63,10 @@ Future<void> main() async {
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 Widget subtree = KeyedSubtree(
key: GlobalKey(),
......
......@@ -110,6 +110,7 @@ void main() {
expect(find.byKey(key1), findsNothing);
final ContextMenuController controller = ContextMenuController();
addTearDown(controller.remove);
// Instantiating the controller does not shown it.
await tester.pump();
......
......@@ -7,13 +7,17 @@ import 'dart:io';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import '../image_data.dart';
void main() {
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 {
await tester.pumpWidget(Image.network(
'https://www.example.com/images/frame.png',
......
......@@ -5,6 +5,7 @@
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';
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(
Center(
child: ImageIcon(image),
......@@ -32,7 +36,10 @@ void main() {
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(
Center(
child: IconTheme(
......
......@@ -7,6 +7,7 @@ import 'dart:ui' as ui show Image;
import 'package:flutter/foundation.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 TestImageProvider extends ImageProvider<TestImageProvider> {
const TestImageProvider(this.image);
......@@ -27,6 +28,9 @@ class TestImageProvider extends ImageProvider<TestImageProvider> {
}
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;
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(() {
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/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import '../image_data.dart';
import '../painting/fake_codec.dart';
......@@ -17,7 +18,10 @@ Future<void> main() async {
final FakeCodec fakeCodec = await FakeCodec.fromData(Uint8List.fromList(kAnimatedGif));
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();
await tester.pumpWidget(
MaterialApp(
......
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