Add test to mark recording as leaking. (#133073)
This commit is contained in:
parent
5e9e959d57
commit
2afded6170
@ -11,6 +11,7 @@ import 'dart:ui' as ui;
|
|||||||
|
|
||||||
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';
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@ -19,7 +20,25 @@ void main() {
|
|||||||
* because [matchesGoldenFile] does not use Skia Gold in its native package.
|
* because [matchesGoldenFile] does not use Skia Gold in its native package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
testWidgets('correctly records frames using collate', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('recording disposes images',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
final AnimationSheetBuilder builder = AnimationSheetBuilder(frameSize: _DecuplePixels.size);
|
||||||
|
|
||||||
|
await tester.pumpFrames(
|
||||||
|
builder.record(
|
||||||
|
const _DecuplePixels(Duration(seconds: 1)),
|
||||||
|
),
|
||||||
|
const Duration(milliseconds: 200),
|
||||||
|
const Duration(milliseconds: 100),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
skip: isBrowser, // [intended] https://github.com/flutter/flutter/issues/56001
|
||||||
|
// TODO(polina-c): remove after fixing https://github.com/flutter/flutter/issues/133071
|
||||||
|
leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true),
|
||||||
|
);
|
||||||
|
|
||||||
|
testWidgetsWithLeakTracking('correctly records frames using collate',
|
||||||
|
(WidgetTester tester) async {
|
||||||
final AnimationSheetBuilder builder = AnimationSheetBuilder(frameSize: _DecuplePixels.size);
|
final AnimationSheetBuilder builder = AnimationSheetBuilder(frameSize: _DecuplePixels.size);
|
||||||
|
|
||||||
await tester.pumpFrames(
|
await tester.pumpFrames(
|
||||||
@ -53,10 +72,15 @@ void main() {
|
|||||||
image,
|
image,
|
||||||
matchesGoldenFile('test.animation_sheet_builder.collate.png'),
|
matchesGoldenFile('test.animation_sheet_builder.collate.png'),
|
||||||
);
|
);
|
||||||
image.dispose();
|
|
||||||
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001
|
|
||||||
|
|
||||||
testWidgets('use allLayers to record out-of-subtree contents', (WidgetTester tester) async {
|
image.dispose();
|
||||||
|
},
|
||||||
|
skip: isBrowser, // [intended] https://github.com/flutter/flutter/issues/56001
|
||||||
|
// TODO(polina-c): remove after fixing https://github.com/flutter/flutter/issues/133071
|
||||||
|
leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true),
|
||||||
|
); // https://github.com/flutter/flutter/issues/56001
|
||||||
|
|
||||||
|
testWidgetsWithLeakTracking('use allLayers to record out-of-subtree contents', (WidgetTester tester) async {
|
||||||
final AnimationSheetBuilder builder = AnimationSheetBuilder(
|
final AnimationSheetBuilder builder = AnimationSheetBuilder(
|
||||||
frameSize: const Size(8, 2),
|
frameSize: const Size(8, 2),
|
||||||
allLayers: true,
|
allLayers: true,
|
||||||
@ -88,7 +112,11 @@ void main() {
|
|||||||
matchesGoldenFile('test.animation_sheet_builder.out_of_tree.png'),
|
matchesGoldenFile('test.animation_sheet_builder.out_of_tree.png'),
|
||||||
);
|
);
|
||||||
image.dispose();
|
image.dispose();
|
||||||
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001
|
},
|
||||||
|
skip: isBrowser, // [intended] https://github.com/flutter/flutter/issues/56001
|
||||||
|
// TODO(polina-c): remove after fixing https://github.com/flutter/flutter/issues/133071
|
||||||
|
leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// An animation of a yellow pixel moving from left to right, in a container of
|
// An animation of a yellow pixel moving from left to right, in a container of
|
||||||
|
@ -79,7 +79,7 @@ void main() {
|
|||||||
// Currently skipped due to daily flake: https://github.com/flutter/flutter/issues/87588
|
// Currently skipped due to daily flake: https://github.com/flutter/flutter/issues/87588
|
||||||
}, skip: true); // Typically skip: isBrowser https://github.com/flutter/flutter/issues/42767
|
}, skip: true); // Typically skip: isBrowser https://github.com/flutter/flutter/issues/42767
|
||||||
|
|
||||||
testWidgets('Should show event indicator for pointer events with setSurfaceSize', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Should show event indicator for pointer events with setSurfaceSize', (WidgetTester tester) async {
|
||||||
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(200, 200), allLayers: true);
|
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(200, 200), allLayers: true);
|
||||||
final List<Offset> taps = <Offset>[];
|
final List<Offset> taps = <Offset>[];
|
||||||
Widget target({bool recording = true}) => Container(
|
Widget target({bool recording = true}) => Container(
|
||||||
@ -138,5 +138,9 @@ void main() {
|
|||||||
matchesGoldenFile('LiveBinding.press.animation.2.png'),
|
matchesGoldenFile('LiveBinding.press.animation.2.png'),
|
||||||
);
|
);
|
||||||
image.dispose();
|
image.dispose();
|
||||||
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/56001
|
},
|
||||||
|
skip: isBrowser, // [intended] https://github.com/flutter/flutter/issues/56001
|
||||||
|
// TODO(polina-c): remove after fixing https://github.com/flutter/flutter/issues/133071
|
||||||
|
leakTrackingTestConfig: const LeakTrackingTestConfig(allowAllNotDisposed: true),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,8 @@ void main() {
|
|||||||
leakTrackingTestConfig: const LeakTrackingTestConfig(
|
leakTrackingTestConfig: const LeakTrackingTestConfig(
|
||||||
allowAllNotGCed: true,
|
allowAllNotGCed: true,
|
||||||
allowAllNotDisposed: true,
|
allowAllNotDisposed: true,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Save and help text is used', (WidgetTester tester) async {
|
testWidgets('Save and help text is used', (WidgetTester tester) async {
|
||||||
|
@ -117,7 +117,8 @@ void main() {
|
|||||||
},
|
},
|
||||||
// TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed.
|
// TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed.
|
||||||
allowAllNotGCed: true,
|
allowAllNotGCed: true,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
|
|
||||||
testWidgetsWithLeakTracking('Material3 - Empty textSelectionTheme will use defaults', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('Material3 - Empty textSelectionTheme will use defaults', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||||
@ -178,7 +179,8 @@ void main() {
|
|||||||
},
|
},
|
||||||
// TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed.
|
// TODO(polina-c): investigate notGCed, if it does not disappear after fixing notDisposed.
|
||||||
allowAllNotGCed: true,
|
allowAllNotGCed: true,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('ThemeData.textSelectionTheme will be used if provided', (WidgetTester tester) async {
|
testWidgets('ThemeData.textSelectionTheme will be used if provided', (WidgetTester tester) async {
|
||||||
const TextSelectionThemeData textSelectionTheme = TextSelectionThemeData(
|
const TextSelectionThemeData textSelectionTheme = TextSelectionThemeData(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user