From 9ecb4ce9a6c3aa17298183054303dc349cceeb89 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 9 Nov 2018 10:05:11 -0800 Subject: [PATCH] remove deprecated testing members (#24115) --- packages/flutter_test/lib/src/matchers.dart | 163 ------------------ .../flutter_test/lib/src/widget_tester.dart | 24 --- 2 files changed, 187 deletions(-) diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index 9acee7d5c0..69659a1101 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -509,169 +509,6 @@ Matcher matchesSemantics({ ); } -/// DEPRECATED: use [matchesSemantics] instead. -@Deprecated('use matchesSemantics instead') -Matcher matchesSemanticsData({ - String label, - String hint, - String value, - String increasedValue, - String decreasedValue, - TextDirection textDirection, - Rect rect, - Size size, - // Flags // - bool hasCheckedState = false, - bool isChecked = false, - bool isSelected = false, - bool isButton = false, - bool isFocused = false, - bool isTextField = false, - bool hasEnabledState = false, - bool isEnabled = false, - bool isInMutuallyExclusiveGroup = false, - bool isHeader = false, - bool isObscured = false, - bool namesRoute = false, - bool scopesRoute = false, - bool isHidden = false, - bool isImage = false, - bool isLiveRegion = false, - bool hasToggledState = false, - bool isToggled = false, - bool hasImplicitScrolling = false, - // Actions // - bool hasTapAction = false, - bool hasLongPressAction = false, - bool hasScrollLeftAction = false, - bool hasScrollRightAction = false, - bool hasScrollUpAction = false, - bool hasScrollDownAction = false, - bool hasIncreaseAction = false, - bool hasDecreaseAction = false, - bool hasShowOnScreenAction = false, - bool hasMoveCursorForwardByCharacterAction = false, - bool hasMoveCursorBackwardByCharacterAction = false, - bool hasMoveCursorForwardByWordAction = false, - bool hasMoveCursorBackwardByWordAction = false, - bool hasSetSelectionAction = false, - bool hasCopyAction = false, - bool hasCutAction = false, - bool hasPasteAction = false, - bool hasDidGainAccessibilityFocusAction = false, - bool hasDidLoseAccessibilityFocusAction = false, - bool hasDismissAction = false, - // Custom actions and overrides - String onTapHint, - String onLongPressHint, - List customActions, -}) { - final List flags = []; - if (hasCheckedState) - flags.add(SemanticsFlag.hasCheckedState); - if (isChecked) - flags.add(SemanticsFlag.isChecked); - if (isSelected) - flags.add(SemanticsFlag.isSelected); - if (isButton) - flags.add(SemanticsFlag.isButton); - if (isTextField) - flags.add(SemanticsFlag.isTextField); - if (isFocused) - flags.add(SemanticsFlag.isFocused); - if (hasEnabledState) - flags.add(SemanticsFlag.hasEnabledState); - if (isEnabled) - flags.add(SemanticsFlag.isEnabled); - if (isInMutuallyExclusiveGroup) - flags.add(SemanticsFlag.isInMutuallyExclusiveGroup); - if (isHeader) - flags.add(SemanticsFlag.isHeader); - if (isObscured) - flags.add(SemanticsFlag.isObscured); - if (namesRoute) - flags.add(SemanticsFlag.namesRoute); - if (scopesRoute) - flags.add(SemanticsFlag.scopesRoute); - if (isHidden) - flags.add(SemanticsFlag.isHidden); - if (isImage) - flags.add(SemanticsFlag.isImage); - if (isLiveRegion) - flags.add(SemanticsFlag.isLiveRegion); - if (hasToggledState) - flags.add(SemanticsFlag.hasToggledState); - if (isToggled) - flags.add(SemanticsFlag.isToggled); - if (hasImplicitScrolling) - flags.add(SemanticsFlag.hasImplicitScrolling); - - final List actions = []; - if (hasTapAction) - actions.add(SemanticsAction.tap); - if (hasLongPressAction) - actions.add(SemanticsAction.longPress); - if (hasScrollLeftAction) - actions.add(SemanticsAction.scrollLeft); - if (hasScrollRightAction) - actions.add(SemanticsAction.scrollRight); - if (hasScrollUpAction) - actions.add(SemanticsAction.scrollUp); - if (hasScrollDownAction) - actions.add(SemanticsAction.scrollDown); - if (hasIncreaseAction) - actions.add(SemanticsAction.increase); - if (hasDecreaseAction) - actions.add(SemanticsAction.decrease); - if (hasShowOnScreenAction) - actions.add(SemanticsAction.showOnScreen); - if (hasMoveCursorForwardByCharacterAction) - actions.add(SemanticsAction.moveCursorForwardByCharacter); - if (hasMoveCursorBackwardByCharacterAction) - actions.add(SemanticsAction.moveCursorBackwardByCharacter); - if (hasSetSelectionAction) - actions.add(SemanticsAction.setSelection); - if (hasCopyAction) - actions.add(SemanticsAction.copy); - if (hasCutAction) - actions.add(SemanticsAction.cut); - if (hasPasteAction) - actions.add(SemanticsAction.paste); - if (hasDidGainAccessibilityFocusAction) - actions.add(SemanticsAction.didGainAccessibilityFocus); - if (hasDidLoseAccessibilityFocusAction) - actions.add(SemanticsAction.didLoseAccessibilityFocus); - if (customActions != null && customActions.isNotEmpty) - actions.add(SemanticsAction.customAction); - if (hasDismissAction) - actions.add(SemanticsAction.dismiss); - if (hasMoveCursorForwardByWordAction) - actions.add(SemanticsAction.moveCursorForwardByWord); - if (hasMoveCursorBackwardByWordAction) - actions.add(SemanticsAction.moveCursorBackwardByWord); - SemanticsHintOverrides hintOverrides; - if (onTapHint != null || onLongPressHint != null) - hintOverrides = SemanticsHintOverrides( - onTapHint: onTapHint, - onLongPressHint: onLongPressHint, - ); - - return _MatchesSemanticsData( - label: label, - hint: hint, - value: value, - increasedValue: increasedValue, - decreasedValue: decreasedValue, - actions: actions, - flags: flags, - textDirection: textDirection, - rect: rect, - size: size, - customActions: customActions, - hintOverrides: hintOverrides, - ); -} - /// Asserts that the currently rendered widget meets the provided accessibility /// `guideline`. /// diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index aec0483c29..ef584aa027 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -647,30 +647,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker return result; } - /// DEPRECATED: use [getSemantics] instead. - @Deprecated('use getSemantics instead') - SemanticsData getSemanticsData(Finder finder) { - if (binding.pipelineOwner.semanticsOwner == null) - throw StateError('Semantics are not enabled.'); - final Iterable candidates = finder.evaluate(); - if (candidates.isEmpty) { - throw StateError('Finder returned no matching elements.'); - } - if (candidates.length > 1) { - throw StateError('Finder returned more than one element.'); - } - final Element element = candidates.single; - RenderObject renderObject = element.findRenderObject(); - SemanticsNode result = renderObject.debugSemantics; - while (renderObject != null && result == null) { - renderObject = renderObject?.parent; - result = renderObject?.debugSemantics; - } - if (result == null) - throw StateError('No Semantics data found.'); - return result.getSemanticsData(); - } - /// Enable semantics in a test by creating a [SemanticsHandle]. /// /// The handle must be disposed at the end of the test.