From 5cb2c33d7be66b396826e22f4edb9a50ec190082 Mon Sep 17 00:00:00 2001 From: Renzo Olivares Date: Thu, 25 Jun 2026 00:54:03 +0000 Subject: [PATCH] Migrate button_test.dart to SemanticsHandle --- .../button_test.dart | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) rename packages/cupertino_ui/{temporarily_disabled_tests => test}/button_test.dart (98%) diff --git a/packages/cupertino_ui/temporarily_disabled_tests/button_test.dart b/packages/cupertino_ui/test/button_test.dart similarity index 98% rename from packages/cupertino_ui/temporarily_disabled_tests/button_test.dart rename to packages/cupertino_ui/test/button_test.dart index a615ffd48ecc..5bf249f890eb 100644 --- a/packages/cupertino_ui/temporarily_disabled_tests/button_test.dart +++ b/packages/cupertino_ui/test/button_test.dart @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -@Skip( - '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:cupertino_ui/cupertino_ui.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; @@ -13,8 +10,6 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../widgets/semantics_tester.dart'; - const TextStyle testStyle = TextStyle(fontSize: 10.0, letterSpacing: 0.0); void main() { @@ -348,7 +343,8 @@ void main() { }); testWidgets('Cupertino button is semantically a button', (WidgetTester tester) async { - final semantics = SemanticsTester(tester); + final SemanticsHandle handle = tester.ensureSemantics(); + await tester.pumpWidget( boilerplate( child: Center( @@ -358,24 +354,17 @@ void main() { ); expect( - semantics, - hasSemantics( - TestSemantics.root( - children: [ - TestSemantics.rootChild( - actions: SemanticsAction.tap.index | SemanticsAction.focus.index, - label: 'ABC', - flags: [SemanticsFlag.isButton, SemanticsFlag.isFocusable], - ), - ], - ), - ignoreId: true, - ignoreRect: true, - ignoreTransform: true, + tester.getSemantics(find.text('ABC')), + isSemantics( + label: 'ABC', + isButton: true, + isFocusable: true, + hasTapAction: true, + hasFocusAction: true, ), ); - semantics.dispose(); + handle.dispose(); }); testWidgets('Can specify colors', (WidgetTester tester) async {