Visitar URL original
cover more tests with leak tracing by derdilla · Pull Request #134834 · flutter/flutter · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/flutter/test/semantics/semantics_binding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>[];
Expand Down Expand Up @@ -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>[];
Expand All @@ -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);

Expand Down
11 changes: 6 additions & 5 deletions packages/flutter/test/semantics/semantics_elevation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/test/semantics/semantics_owner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions packages/flutter/test/semantics/semantics_update_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/test/semantics/traversal_order_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down