This reverts commit 0df0e2ea1f.
This commit is contained in:
@@ -18,24 +18,24 @@ import 'constants.dart';
|
||||
/// the Android accessibility bridge, and not the semantics object created by
|
||||
/// the Flutter framework.
|
||||
Matcher hasAndroidSemantics({
|
||||
String? text,
|
||||
String? contentDescription,
|
||||
String? className,
|
||||
int? id,
|
||||
Rect? rect,
|
||||
Size? size,
|
||||
List<AndroidSemanticsAction>? actions,
|
||||
List<AndroidSemanticsAction>? ignoredActions,
|
||||
List<AndroidSemanticsNode>? children,
|
||||
bool? isChecked,
|
||||
bool? isCheckable,
|
||||
bool? isEditable,
|
||||
bool? isEnabled,
|
||||
bool? isFocusable,
|
||||
bool? isFocused,
|
||||
bool? isHeading,
|
||||
bool? isPassword,
|
||||
bool? isLongClickable,
|
||||
String text,
|
||||
String contentDescription,
|
||||
String className,
|
||||
int id,
|
||||
Rect rect,
|
||||
Size size,
|
||||
List<AndroidSemanticsAction> actions,
|
||||
List<AndroidSemanticsAction> ignoredActions,
|
||||
List<AndroidSemanticsNode> children,
|
||||
bool isChecked,
|
||||
bool isCheckable,
|
||||
bool isEditable,
|
||||
bool isEnabled,
|
||||
bool isFocusable,
|
||||
bool isFocused,
|
||||
bool isHeading,
|
||||
bool isPassword,
|
||||
bool isLongClickable,
|
||||
}) {
|
||||
return _AndroidSemanticsMatcher(
|
||||
text: text,
|
||||
@@ -79,23 +79,23 @@ class _AndroidSemanticsMatcher extends Matcher {
|
||||
this.isLongClickable,
|
||||
});
|
||||
|
||||
final String? text;
|
||||
final String? className;
|
||||
final String? contentDescription;
|
||||
final int? id;
|
||||
final List<AndroidSemanticsAction>? actions;
|
||||
final List<AndroidSemanticsAction>? ignoredActions;
|
||||
final Rect? rect;
|
||||
final Size? size;
|
||||
final bool? isChecked;
|
||||
final bool? isCheckable;
|
||||
final bool? isEditable;
|
||||
final bool? isEnabled;
|
||||
final bool? isFocusable;
|
||||
final bool? isFocused;
|
||||
final bool? isHeading;
|
||||
final bool? isPassword;
|
||||
final bool? isLongClickable;
|
||||
final String text;
|
||||
final String className;
|
||||
final String contentDescription;
|
||||
final int id;
|
||||
final List<AndroidSemanticsAction> actions;
|
||||
final List<AndroidSemanticsAction> ignoredActions;
|
||||
final Rect rect;
|
||||
final Size size;
|
||||
final bool isChecked;
|
||||
final bool isCheckable;
|
||||
final bool isEditable;
|
||||
final bool isEnabled;
|
||||
final bool isFocusable;
|
||||
final bool isFocused;
|
||||
final bool isHeading;
|
||||
final bool isPassword;
|
||||
final bool isLongClickable;
|
||||
|
||||
@override
|
||||
Description describe(Description description) {
|
||||
@@ -149,7 +149,7 @@ class _AndroidSemanticsMatcher extends Matcher {
|
||||
}
|
||||
|
||||
@override
|
||||
bool matches(covariant AndroidSemanticsNode item, Map<dynamic, dynamic> matchState) {
|
||||
bool matches(covariant AndroidSemanticsNode item, Map<Object, Object> matchState) {
|
||||
if (text != null && text != item.text) {
|
||||
return _failWithMessage('Expected text: $text', matchState);
|
||||
}
|
||||
@@ -170,13 +170,13 @@ class _AndroidSemanticsMatcher extends Matcher {
|
||||
}
|
||||
if (actions != null) {
|
||||
final List<AndroidSemanticsAction> itemActions = item.getActions();
|
||||
if (!unorderedEquals(actions!).matches(itemActions, matchState)) {
|
||||
final List<String> actionsString = actions!.map<String>((AndroidSemanticsAction action) => action.toString()).toList()..sort();
|
||||
if (!unorderedEquals(actions).matches(itemActions, matchState)) {
|
||||
final List<String> actionsString = actions.map<String>((AndroidSemanticsAction action) => action.toString()).toList()..sort();
|
||||
final List<String> itemActionsString = itemActions.map<String>((AndroidSemanticsAction action) => action.toString()).toList()..sort();
|
||||
final Set<AndroidSemanticsAction> unexpected = itemActions.toSet().difference(actions!.toSet());
|
||||
final Set<AndroidSemanticsAction> unexpected = itemActions.toSet().difference(actions.toSet());
|
||||
final Set<String> unexpectedInString = itemActionsString.toSet().difference(actionsString.toSet());
|
||||
final Set<String> missingInString = actionsString.toSet().difference(itemActionsString.toSet());
|
||||
if (missingInString.isEmpty && ignoredActions != null && unexpected.every(ignoredActions!.contains)) {
|
||||
if (missingInString.isEmpty && ignoredActions != null && unexpected.every(ignoredActions.contains)) {
|
||||
return true;
|
||||
}
|
||||
return _failWithMessage('Expected actions: $actionsString\nActual actions: $itemActionsString\nUnexpected: $unexpectedInString\nMissing: $missingInString', matchState);
|
||||
@@ -214,8 +214,8 @@ class _AndroidSemanticsMatcher extends Matcher {
|
||||
}
|
||||
|
||||
@override
|
||||
Description describeMismatch(dynamic item, Description mismatchDescription,
|
||||
Map<dynamic, dynamic> matchState, bool verbose) {
|
||||
Description describeMismatch(Object item, Description mismatchDescription,
|
||||
Map<Object, Object> matchState, bool verbose) {
|
||||
return mismatchDescription.add(matchState['failure'] as String);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user