Add back tooltip to Embedder (flutter/engine#37676)

* Add back tooltip to Embedder

* Test inclusion of tooltip data

* Change to constexpr

* Lint
This commit is contained in:
yaakovschectman
2022-11-16 17:02:09 -05:00
committed by GitHub
parent 182555a690
commit adc79c3cf3
3 changed files with 9 additions and 4 deletions

View File

@@ -1292,6 +1292,7 @@ FlutterSemanticsNode CreateEmbedderSemanticsNode(
node.customAccessibilityActions.size(),
node.customAccessibilityActions.data(),
node.platformViewId,
node.tooltip.c_str(),
};
}

View File

@@ -165,7 +165,7 @@ void a11y_main() async {
increasedValueAttributes: <StringAttribute>[],
decreasedValue: '',
decreasedValueAttributes: <StringAttribute>[],
tooltip: '',
tooltip: 'tooltip',
additionalActions: Int32List(0),
)
..updateNode(
@@ -196,7 +196,7 @@ void a11y_main() async {
increasedValueAttributes: <StringAttribute>[],
decreasedValue: '',
decreasedValueAttributes: <StringAttribute>[],
tooltip: '',
tooltip: 'tooltip',
additionalActions: Int32List(0),
childrenInHitTestOrder: Int32List(0),
childrenInTraversalOrder: Int32List(0),
@@ -231,7 +231,7 @@ void a11y_main() async {
increasedValueAttributes: <StringAttribute>[],
decreasedValue: '',
decreasedValueAttributes: <StringAttribute>[],
tooltip: '',
tooltip: 'tooltip',
additionalActions: Int32List(0),
)
..updateNode(
@@ -263,7 +263,7 @@ void a11y_main() async {
increasedValueAttributes: <StringAttribute>[],
decreasedValue: '',
decreasedValueAttributes: <StringAttribute>[],
tooltip: '',
tooltip: 'tooltip',
childrenInHitTestOrder: Int32List(0),
childrenInTraversalOrder: Int32List(0),
)

View File

@@ -24,6 +24,8 @@ namespace testing {
using EmbedderA11yTest = testing::EmbedderTest;
constexpr static char kTooltip[] = "tooltip";
TEST_F(EmbedderTest, CannotProvideNewAndLegacySemanticsCallback) {
EmbedderConfigBuilder builder(
GetEmbedderContext(EmbedderTestContextType::kSoftwareContext));
@@ -101,6 +103,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
ASSERT_EQ(7.0, node->transform.pers0);
ASSERT_EQ(8.0, node->transform.pers1);
ASSERT_EQ(9.0, node->transform.pers2);
ASSERT_EQ(std::strncmp(kTooltip, node->tooltip, sizeof(kTooltip) - 1), 0);
if (node->id == 128) {
ASSERT_EQ(0x3f3, node->platform_view_id);
@@ -285,6 +288,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
ASSERT_EQ(7.0, node->transform.pers0);
ASSERT_EQ(8.0, node->transform.pers1);
ASSERT_EQ(9.0, node->transform.pers2);
ASSERT_EQ(std::strncmp(kTooltip, node->tooltip, sizeof(kTooltip) - 1), 0);
if (node->id == 128) {
ASSERT_EQ(0x3f3, node->platform_view_id);