Skip to content

Commit

Permalink
Adds increment/decrement actions to fuchsia accessibility bridge. (fl…
Browse files Browse the repository at this point in the history
  • Loading branch information
abrush21 authored Sep 10, 2020
1 parent 7ebab5d commit cd580e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shell/platform/fuchsia/flutter/accessibility_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ AccessibilityBridge::GetFlutterSemanticsAction(
// Scroll node to make it visible.
case fuchsia::accessibility::semantics::Action::SHOW_ON_SCREEN:
return flutter::SemanticsAction::kShowOnScreen;
case fuchsia::accessibility::semantics::Action::INCREMENT:
return flutter::SemanticsAction::kIncrease;
case fuchsia::accessibility::semantics::Action::DECREMENT:
return flutter::SemanticsAction::kDecrease;
default:
FML_DLOG(WARNING) << "Unexpected action "
<< static_cast<int32_t>(fuchsia_action)
Expand Down
14 changes: 14 additions & 0 deletions shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,5 +633,19 @@ TEST_F(AccessibilityBridgeTest, Actions) {
2u, fuchsia::accessibility::semantics::Action::DEFAULT,
unhandled_callback);
EXPECT_EQ(accessibility_delegate_.actions.size(), 3u);

accessibility_bridge_->OnAccessibilityActionRequested(
0u, fuchsia::accessibility::semantics::Action::INCREMENT,
handled_callback);
EXPECT_EQ(accessibility_delegate_.actions.size(), 4u);
EXPECT_EQ(accessibility_delegate_.actions.back(),
std::make_pair(0, flutter::SemanticsAction::kIncrease));

accessibility_bridge_->OnAccessibilityActionRequested(
0u, fuchsia::accessibility::semantics::Action::DECREMENT,
handled_callback);
EXPECT_EQ(accessibility_delegate_.actions.size(), 5u);
EXPECT_EQ(accessibility_delegate_.actions.back(),
std::make_pair(0, flutter::SemanticsAction::kDecrease));
}
} // namespace flutter_runner_test

0 comments on commit cd580e2

Please sign in to comment.