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;
45 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
48 buffer_int32[position++] = expected_strings.size();
50 buffer_int32[position++] = expected_strings.size();
51 expected_strings.push_back(node0.
label);
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++] = -1;
61 buffer_int32[position++] = expected_strings.size();
62 expected_strings.push_back(node0.
tooltip);
63 buffer_int32[position++] = -1;
64 buffer_int32[position++] = -1;
67 buffer_float32[position++] = node0.
rect.left();
68 buffer_float32[position++] = node0.
rect.top();
69 buffer_float32[position++] = node0.
rect.right();
70 buffer_float32[position++] = node0.
rect.bottom();
71 node0.
transform.getColMajor(&buffer_float32[position]);
75 buffer_int32[position++] = 0;
76 buffer_int32[position++] = 0;
77 EXPECT_CALL(*jni_mock,
78 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
79 expected_string_attribute_args));
82 delegate->UpdateSemantics(update, actions);
85TEST(PlatformViewShell, UpdateSemanticsDoesUpdateLinkUrl) {
86 auto jni_mock = std::make_shared<JNIMock>();
87 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
93 node0.
label =
"label";
95 update.insert(std::make_pair(0, node0));
97 std::vector<uint8_t> expected_buffer(
99 std::vector<std::vector<uint8_t>> expected_string_attribute_args(0);
101 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
102 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
103 std::vector<std::string> expected_strings;
104 buffer_int32[position++] = node0.
id;
105 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
107 buffer_int32[position++] = node0.
actions;
116 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
117 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
118 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
119 buffer_int32[position++] = expected_strings.size();
121 buffer_int32[position++] = expected_strings.size();
122 expected_strings.push_back(node0.
label);
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++] = -1;
130 buffer_int32[position++] = -1;
131 buffer_int32[position++] = -1;
132 buffer_int32[position++] = -1;
133 buffer_int32[position++] = expected_strings.size();
134 expected_strings.push_back(node0.
linkUrl);
135 buffer_int32[position++] = -1;
138 buffer_float32[position++] = node0.
rect.left();
139 buffer_float32[position++] = node0.
rect.top();
140 buffer_float32[position++] = node0.
rect.right();
141 buffer_float32[position++] = node0.
rect.bottom();
142 node0.
transform.getColMajor(&buffer_float32[position]);
146 buffer_int32[position++] = 0;
147 buffer_int32[position++] = 0;
148 EXPECT_CALL(*jni_mock,
149 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
150 expected_string_attribute_args));
153 delegate->UpdateSemantics(update, actions);
156TEST(PlatformViewShell, UpdateSemanticsDoesUpdateLocale) {
157 auto jni_mock = std::make_shared<JNIMock>();
158 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
164 node0.
label =
"label";
167 update.insert(std::make_pair(0, node0));
169 std::vector<uint8_t> expected_buffer(
171 std::vector<std::vector<uint8_t>> expected_string_attribute_args(0);
173 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
174 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
175 std::vector<std::string> expected_strings;
176 buffer_int32[position++] = node0.
id;
177 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
179 buffer_int32[position++] = node0.
actions;
188 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
189 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
190 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
191 buffer_int32[position++] = expected_strings.size();
193 buffer_int32[position++] = expected_strings.size();
194 expected_strings.push_back(node0.
label);
195 buffer_int32[position++] = -1;
196 buffer_int32[position++] = -1;
197 buffer_int32[position++] = -1;
198 buffer_int32[position++] = -1;
199 buffer_int32[position++] = -1;
200 buffer_int32[position++] = -1;
201 buffer_int32[position++] = -1;
202 buffer_int32[position++] = -1;
203 buffer_int32[position++] = -1;
204 buffer_int32[position++] = -1;
205 buffer_int32[position++] = -1;
206 buffer_int32[position++] = expected_strings.size();
207 expected_strings.push_back(node0.
locale);
210 buffer_float32[position++] = node0.
rect.left();
211 buffer_float32[position++] = node0.
rect.top();
212 buffer_float32[position++] = node0.
rect.right();
213 buffer_float32[position++] = node0.
rect.bottom();
214 node0.
transform.getColMajor(&buffer_float32[position]);
218 buffer_int32[position++] = 0;
219 buffer_int32[position++] = 0;
220 EXPECT_CALL(*jni_mock,
221 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
222 expected_string_attribute_args));
225 delegate->UpdateSemantics(update, actions);
229 UpdateSemanticsDoesFlutterViewUpdateSemanticsWithStringAttribtes) {
230 auto jni_mock = std::make_shared<JNIMock>();
231 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
235 std::shared_ptr<SpellOutStringAttribute> spell_out_attribute =
236 std::make_shared<SpellOutStringAttribute>();
237 spell_out_attribute->start = 2;
238 spell_out_attribute->end = 4;
240 std::shared_ptr<LocaleStringAttribute> locale_attribute =
241 std::make_shared<LocaleStringAttribute>();
242 locale_attribute->start = 1;
243 locale_attribute->end = 3;
245 locale_attribute->locale =
"en-US";
248 node0.
label =
"label";
252 update.insert(std::make_pair(0, node0));
254 std::vector<uint8_t> expected_buffer(
258 std::vector<std::vector<uint8_t>> expected_string_attribute_args;
260 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&expected_buffer[0]);
261 float* buffer_float32 =
reinterpret_cast<float*
>(&expected_buffer[0]);
262 std::vector<std::string> expected_strings;
263 buffer_int32[position++] = node0.
id;
264 std::memcpy(&buffer_int32[position], &node0.
flags, 2);
266 buffer_int32[position++] = node0.
actions;
275 buffer_float32[position++] =
static_cast<float>(node0.
scrollPosition);
276 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMax);
277 buffer_float32[position++] =
static_cast<float>(node0.
scrollExtentMin);
278 buffer_int32[position++] = expected_strings.size();
280 buffer_int32[position++] = expected_strings.size();
281 expected_strings.push_back(node0.
label);
282 buffer_int32[position++] = 1;
283 buffer_int32[position++] = 2;
284 buffer_int32[position++] = 4;
285 buffer_int32[position++] = 0;
286 buffer_int32[position++] = -1;
287 buffer_int32[position++] = -1;
288 buffer_int32[position++] = -1;
289 buffer_int32[position++] = -1;
290 buffer_int32[position++] = -1;
291 buffer_int32[position++] = -1;
292 buffer_int32[position++] = -1;
293 buffer_int32[position++] = expected_strings.size();
294 expected_strings.push_back(node0.
hint);
295 buffer_int32[position++] = 1;
296 buffer_int32[position++] = 1;
297 buffer_int32[position++] = 3;
298 buffer_int32[position++] = 1;
299 buffer_int32[position++] =
300 expected_string_attribute_args.size();
301 expected_string_attribute_args.push_back(
302 {locale_attribute->locale.begin(), locale_attribute->locale.end()});
303 buffer_int32[position++] = -1;
304 buffer_int32[position++] = -1;
305 buffer_int32[position++] = -1;
308 buffer_float32[position++] = node0.
rect.left();
309 buffer_float32[position++] = node0.
rect.top();
310 buffer_float32[position++] = node0.
rect.right();
311 buffer_float32[position++] = node0.
rect.bottom();
312 node0.
transform.getColMajor(&buffer_float32[position]);
316 buffer_int32[position++] = 0;
317 buffer_int32[position++] = 0;
318 EXPECT_CALL(*jni_mock,
319 FlutterViewUpdateSemantics(expected_buffer, expected_strings,
320 expected_string_attribute_args));
323 delegate->UpdateSemantics(update, actions);
327 UpdateSemanticsDoesFlutterViewUpdateCustomAccessibilityActions) {
328 auto jni_mock = std::make_shared<JNIMock>();
329 auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
335 action0.
label =
"label";
336 action0.
hint =
"hint";
337 actions.insert(std::make_pair(0, action0));
339 std::vector<uint8_t> expected_actions_buffer(
341 int32_t* actions_buffer_int32 =
342 reinterpret_cast<int32_t*
>(&expected_actions_buffer[0]);
343 std::vector<std::string> expected_action_strings;
344 actions_buffer_int32[0] = action0.
id;
346 actions_buffer_int32[2] = expected_action_strings.size();
347 expected_action_strings.push_back(action0.
label);
348 actions_buffer_int32[3] = expected_action_strings.size();
349 expected_action_strings.push_back(action0.
hint);
351 EXPECT_CALL(*jni_mock, FlutterViewUpdateCustomAccessibilityActions(
352 expected_actions_buffer, expected_action_strings));
355 delegate->UpdateSemantics(update, actions);