Unverified Commit d843863c authored by Dan Field's avatar Dan Field Committed by GitHub

reset state of CustomSemanticsAction before running tests (#137697)

Fixes https://github.com/flutter/flutter/issues/137696

This will get the tree green again.

The problem is that `CustomSemanticsAction` has static state in it, and todays test seed order makes things unhappy.
parent ba75e7a0
...@@ -274,6 +274,17 @@ class CustomSemanticsAction { ...@@ -274,6 +274,17 @@ class CustomSemanticsAction {
static CustomSemanticsAction? getAction(int id) { static CustomSemanticsAction? getAction(int id) {
return _actions[id]; return _actions[id];
} }
/// Resets internal state between tests. Does nothing if asserts are disabled.
@visibleForTesting
static void resetForTests() {
assert(() {
_actions.clear();
_ids.clear();
_nextId = 0;
return true;
}());
}
} }
/// A string that carries a list of [StringAttribute]s. /// A string that carries a list of [StringAttribute]s.
......
...@@ -251,6 +251,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -251,6 +251,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
if (registerTestTextInput) { if (registerTestTextInput) {
_testTextInput.register(); _testTextInput.register();
} }
CustomSemanticsAction.resetForTests(); // ignore: invalid_use_of_visible_for_testing_member
} }
@override @override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment