diff --git a/packages/material_ui/temporarily_disabled_tests/card_test.dart b/packages/material_ui/temporarily_disabled_tests/card_test.dart index 44de32308031..046b0e5ca9eb 100644 --- a/packages/material_ui/temporarily_disabled_tests/card_test.dart +++ b/packages/material_ui/temporarily_disabled_tests/card_test.dart @@ -6,9 +6,7 @@ 'This file is skipped due to a cross-import that needs to be fixed. Tracked in https://github.com/flutter/flutter/issues/177028.', ) import 'package:material_ui/material_ui.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../widgets/semantics_tester.dart'; void main() { testWidgets('Material3 - Card defaults (Elevated card)', (WidgetTester tester) async { @@ -93,7 +91,6 @@ void main() { }); testWidgets('Card can take semantic text from multiple children', (WidgetTester tester) async { - final semantics = SemanticsTester(tester); await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, @@ -115,38 +112,29 @@ void main() { ); expect( - semantics, - hasSemantics( - TestSemantics.root( - children: [ - TestSemantics(id: 1, label: 'I am text!', textDirection: TextDirection.ltr), - TestSemantics(id: 2, label: 'Moar text!!1', textDirection: TextDirection.ltr), - TestSemantics( - id: 3, - label: 'Button', - textDirection: TextDirection.ltr, - actions: [SemanticsAction.tap, SemanticsAction.focus], - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - SemanticsFlag.isEnabled, - SemanticsFlag.isFocusable, - ], - ), - ], - ), - ignoreTransform: true, - ignoreRect: true, + tester.getSemantics(find.text('I am text!')), + matchesSemantics(label: 'I am text!', textDirection: TextDirection.ltr), + ); + expect( + tester.getSemantics(find.text('Moar text!!1')), + matchesSemantics(label: 'Moar text!!1', textDirection: TextDirection.ltr), + ); + expect( + tester.getSemantics(find.widgetWithText(ElevatedButton, 'Button')), + matchesSemantics( + label: 'Button', + textDirection: TextDirection.ltr, + hasTapAction: true, + hasFocusAction: true, + hasEnabledState: true, + isButton: true, + isEnabled: true, + isFocusable: true, ), ); - - semantics.dispose(); }); testWidgets('Card merges children when it is a semanticContainer', (WidgetTester tester) async { - final semantics = SemanticsTester(tester); - debugResetSemanticsIdCounter(); - await tester.pumpWidget( const Directionality( textDirection: TextDirection.ltr, @@ -161,23 +149,9 @@ void main() { ); expect( - semantics, - hasSemantics( - TestSemantics.root( - children: [ - TestSemantics( - id: 1, - label: 'First child\nSecond child', - textDirection: TextDirection.ltr, - ), - ], - ), - ignoreTransform: true, - ignoreRect: true, - ), + tester.getSemantics(find.byType(Card)), + matchesSemantics(label: 'First child\nSecond child', textDirection: TextDirection.ltr), ); - - semantics.dispose(); }); testWidgets('Card margin', (WidgetTester tester) async {