remove deprecated testing members (#24115)
This commit is contained in:
@@ -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<CustomSemanticsAction> customActions,
|
||||
}) {
|
||||
final List<SemanticsFlag> flags = <SemanticsFlag>[];
|
||||
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<SemanticsAction> actions = <SemanticsAction>[];
|
||||
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`.
|
||||
///
|
||||
|
||||
@@ -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<Element> 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.
|
||||
|
||||
Reference in New Issue
Block a user