14TEST(PlatformViewShell, UpdateSemanticsDoesFlutterViewUpdateSemantics) {
15 auto jni_mock = std::make_shared<JNIMock>();
16 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
22 node0.
label =
"label";
24 update.insert(std::make_pair(0, node0));
26 std::vector<uint8_t> expected_buffer(
28 std::vector<std::vector<uint8_t>> expected_string_attribute_args(0);
30 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
31 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
32 std::vector<std::string> expected_strings;
33 buffer_int32[position++] = node0.
id;
34 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
36 buffer_int32[position++] = node0.
actions;
44 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
47 buffer_int32[position++] = expected_strings.size();
49 buffer_int32[position++] = expected_strings.size();
50 expected_strings.push_back(node0.
label);
51 buffer_int32[position++] = -1;
52 buffer_int32[position++] = -1;
53 buffer_int32[position++] = -1;
54 buffer_int32[position++] = -1;
55 buffer_int32[position++] = -1;
56 buffer_int32[position++] = -1;
57 buffer_int32[position++] = -1;
58 buffer_int32[position++] = -1;
59 buffer_int32[position++] = -1;
60 buffer_int32[position++] = expected_strings.size();
61 expected_strings.push_back(node0.
tooltip);
62 buffer_int32[position++] = -1;
63 buffer_int32[position++] = -1;
66 buffer_float32[position++] = node0.
rect.left();
67 buffer_float32[position++] = node0.
rect.top();
68 buffer_float32[position++] = node0.
rect.right();
69 buffer_float32[position++] = node0.
rect.bottom();
70 node0.
transform.getColMajor(&buffer_float32[position]);
72 buffer_int32[position++] = 0;
73 buffer_int32[position++] = 0;
74 EXPECT_CALL(*jni_mock,
75 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
76 expected_string_attribute_args));
79 delegate->UpdateSemantics(update, actions);
82TEST(PlatformViewShell, UpdateSemanticsDoesUpdateLinkUrl) {
83 auto jni_mock = std::make_shared<JNIMock>();
84 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
90 node0.
label =
"label";
92 update.insert(std::make_pair(0, node0));
94 std::vector<uint8_t> expected_buffer(
96 std::vector<std::vector<uint8_t>> expected_string_attribute_args(0);
98 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
99 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
100 std::vector<std::string> expected_strings;
101 buffer_int32[position++] = node0.
id;
102 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
104 buffer_int32[position++] = node0.
actions;
112 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
113 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
114 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
115 buffer_int32[position++] = expected_strings.size();
117 buffer_int32[position++] = expected_strings.size();
118 expected_strings.push_back(node0.
label);
119 buffer_int32[position++] = -1;
120 buffer_int32[position++] = -1;
121 buffer_int32[position++] = -1;
122 buffer_int32[position++] = -1;
123 buffer_int32[position++] = -1;
124 buffer_int32[position++] = -1;
125 buffer_int32[position++] = -1;
126 buffer_int32[position++] = -1;
127 buffer_int32[position++] = -1;
128 buffer_int32[position++] = -1;
129 buffer_int32[position++] = expected_strings.size();
130 expected_strings.push_back(node0.
linkUrl);
131 buffer_int32[position++] = -1;
134 buffer_float32[position++] = node0.
rect.left();
135 buffer_float32[position++] = node0.
rect.top();
136 buffer_float32[position++] = node0.
rect.right();
137 buffer_float32[position++] = node0.
rect.bottom();
138 node0.
transform.getColMajor(&buffer_float32[position]);
140 buffer_int32[position++] = 0;
141 buffer_int32[position++] = 0;
142 EXPECT_CALL(*jni_mock,
143 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
144 expected_string_attribute_args));
147 delegate->UpdateSemantics(update, actions);
150TEST(PlatformViewShell, UpdateSemanticsDoesUpdateLocale) {
151 auto jni_mock = std::make_shared<JNIMock>();
152 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
158 node0.
label =
"label";
160 update.insert(std::make_pair(0, node0));
162 std::vector<uint8_t> expected_buffer(
164 std::vector<std::vector<uint8_t>> expected_string_attribute_args(0);
166 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
167 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
168 std::vector<std::string> expected_strings;
169 buffer_int32[position++] = node0.
id;
170 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
172 buffer_int32[position++] = node0.
actions;
180 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
181 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
182 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
183 buffer_int32[position++] = expected_strings.size();
185 buffer_int32[position++] = expected_strings.size();
186 expected_strings.push_back(node0.
label);
187 buffer_int32[position++] = -1;
188 buffer_int32[position++] = -1;
189 buffer_int32[position++] = -1;
190 buffer_int32[position++] = -1;
191 buffer_int32[position++] = -1;
192 buffer_int32[position++] = -1;
193 buffer_int32[position++] = -1;
194 buffer_int32[position++] = -1;
195 buffer_int32[position++] = -1;
196 buffer_int32[position++] = -1;
197 buffer_int32[position++] = -1;
198 buffer_int32[position++] = expected_strings.size();
199 expected_strings.push_back(node0.
locale);
202 buffer_float32[position++] = node0.
rect.left();
203 buffer_float32[position++] = node0.
rect.top();
204 buffer_float32[position++] = node0.
rect.right();
205 buffer_float32[position++] = node0.
rect.bottom();
206 node0.
transform.getColMajor(&buffer_float32[position]);
208 buffer_int32[position++] = 0;
209 buffer_int32[position++] = 0;
210 EXPECT_CALL(*jni_mock,
211 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
212 expected_string_attribute_args));
215 delegate->UpdateSemantics(update, actions);
219 UpdateSemanticsDoesFlutterViewUpdateSemanticsWithStringAttribtes) {
220 auto jni_mock = std::make_shared<JNIMock>();
221 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
225 std::shared_ptr<SpellOutStringAttribute> spell_out_attribute =
226 std::make_shared<SpellOutStringAttribute>();
227 spell_out_attribute->start = 2;
228 spell_out_attribute->end = 4;
230 std::shared_ptr<LocaleStringAttribute> locale_attribute =
231 std::make_shared<LocaleStringAttribute>();
232 locale_attribute->start = 1;
233 locale_attribute->end = 3;
235 locale_attribute->locale =
"en-US";
238 node0.
label =
"label";
242 update.insert(std::make_pair(0, node0));
244 std::vector<uint8_t> expected_buffer(
248 std::vector<std::vector<uint8_t>> expected_string_attribute_args;
250 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
251 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
252 std::vector<std::string> expected_strings;
253 buffer_int32[position++] = node0.
id;
254 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
256 buffer_int32[position++] = node0.
actions;
264 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
265 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
266 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
267 buffer_int32[position++] = expected_strings.size();
269 buffer_int32[position++] = expected_strings.size();
270 expected_strings.push_back(node0.
label);
271 buffer_int32[position++] = 1;
272 buffer_int32[position++] = 2;
273 buffer_int32[position++] = 4;
274 buffer_int32[position++] = 0;
275 buffer_int32[position++] = -1;
276 buffer_int32[position++] = -1;
277 buffer_int32[position++] = -1;
278 buffer_int32[position++] = -1;
279 buffer_int32[position++] = -1;
280 buffer_int32[position++] = -1;
281 buffer_int32[position++] = -1;
282 buffer_int32[position++] = expected_strings.size();
283 expected_strings.push_back(node0.
hint);
284 buffer_int32[position++] = 1;
285 buffer_int32[position++] = 1;
286 buffer_int32[position++] = 3;
287 buffer_int32[position++] = 1;
288 buffer_int32[position++] =
289 expected_string_attribute_args.size();
290 expected_string_attribute_args.push_back(
291 {locale_attribute->locale.begin(), locale_attribute->locale.end()});
292 buffer_int32[position++] = -1;
293 buffer_int32[position++] = -1;
294 buffer_int32[position++] = -1;
297 buffer_float32[position++] = node0.
rect.left();
298 buffer_float32[position++] = node0.
rect.top();
299 buffer_float32[position++] = node0.
rect.right();
300 buffer_float32[position++] = node0.
rect.bottom();
301 node0.
transform.getColMajor(&buffer_float32[position]);
303 buffer_int32[position++] = 0;
304 buffer_int32[position++] = 0;
305 EXPECT_CALL(*jni_mock,
306 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
307 expected_string_attribute_args));
310 delegate->UpdateSemantics(update, actions);
314 UpdateSemanticsDoesFlutterViewUpdateCustomAccessibilityActions) {
315 auto jni_mock = std::make_shared<JNIMock>();
316 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
322 action0.
label =
"label";
323 action0.
hint =
"hint";
324 actions.insert(std::make_pair(0, action0));
326 std::vector<uint8_t> expected_actions_buffer(
328 int32_t* actions_buffer_int32 =
329 reinterpret_cast<int32_t*
>(&expected_actions_buffer[0]);
330 std::vector<std::string> expected_action_strings;
331 actions_buffer_int32[0] = action0.
id;
333 actions_buffer_int32[2] = expected_action_strings.size();
334 expected_action_strings.push_back(action0.
label);
335 actions_buffer_int32[3] = expected_action_strings.size();
336 expected_action_strings.push_back(action0.
hint);
338 EXPECT_CALL(*jni_mock, FlutterViewUpdateCustomAccessibilityActions(
339 expected_actions_buffer, expected_action_strings));
342 delegate->UpdateSemantics(update, actions);