src/ui/a11y/bin/a11y_manager/tests/app_unittest.cc
// Makes sure FocusChain is wired up with the screen reader, when screen reader is enabled.
// This test uses explore action to make sure when a node is tapped, then screen reader can call
// RequestFocus() on FocusChain. This confirms that FocusChain is connected to ScreenReader.
Makes sure FocusChain is wired up with the screen reader, when screen reader is enabled.
This test uses explore action to make sure when a node is tapped, then screen reader can call
RequestFocus() on FocusChain. This confirms that FocusChain is connected to ScreenReader.
Makes sure FocusChain is wired up with the screen reader when screen reader is enabled . This test uses explore action to make sure when a node is tapped then screen reader can call RequestFocus () on FocusChain . This confirms that FocusChain is connected to ScreenReader .
TEST_F(AppUnitTest, FocusChainIsWiredToScreenReader) {
  fuchsia::settings::AccessibilitySettings accessibilitySettings;
  accessibilitySettings.set_screen_reader(true);
  accessibilitySettings.set_color_inversion(false);
  accessibilitySettings.set_enable_magnification(false);
  accessibilitySettings.set_color_correction(fuchsia::settings::ColorBlindnessType::NONE);
  mock_setui_.Set(std::move(accessibilitySettings), [](auto) {});
  RunLoopUntilIdle();
  fuchsia::ui::views::ViewRef view_ref_connection;
  fidl::Clone(view_ref_, &view_ref_connection);
  accessibility_test::MockSemanticListener semantic_listener(&context_provider_,
                                                             std::move(view_ref_connection));
  RunLoopUntilIdle();
  std::vector<Node> update_nodes;
  uint32_t node_id = 0;
  std::string node_label = "Label A";
  Node node = CreateTestNode(node_id, node_label);
  update_nodes.push_back(std::move(node));
  semantic_listener.UpdateSemanticNodes(std::move(update_nodes));
  RunLoopUntilIdle();
  semantic_listener.CommitUpdates();
  RunLoopUntilIdle();
  semantic_listener.SetHitTestResult(node_id);
  SendPointerEvents(&mock_pointer_event_registry_.listener(), TapEvents(1, {}));
  RunLoopFor(a11y::OneFingerNTapRecognizer::kTapTimeout);
  ASSERT_TRUE(mock_focus_chain_.IsRequestFocusCalled());
  EXPECT_EQ(a11y::GetKoid(view_ref_), mock_focus_chain_.GetFocusedViewKoid());
  auto highlighted_view =
      mock_annotation_view_factory_->GetAnnotationView(a11y::GetKoid(view_ref_));
  EXPECT_TRUE(highlighted_view);
  auto highlight = highlighted_view->GetCurrentHighlight();
  EXPECT_TRUE(highlight.has_value());
}
TEST_F ( AppUnitTest , FocusChainIsWiredToScreenReader ) { fuchsia :: settings :: AccessibilitySettings accessibilitySettings ; accessibilitySettings . set_screen_reader ( true ) ; accessibilitySettings . set_color_inversion ( false ) ; accessibilitySettings . set_enable_magnification ( false ) ; accessibilitySettings . set_color_correction ( fuchsia :: settings :: ColorBlindnessType :: NONE ) ; mock_setui_ . Set ( std :: move ( accessibilitySettings ) , [ ] ( auto ) { } ) ; RunLoopUntilIdle ( ) ; fuchsia :: ui :: views :: ViewRef view_ref_connection ; fidl :: Clone ( view_ref_ , & view_ref_connection ) ; accessibility_test :: MockSemanticListener semantic_listener ( & context_provider_ , std :: move ( view_ref_connection ) ) ; RunLoopUntilIdle ( ) ; std :: vector < Node > update_nodes ; uint32_t node_id = 0 ; std :: string node_label = " " ; Node node = CreateTestNode ( node_id , node_label ) ; update_nodes . push_back ( std :: move ( node ) ) ; semantic_listener . UpdateSemanticNodes ( std :: move ( update_nodes ) ) ; RunLoopUntilIdle ( ) ; semantic_listener . CommitUpdates ( ) ; RunLoopUntilIdle ( ) ; semantic_listener . SetHitTestResult ( node_id ) ; SendPointerEvents ( & mock_pointer_event_registry_ . listener ( ) , TapEvents ( 1 , { } ) ) ; RunLoopFor ( a11y :: OneFingerNTapRecognizer :: kTapTimeout ) ; ASSERT_TRUE ( mock_focus_chain_ . IsRequestFocusCalled ( ) ) ; EXPECT_EQ ( a11y :: GetKoid ( view_ref_ ) , mock_focus_chain_ . GetFocusedViewKoid ( ) ) ; auto highlighted_view = mock_annotation_view_factory_ -> GetAnnotationView ( a11y :: GetKoid ( view_ref_ ) ) ; EXPECT_TRUE ( highlighted_view ) ; auto highlight = highlighted_view -> GetCurrentHighlight ( ) ; EXPECT_TRUE ( highlight . has_value ( ) ) ; }
Makes sure FocusChain is wired up with the screen reader, when screen reader is enabled.
Makes sure FocusChain is wired up with the screen reader when screen reader is enabled .
// Enable Screen Reader. // Create ViewRef. // Create ActionListener. // We make sure the Semantic Listener has finished connecting to the // root. // Creating test node to update. // Update the node created above. // Commit nodes. // Set HitTest result which is required to know which node is being tapped. // Send Tap event for view_ref_. This should trigger explore action, which should then call // FocusChain to set focus to the tapped view.