mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
cover more tests with leak tracing (#134834)
This commit is contained in:
parent
2868bc1351
commit
237db2bb2a
@ -4,9 +4,10 @@
|
||||
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Listeners are called when semantics are turned on with ensureSemantics', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Listeners are called when semantics are turned on with ensureSemantics', (WidgetTester tester) async {
|
||||
expect(SemanticsBinding.instance.semanticsEnabled, isFalse);
|
||||
|
||||
final List<bool> status = <bool>[];
|
||||
@ -43,7 +44,7 @@ void main() {
|
||||
expect(SemanticsBinding.instance.semanticsEnabled, isFalse);
|
||||
}, semanticsEnabled: false);
|
||||
|
||||
testWidgets('Listeners are called when semantics are turned on by platform', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Listeners are called when semantics are turned on by platform', (WidgetTester tester) async {
|
||||
expect(SemanticsBinding.instance.semanticsEnabled, isFalse);
|
||||
|
||||
final List<bool> status = <bool>[];
|
||||
@ -69,7 +70,7 @@ void main() {
|
||||
expect(SemanticsBinding.instance.semanticsEnabled, isFalse);
|
||||
}, semanticsEnabled: false);
|
||||
|
||||
testWidgets('SemanticsBinding.ensureSemantics triggers creation of semantics owner.', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('SemanticsBinding.ensureSemantics triggers creation of semantics owner.', (WidgetTester tester) async {
|
||||
expect(SemanticsBinding.instance.semanticsEnabled, isFalse);
|
||||
expect(tester.binding.pipelineOwner.semanticsOwner, isNull);
|
||||
|
||||
|
||||
@ -5,11 +5,12 @@
|
||||
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 '../widgets/semantics_tester.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('SemanticsNodes overlapping in z', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('SemanticsNodes overlapping in z', (WidgetTester tester) async {
|
||||
// Cards are semantic boundaries that always own their own SemanticNode,
|
||||
// PhysicalModels merge their semantics information into parent.
|
||||
//
|
||||
@ -97,7 +98,7 @@ void main() {
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('SemanticsNodes overlapping in z with switched children', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('SemanticsNodes overlapping in z with switched children', (WidgetTester tester) async {
|
||||
// Same as 'SemanticsNodes overlapping in z', but the order of children
|
||||
// is reversed
|
||||
|
||||
@ -173,7 +174,7 @@ void main() {
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('single node thickness', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('single node thickness', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(const MaterialApp(
|
||||
@ -193,7 +194,7 @@ void main() {
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('force-merge', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('force-merge', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
@ -247,7 +248,7 @@ void main() {
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('force-merge with inversed children', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('force-merge with inversed children', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
|
||||
@ -5,11 +5,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
import '../widgets/semantics_tester.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Performing SemanticsAction.showOnScreen does not crash if node no longer exist', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Performing SemanticsAction.showOnScreen does not crash if node no longer exist', (WidgetTester tester) async {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/100358.
|
||||
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
@ -8,11 +8,12 @@ import 'dart:ui' as ui;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
void main() {
|
||||
SemanticsUpdateTestBinding();
|
||||
|
||||
testWidgets('Semantics update does not send update for merged nodes.', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Semantics update does not send update for merged nodes.', (WidgetTester tester) async {
|
||||
final SemanticsHandle handle = tester.ensureSemantics();
|
||||
// Pumps a placeholder to trigger the warm up frame.
|
||||
await tester.pumpWidget(
|
||||
@ -85,7 +86,7 @@ void main() {
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
testWidgets('Semantics update receives attributed text', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Semantics update receives attributed text', (WidgetTester tester) async {
|
||||
final SemanticsHandle handle = tester.ensureSemantics();
|
||||
// Pumps a placeholder to trigger the warm up frame.
|
||||
await tester.pumpWidget(
|
||||
|
||||
@ -4,11 +4,12 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
import '../widgets/semantics_tester.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Traversal order handles touching elements', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Traversal order handles touching elements', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user