Skip to content

Commit

Permalink
Refactor tests. Same logic, different calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wallen committed Oct 8, 2022
1 parent bdcc158 commit 033f9df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
4 changes: 3 additions & 1 deletion shell/platform/embedder/fixtures/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ void a11y_main() async {
label: 'Archive',
hint: 'archive message',
);
PlatformDispatcher.instance.updateSemantics(builder.build());

PlatformDispatcher.instance.views.first.updateSemantics(builder.build());

signalNativeTest();

// Await semantics action from embedder.
Expand Down
25 changes: 17 additions & 8 deletions testing/scenario_app/lib/src/locale_initialization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class LocaleInitialization extends Scenario {
// On the first frame, pretend that it drew a text field. Send the
// corresponding semantics tree comprised of 1 node with the locale data
// as the label.
window.updateSemantics((SemanticsUpdateBuilder()
..updateNode(
final SemanticsUpdateBuilder semanticsUpdateBuilder =
SemanticsUpdateBuilder()..updateNode(
id: 0,
// SemanticsFlag.isTextField.
flags: 16,
Expand Down Expand Up @@ -79,8 +79,11 @@ class LocaleInitialization extends Scenario {
childrenInTraversalOrder: Int32List(0),
childrenInHitTestOrder: Int32List(0),
additionalActions: Int32List(0),
)).build()
);
);

final SemanticsUpdate semanticsUpdate = semanticsUpdateBuilder.build();

dispatcher.views.first.updateSemantics(semanticsUpdate);
}

/// Handle taps.
Expand All @@ -98,8 +101,8 @@ class LocaleInitialization extends Scenario {
// Expand for other test cases.
}

window.updateSemantics((SemanticsUpdateBuilder()
..updateNode(
final SemanticsUpdateBuilder semanticsUpdateBuilder =
SemanticsUpdateBuilder()..updateNode(
id: 0,
// SemanticsFlag.isTextField.
flags: 16,
Expand Down Expand Up @@ -134,8 +137,14 @@ class LocaleInitialization extends Scenario {
childrenInTraversalOrder: Int32List(0),
childrenInHitTestOrder: Int32List(0),
additionalActions: Int32List(0),
)).build()
);
);

final SemanticsUpdate semanticsUpdate = semanticsUpdateBuilder.build();

for (final FlutterView view in dispatcher.views) {
view.updateSemantics(semanticsUpdate);
}

_tapCount++;
}
}

0 comments on commit 033f9df

Please sign in to comment.