| Flutter Linux Embedder |

fl_engine_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Included first as it collides with the X11 headers.
6 #include "gtest/gtest.h"
7
8 #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
9 #include "flutter/shell/platform/linux/fl_engine_private.h"
10 #include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
11 #include "flutter/shell/platform/linux/public/flutter_linux/fl_json_message_codec.h"
12 #include "flutter/shell/platform/linux/public/flutter_linux/fl_string_codec.h"
13 #include "flutter/shell/platform/linux/testing/mock_renderable.h"
14
15 // MOCK_ENGINE_PROC is leaky by design
16 // NOLINTBEGIN(clang-analyzer-core.StackAddressEscape)
17
18 // Checks notifying display updates works.
19 TEST(FlEngineTest, NotifyDisplayUpdate) {
20 g_autoptr(FlDartProject) project = fl_dart_project_new();
21 g_autoptr(FlEngine) engine = fl_engine_new(project);
22
23 g_autoptr(GError) error = nullptr;
24 EXPECT_TRUE(fl_engine_start(engine, &error));
25 EXPECT_EQ(error, nullptr);
26
27 bool called = false;
28 fl_engine_get_embedder_api(engine)->NotifyDisplayUpdate = MOCK_ENGINE_PROC(
29 NotifyDisplayUpdate,
30 ([&called](auto engine, FlutterEngineDisplaysUpdateType update_type,
31 const FlutterEngineDisplay* displays, size_t displays_length) {
32 called = true;
33 EXPECT_EQ(update_type, kFlutterEngineDisplaysUpdateTypeStartup);
34 EXPECT_EQ(displays_length, 2u);
35
36 EXPECT_EQ(displays[0].display_id, 1u);
37 EXPECT_EQ(displays[0].refresh_rate, 60);
38 EXPECT_EQ(displays[0].width, 1024u);
39 EXPECT_EQ(displays[0].height, 768u);
40 EXPECT_EQ(displays[0].device_pixel_ratio, 1.0);
41
42 EXPECT_EQ(displays[1].display_id, 2u);
43 EXPECT_EQ(displays[1].refresh_rate, 120);
44 EXPECT_EQ(displays[1].width, 3840u);
45 EXPECT_EQ(displays[1].height, 2160u);
46 EXPECT_EQ(displays[1].device_pixel_ratio, 2.0);
47
48 return kSuccess;
49 }));
50
51 FlutterEngineDisplay displays[2] = {
52 {
53 .struct_size = sizeof(FlutterEngineDisplay),
54 .display_id = 1,
55 .single_display = false,
56 .refresh_rate = 60.0,
57 .width = 1024,
58 .height = 768,
59 .device_pixel_ratio = 1.0,
60 },
61 {
62 .struct_size = sizeof(FlutterEngineDisplay),
63 .display_id = 2,
64 .single_display = false,
65 .refresh_rate = 120.0,
66 .width = 3840,
67 .height = 2160,
68 .device_pixel_ratio = 2.0,
69 }};
70 fl_engine_notify_display_update(engine, displays, 2);
71
72 EXPECT_TRUE(called);
73 }
74
75 // Checks sending window metrics events works.
76 TEST(FlEngineTest, WindowMetrics) {
77 g_autoptr(FlDartProject) project = fl_dart_project_new();
78 g_autoptr(FlEngine) engine = fl_engine_new(project);
79
80 g_autoptr(GError) error = nullptr;
81 EXPECT_TRUE(fl_engine_start(engine, &error));
82 EXPECT_EQ(error, nullptr);
83
84 bool called = false;
85 fl_engine_get_embedder_api(engine)->SendWindowMetricsEvent = MOCK_ENGINE_PROC(
86 SendWindowMetricsEvent,
87 ([&called](auto engine, const FlutterWindowMetricsEvent* event) {
88 called = true;
89 EXPECT_EQ(event->display_id, 99u);
90 EXPECT_EQ(event->view_id, 1);
91 EXPECT_EQ(event->width, static_cast<size_t>(3840));
92 EXPECT_EQ(event->height, static_cast<size_t>(2160));
93 EXPECT_EQ(event->pixel_ratio, 2.0);
94
95 return kSuccess;
96 }));
97
98 fl_engine_send_window_metrics_event(engine, 99, 1, 3840, 2160, 2.0);
99
100 EXPECT_TRUE(called);
101 }
102
103 // Checks sending mouse pointer events works.
104 TEST(FlEngineTest, MousePointer) {
105 g_autoptr(FlDartProject) project = fl_dart_project_new();
106 g_autoptr(FlEngine) engine = fl_engine_new(project);
107
108 bool called = false;
109 fl_engine_get_embedder_api(engine)->SendPointerEvent = MOCK_ENGINE_PROC(
110 SendPointerEvent,
111 ([&called](auto engine, const FlutterPointerEvent* events,
112 size_t events_count) {
113 called = true;
114 EXPECT_EQ(events_count, static_cast<size_t>(1));
115 EXPECT_EQ(events[0].view_id, 1);
116 EXPECT_EQ(events[0].phase, kDown);
117 EXPECT_EQ(events[0].timestamp, static_cast<size_t>(1234567890));
118 EXPECT_EQ(events[0].x, 800);
119 EXPECT_EQ(events[0].y, 600);
120 EXPECT_EQ(events[0].device, static_cast<int32_t>(0));
121 EXPECT_EQ(events[0].signal_kind, kFlutterPointerSignalKindScroll);
122 EXPECT_EQ(events[0].scroll_delta_x, 1.2);
123 EXPECT_EQ(events[0].scroll_delta_y, -3.4);
124 EXPECT_EQ(events[0].device_kind, kFlutterPointerDeviceKindMouse);
125 EXPECT_EQ(events[0].buttons, kFlutterPointerButtonMouseSecondary);
126
127 return kSuccess;
128 }));
129
130 g_autoptr(GError) error = nullptr;
131 EXPECT_TRUE(fl_engine_start(engine, &error));
132 EXPECT_EQ(error, nullptr);
133 fl_engine_send_mouse_pointer_event(engine, 1, kDown, 1234567890, 800, 600,
134 kFlutterPointerDeviceKindMouse, 1.2, -3.4,
135 kFlutterPointerButtonMouseSecondary);
136
137 EXPECT_TRUE(called);
138 }
139
140 // Checks sending pan/zoom events works.
141 TEST(FlEngineTest, PointerPanZoom) {
142 g_autoptr(FlDartProject) project = fl_dart_project_new();
143 g_autoptr(FlEngine) engine = fl_engine_new(project);
144
145 bool called = false;
146 fl_engine_get_embedder_api(engine)->SendPointerEvent = MOCK_ENGINE_PROC(
147 SendPointerEvent,
148 ([&called](auto engine, const FlutterPointerEvent* events,
149 size_t events_count) {
150 called = true;
151 EXPECT_EQ(events_count, static_cast<size_t>(1));
152 EXPECT_EQ(events[0].view_id, 1);
153 EXPECT_EQ(events[0].phase, kPanZoomUpdate);
154 EXPECT_EQ(events[0].timestamp, static_cast<size_t>(1234567890));
155 EXPECT_EQ(events[0].x, 800);
156 EXPECT_EQ(events[0].y, 600);
157 EXPECT_EQ(events[0].device, static_cast<int32_t>(1));
158 EXPECT_EQ(events[0].signal_kind, kFlutterPointerSignalKindNone);
159 EXPECT_EQ(events[0].pan_x, 1.5);
160 EXPECT_EQ(events[0].pan_y, 2.5);
161 EXPECT_EQ(events[0].scale, 3.5);
162 EXPECT_EQ(events[0].rotation, 4.5);
163 EXPECT_EQ(events[0].device_kind, kFlutterPointerDeviceKindTrackpad);
164 EXPECT_EQ(events[0].buttons, 0);
165
166 return kSuccess;
167 }));
168
169 g_autoptr(GError) error = nullptr;
170 EXPECT_TRUE(fl_engine_start(engine, &error));
171 EXPECT_EQ(error, nullptr);
172 fl_engine_send_pointer_pan_zoom_event(engine, 1, 1234567890, 800, 600,
173 kPanZoomUpdate, 1.5, 2.5, 3.5, 4.5);
174
175 EXPECT_TRUE(called);
176 }
177
178 // Checks dispatching a semantics action works.
179 TEST(FlEngineTest, DispatchSemanticsAction) {
180 g_autoptr(FlDartProject) project = fl_dart_project_new();
181 g_autoptr(FlEngine) engine = fl_engine_new(project);
182
183 bool called = false;
184 fl_engine_get_embedder_api(engine)->SendSemanticsAction = MOCK_ENGINE_PROC(
185 SendSemanticsAction,
186 ([&called](auto engine, const FlutterSendSemanticsActionInfo* info) {
187 EXPECT_EQ(info->view_id, static_cast<int64_t>(456));
188 EXPECT_EQ(info->node_id, static_cast<uint64_t>(42));
189 EXPECT_EQ(info->action, kFlutterSemanticsActionTap);
190 EXPECT_EQ(info->data_length, static_cast<size_t>(4));
191 EXPECT_EQ(info->data[0], 't');
192 EXPECT_EQ(info->data[1], 'e');
193 EXPECT_EQ(info->data[2], 's');
194 EXPECT_EQ(info->data[3], 't');
195 called = true;
196
197 return kSuccess;
198 }));
199
200 g_autoptr(GError) error = nullptr;
201 EXPECT_TRUE(fl_engine_start(engine, &error));
202 EXPECT_EQ(error, nullptr);
203 g_autoptr(GBytes) data = g_bytes_new_static("test", 4);
204 fl_engine_dispatch_semantics_action(engine, 456, 42,
205 kFlutterSemanticsActionTap, data);
206
207 EXPECT_TRUE(called);
208 }
209
210 // Checks sending platform messages works.
211 TEST(FlEngineTest, PlatformMessage) {
212 g_autoptr(FlDartProject) project = fl_dart_project_new();
213 g_autoptr(FlEngine) engine = fl_engine_new(project);
214
215 bool called = false;
216 FlutterEngineSendPlatformMessageFnPtr old_handler =
217 fl_engine_get_embedder_api(engine)->SendPlatformMessage;
218 fl_engine_get_embedder_api(engine)->SendPlatformMessage = MOCK_ENGINE_PROC(
219 SendPlatformMessage,
220 ([&called, old_handler](auto engine,
221 const FlutterPlatformMessage* message) {
222 if (strcmp(message->channel, "test") != 0) {
223 return old_handler(engine, message);
224 }
225
226 called = true;
227
228 EXPECT_EQ(message->message_size, static_cast<size_t>(4));
229 EXPECT_EQ(message->message[0], 't');
230 EXPECT_EQ(message->message[1], 'e');
231 EXPECT_EQ(message->message[2], 's');
232 EXPECT_EQ(message->message[3], 't');
233
234 return kSuccess;
235 }));
236
237 g_autoptr(GError) error = nullptr;
238 EXPECT_TRUE(fl_engine_start(engine, &error));
239 EXPECT_EQ(error, nullptr);
240 g_autoptr(GBytes) message = g_bytes_new_static("test", 4);
241 fl_engine_send_platform_message(engine, "test", message, nullptr, nullptr,
242 nullptr);
243
244 EXPECT_TRUE(called);
245 }
246
247 // Checks sending platform message responses works.
248 TEST(FlEngineTest, PlatformMessageResponse) {
249 g_autoptr(FlDartProject) project = fl_dart_project_new();
250 g_autoptr(FlEngine) engine = fl_engine_new(project);
251
252 bool called = false;
253 fl_engine_get_embedder_api(engine)->SendPlatformMessageResponse =
254 MOCK_ENGINE_PROC(
255 SendPlatformMessageResponse,
256 ([&called](auto engine,
257 const FlutterPlatformMessageResponseHandle* handle,
258 const uint8_t* data, size_t data_length) {
259 called = true;
260
261 EXPECT_EQ(
262 handle,
263 reinterpret_cast<const FlutterPlatformMessageResponseHandle*>(
264 42));
265 EXPECT_EQ(data_length, static_cast<size_t>(4));
266 EXPECT_EQ(data[0], 't');
267 EXPECT_EQ(data[1], 'e');
268 EXPECT_EQ(data[2], 's');
269 EXPECT_EQ(data[3], 't');
270
271 return kSuccess;
272 }));
273
274 g_autoptr(GError) error = nullptr;
275 EXPECT_TRUE(fl_engine_start(engine, &error));
276 EXPECT_EQ(error, nullptr);
277 g_autoptr(GBytes) response = g_bytes_new_static("test", 4);
278 EXPECT_TRUE(fl_engine_send_platform_message_response(
279 engine, reinterpret_cast<const FlutterPlatformMessageResponseHandle*>(42),
280 response, &error));
281 EXPECT_EQ(error, nullptr);
282
283 EXPECT_TRUE(called);
284 }
285
286 // Checks settings handler sends settings on startup.
287 TEST(FlEngineTest, SettingsHandler) {
288 g_autoptr(FlDartProject) project = fl_dart_project_new();
289 g_autoptr(FlEngine) engine = fl_engine_new(project);
290
291 bool called = false;
292 fl_engine_get_embedder_api(engine)->SendPlatformMessage = MOCK_ENGINE_PROC(
293 SendPlatformMessage,
294 ([&called](auto engine, const FlutterPlatformMessage* message) {
295 called = true;
296
297 EXPECT_STREQ(message->channel, "flutter/settings");
298
299 g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
300 g_autoptr(GBytes) data =
301 g_bytes_new(message->message, message->message_size);
302 g_autoptr(GError) error = nullptr;
303 g_autoptr(FlValue) settings = fl_message_codec_decode_message(
304 FL_MESSAGE_CODEC(codec), data, &error);
305 EXPECT_NE(settings, nullptr);
306 EXPECT_EQ(error, nullptr);
307
308 FlValue* text_scale_factor =
309 fl_value_lookup_string(settings, "textScaleFactor");
310 EXPECT_NE(text_scale_factor, nullptr);
311 EXPECT_EQ(fl_value_get_type(text_scale_factor), FL_VALUE_TYPE_FLOAT);
312
313 FlValue* always_use_24hr_format =
314 fl_value_lookup_string(settings, "alwaysUse24HourFormat");
315 EXPECT_NE(always_use_24hr_format, nullptr);
316 EXPECT_EQ(fl_value_get_type(always_use_24hr_format),
317 FL_VALUE_TYPE_BOOL);
318
319 FlValue* platform_brightness =
320 fl_value_lookup_string(settings, "platformBrightness");
321 EXPECT_NE(platform_brightness, nullptr);
322 EXPECT_EQ(fl_value_get_type(platform_brightness), FL_VALUE_TYPE_STRING);
323
324 return kSuccess;
325 }));
326
327 g_autoptr(GError) error = nullptr;
328 EXPECT_TRUE(fl_engine_start(engine, &error));
329 EXPECT_EQ(error, nullptr);
330
331 EXPECT_TRUE(called);
332 }
333
334 void on_pre_engine_restart_cb(FlEngine* engine, gpointer user_data) {
335 int* count = reinterpret_cast<int*>(user_data);
336 *count += 1;
337 }
338
339 // Checks restarting the engine invokes the correct callback.
340 TEST(FlEngineTest, OnPreEngineRestart) {
341 g_autoptr(FlDartProject) project = fl_dart_project_new();
342 g_autoptr(FlEngine) engine = fl_engine_new(project);
343
344 OnPreEngineRestartCallback callback;
345 void* callback_user_data;
346
347 bool called = false;
348 fl_engine_get_embedder_api(engine)->Initialize = MOCK_ENGINE_PROC(
349 Initialize, ([&callback, &callback_user_data, &called](
350 size_t version, const FlutterRendererConfig* config,
351 const FlutterProjectArgs* args, void* user_data,
352 FLUTTER_API_SYMBOL(FlutterEngine) * engine_out) {
353 called = true;
354 callback = args->on_pre_engine_restart_callback;
355 callback_user_data = user_data;
356
357 return kSuccess;
358 }));
359 fl_engine_get_embedder_api(engine)->RunInitialized =
360 MOCK_ENGINE_PROC(RunInitialized, ([](auto engine) { return kSuccess; }));
361
362 g_autoptr(GError) error = nullptr;
363 EXPECT_TRUE(fl_engine_start(engine, &error));
364 EXPECT_EQ(error, nullptr);
365
366 EXPECT_TRUE(called);
367 EXPECT_NE(callback, nullptr);
368
369 // The following call has no effect but should not crash.
370 callback(callback_user_data);
371
372 int count = 0;
373
374 // Set handler so that:
375 //
376 // * When the engine restarts, count += 1;
377 // * When the engine is freed, count += 10.
378 g_signal_connect(engine, "on-pre-engine-restart",
379 G_CALLBACK(on_pre_engine_restart_cb), &count);
380
381 callback(callback_user_data);
382 EXPECT_EQ(count, 1);
383 }
384
385 TEST(FlEngineTest, DartEntrypointArgs) {
386 GPtrArray* args_array = g_ptr_array_new();
387 g_ptr_array_add(args_array, const_cast<char*>("arg_one"));
388 g_ptr_array_add(args_array, const_cast<char*>("arg_two"));
389 g_ptr_array_add(args_array, const_cast<char*>("arg_three"));
390 g_ptr_array_add(args_array, nullptr);
391 gchar** args = reinterpret_cast<gchar**>(g_ptr_array_free(args_array, false));
392
393 g_autoptr(FlDartProject) project = fl_dart_project_new();
394 fl_dart_project_set_dart_entrypoint_arguments(project, args);
395 g_autoptr(FlEngine) engine = fl_engine_new(project);
396
397 bool called = false;
398 fl_engine_get_embedder_api(engine)->Initialize = MOCK_ENGINE_PROC(
399 Initialize, ([&called, &set_args = args](
400 size_t version, const FlutterRendererConfig* config,
401 const FlutterProjectArgs* args, void* user_data,
402 FLUTTER_API_SYMBOL(FlutterEngine) * engine_out) {
403 called = true;
404 EXPECT_NE(set_args, args->dart_entrypoint_argv);
405 EXPECT_EQ(args->dart_entrypoint_argc, 3);
406
407 return kSuccess;
408 }));
409 fl_engine_get_embedder_api(engine)->RunInitialized =
410 MOCK_ENGINE_PROC(RunInitialized, ([](auto engine) { return kSuccess; }));
411
412 g_autoptr(GError) error = nullptr;
413 EXPECT_TRUE(fl_engine_start(engine, &error));
414 EXPECT_EQ(error, nullptr);
415
416 EXPECT_TRUE(called);
417 }
418
419 TEST(FlEngineTest, EngineId) {
420 g_autoptr(FlDartProject) project = fl_dart_project_new();
421 g_autoptr(FlEngine) engine = fl_engine_new(project);
422 int64_t engine_id;
423 fl_engine_get_embedder_api(engine)->Initialize = MOCK_ENGINE_PROC(
424 Initialize,
425 ([&engine_id](size_t version, const FlutterRendererConfig* config,
426 const FlutterProjectArgs* args, void* user_data,
427 FLUTTER_API_SYMBOL(FlutterEngine) * engine_out) {
428 engine_id = args->engine_id;
429 return kSuccess;
430 }));
431 fl_engine_get_embedder_api(engine)->RunInitialized =
432 MOCK_ENGINE_PROC(RunInitialized, ([](auto engine) { return kSuccess; }));
433
434 g_autoptr(GError) error = nullptr;
435 EXPECT_TRUE(fl_engine_start(engine, &error));
436 EXPECT_EQ(error, nullptr);
437 EXPECT_TRUE(engine_id != 0);
438
439 EXPECT_EQ(fl_engine_for_id(engine_id), engine);
440 }
441
442 TEST(FlEngineTest, Locales) {
443 g_autofree gchar* initial_language = g_strdup(g_getenv("LANGUAGE"));
444 g_setenv("LANGUAGE", "de:en_US", TRUE);
445 g_autoptr(FlDartProject) project = fl_dart_project_new();
446
447 g_autoptr(FlEngine) engine = fl_engine_new(project);
448
449 bool called = false;
450 fl_engine_get_embedder_api(engine)->UpdateLocales = MOCK_ENGINE_PROC(
451 UpdateLocales, ([&called](auto engine, const FlutterLocale** locales,
452 size_t locales_count) {
453 called = true;
454
455 EXPECT_EQ(locales_count, static_cast<size_t>(4));
456
457 EXPECT_STREQ(locales[0]->language_code, "de");
458 EXPECT_STREQ(locales[0]->country_code, nullptr);
459 EXPECT_STREQ(locales[0]->script_code, nullptr);
460 EXPECT_STREQ(locales[0]->variant_code, nullptr);
461
462 EXPECT_STREQ(locales[1]->language_code, "en");
463 EXPECT_STREQ(locales[1]->country_code, "US");
464 EXPECT_STREQ(locales[1]->script_code, nullptr);
465 EXPECT_STREQ(locales[1]->variant_code, nullptr);
466
467 EXPECT_STREQ(locales[2]->language_code, "en");
468 EXPECT_STREQ(locales[2]->country_code, nullptr);
469 EXPECT_STREQ(locales[2]->script_code, nullptr);
470 EXPECT_STREQ(locales[2]->variant_code, nullptr);
471
472 EXPECT_STREQ(locales[3]->language_code, "C");
473 EXPECT_STREQ(locales[3]->country_code, nullptr);
474 EXPECT_STREQ(locales[3]->script_code, nullptr);
475 EXPECT_STREQ(locales[3]->variant_code, nullptr);
476
477 return kSuccess;
478 }));
479
480 g_autoptr(GError) error = nullptr;
481 EXPECT_TRUE(fl_engine_start(engine, &error));
482 EXPECT_EQ(error, nullptr);
483
484 EXPECT_TRUE(called);
485
486 if (initial_language) {
487 g_setenv("LANGUAGE", initial_language, TRUE);
488 } else {
489 g_unsetenv("LANGUAGE");
490 }
491 }
492
493 TEST(FlEngineTest, CLocale) {
494 g_autofree gchar* initial_language = g_strdup(g_getenv("LANGUAGE"));
495 g_setenv("LANGUAGE", "C", TRUE);
496 g_autoptr(FlDartProject) project = fl_dart_project_new();
497
498 g_autoptr(FlEngine) engine = fl_engine_new(project);
499
500 bool called = false;
501 fl_engine_get_embedder_api(engine)->UpdateLocales = MOCK_ENGINE_PROC(
502 UpdateLocales, ([&called](auto engine, const FlutterLocale** locales,
503 size_t locales_count) {
504 called = true;
505
506 EXPECT_EQ(locales_count, static_cast<size_t>(1));
507
508 EXPECT_STREQ(locales[0]->language_code, "C");
509 EXPECT_STREQ(locales[0]->country_code, nullptr);
510 EXPECT_STREQ(locales[0]->script_code, nullptr);
511 EXPECT_STREQ(locales[0]->variant_code, nullptr);
512
513 return kSuccess;
514 }));
515
516 g_autoptr(GError) error = nullptr;
517 EXPECT_TRUE(fl_engine_start(engine, &error));
518 EXPECT_EQ(error, nullptr);
519
520 EXPECT_TRUE(called);
521
522 if (initial_language) {
523 g_setenv("LANGUAGE", initial_language, TRUE);
524 } else {
525 g_unsetenv("LANGUAGE");
526 }
527 }
528
529 TEST(FlEngineTest, DuplicateLocale) {
530 g_autofree gchar* initial_language = g_strdup(g_getenv("LANGUAGE"));
531 g_setenv("LANGUAGE", "en:en", TRUE);
532 g_autoptr(FlDartProject) project = fl_dart_project_new();
533
534 g_autoptr(FlEngine) engine = fl_engine_new(project);
535
536 bool called = false;
537 fl_engine_get_embedder_api(engine)->UpdateLocales = MOCK_ENGINE_PROC(
538 UpdateLocales, ([&called](auto engine, const FlutterLocale** locales,
539 size_t locales_count) {
540 called = true;
541
542 EXPECT_EQ(locales_count, static_cast<size_t>(2));
543
544 EXPECT_STREQ(locales[0]->language_code, "en");
545 EXPECT_STREQ(locales[0]->country_code, nullptr);
546 EXPECT_STREQ(locales[0]->script_code, nullptr);
547 EXPECT_STREQ(locales[0]->variant_code, nullptr);
548
549 EXPECT_STREQ(locales[1]->language_code, "C");
550 EXPECT_STREQ(locales[1]->country_code, nullptr);
551 EXPECT_STREQ(locales[1]->script_code, nullptr);
552 EXPECT_STREQ(locales[1]->variant_code, nullptr);
553
554 return kSuccess;
555 }));
556
557 g_autoptr(GError) error = nullptr;
558 EXPECT_TRUE(fl_engine_start(engine, &error));
559 EXPECT_EQ(error, nullptr);
560
561 EXPECT_TRUE(called);
562
563 if (initial_language) {
564 g_setenv("LANGUAGE", initial_language, TRUE);
565 } else {
566 g_unsetenv("LANGUAGE");
567 }
568 }
569
570 TEST(FlEngineTest, EmptyLocales) {
571 g_autofree gchar* initial_language = g_strdup(g_getenv("LANGUAGE"));
572 g_setenv("LANGUAGE", "de:: :en_US", TRUE);
573 g_autoptr(FlDartProject) project = fl_dart_project_new();
574
575 g_autoptr(FlEngine) engine = fl_engine_new(project);
576
577 bool called = false;
578 fl_engine_get_embedder_api(engine)->UpdateLocales = MOCK_ENGINE_PROC(
579 UpdateLocales, ([&called](auto engine, const FlutterLocale** locales,
580 size_t locales_count) {
581 called = true;
582
583 EXPECT_EQ(locales_count, static_cast<size_t>(4));
584
585 EXPECT_STREQ(locales[0]->language_code, "de");
586 EXPECT_STREQ(locales[0]->country_code, nullptr);
587 EXPECT_STREQ(locales[0]->script_code, nullptr);
588 EXPECT_STREQ(locales[0]->variant_code, nullptr);
589
590 EXPECT_STREQ(locales[1]->language_code, "en");
591 EXPECT_STREQ(locales[1]->country_code, "US");
592 EXPECT_STREQ(locales[1]->script_code, nullptr);
593 EXPECT_STREQ(locales[1]->variant_code, nullptr);
594
595 EXPECT_STREQ(locales[2]->language_code, "en");
596 EXPECT_STREQ(locales[2]->country_code, nullptr);
597 EXPECT_STREQ(locales[2]->script_code, nullptr);
598 EXPECT_STREQ(locales[2]->variant_code, nullptr);
599
600 EXPECT_STREQ(locales[3]->language_code, "C");
601 EXPECT_STREQ(locales[3]->country_code, nullptr);
602 EXPECT_STREQ(locales[3]->script_code, nullptr);
603 EXPECT_STREQ(locales[3]->variant_code, nullptr);
604
605 return kSuccess;
606 }));
607
608 g_autoptr(GError) error = nullptr;
609 EXPECT_TRUE(fl_engine_start(engine, &error));
610 EXPECT_EQ(error, nullptr);
611
612 EXPECT_TRUE(called);
613
614 if (initial_language) {
615 g_setenv("LANGUAGE", initial_language, TRUE);
616 } else {
617 g_unsetenv("LANGUAGE");
618 }
619 }
620
621 static void add_view_cb(GObject* object,
622 GAsyncResult* result,
623 gpointer user_data) {
624 g_autoptr(GError) error = nullptr;
625 gboolean r = fl_engine_add_view_finish(FL_ENGINE(object), result, &error);
626 EXPECT_TRUE(r);
627 EXPECT_EQ(error, nullptr);
628
629 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
630 }
631
632 TEST(FlEngineTest, AddView) {
633 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
634
635 g_autoptr(FlDartProject) project = fl_dart_project_new();
636 g_autoptr(FlEngine) engine = fl_engine_new(project);
637
638 bool called = false;
639 fl_engine_get_embedder_api(engine)->AddView = MOCK_ENGINE_PROC(
640 AddView, ([&called](auto engine, const FlutterAddViewInfo* info) {
641 called = true;
642 EXPECT_EQ(info->view_metrics->width, 123u);
643 EXPECT_EQ(info->view_metrics->height, 456u);
644 EXPECT_EQ(info->view_metrics->pixel_ratio, 2.0);
645
646 FlutterAddViewResult result;
647 result.struct_size = sizeof(FlutterAddViewResult);
648 result.added = true;
649 result.user_data = info->user_data;
650 info->add_view_callback(&result);
651
652 return kSuccess;
653 }));
654
655 g_autoptr(FlMockRenderable) renderable = fl_mock_renderable_new();
656 FlutterViewId view_id =
657 fl_engine_add_view(engine, FL_RENDERABLE(renderable), 123, 456, 2.0,
658 nullptr, add_view_cb, loop);
659 EXPECT_GT(view_id, 0);
660 EXPECT_TRUE(called);
661
662 // Blocks here until add_view_cb is called.
663 g_main_loop_run(loop);
664 }
665
666 static void add_view_error_cb(GObject* object,
667 GAsyncResult* result,
668 gpointer user_data) {
669 g_autoptr(GError) error = nullptr;
670 gboolean r = fl_engine_add_view_finish(FL_ENGINE(object), result, &error);
671 EXPECT_FALSE(r);
672 EXPECT_NE(error, nullptr);
673
674 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
675 }
676
677 TEST(FlEngineTest, AddViewError) {
678 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
679
680 g_autoptr(FlDartProject) project = fl_dart_project_new();
681 g_autoptr(FlEngine) engine = fl_engine_new(project);
682
683 fl_engine_get_embedder_api(engine)->AddView = MOCK_ENGINE_PROC(
684 AddView, ([](auto engine, const FlutterAddViewInfo* info) {
685 FlutterAddViewResult result;
686 result.struct_size = sizeof(FlutterAddViewResult);
687 result.added = false;
688 result.user_data = info->user_data;
689 info->add_view_callback(&result);
690
691 return kSuccess;
692 }));
693
694 g_autoptr(FlMockRenderable) renderable = fl_mock_renderable_new();
695 FlutterViewId view_id =
696 fl_engine_add_view(engine, FL_RENDERABLE(renderable), 123, 456, 2.0,
697 nullptr, add_view_error_cb, loop);
698 EXPECT_GT(view_id, 0);
699
700 // Blocks here until add_view_error_cb is called.
701 g_main_loop_run(loop);
702 }
703
704 static void add_view_engine_error_cb(GObject* object,
705 GAsyncResult* result,
706 gpointer user_data) {
707 g_autoptr(GError) error = nullptr;
708 gboolean r = fl_engine_add_view_finish(FL_ENGINE(object), result, &error);
709 EXPECT_FALSE(r);
710 EXPECT_NE(error, nullptr);
711
712 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
713 }
714
715 TEST(FlEngineTest, AddViewEngineError) {
716 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
717
718 g_autoptr(FlDartProject) project = fl_dart_project_new();
719 g_autoptr(FlEngine) engine = fl_engine_new(project);
720
721 fl_engine_get_embedder_api(engine)->AddView = MOCK_ENGINE_PROC(
722 AddView, ([](auto engine, const FlutterAddViewInfo* info) {
723 return kInvalidArguments;
724 }));
725
726 g_autoptr(FlMockRenderable) renderable = fl_mock_renderable_new();
727 FlutterViewId view_id =
728 fl_engine_add_view(engine, FL_RENDERABLE(renderable), 123, 456, 2.0,
729 nullptr, add_view_engine_error_cb, loop);
730 EXPECT_GT(view_id, 0);
731
732 // Blocks here until remove_view_engine_error_cb is called.
733 g_main_loop_run(loop);
734 }
735
736 static void remove_view_cb(GObject* object,
737 GAsyncResult* result,
738 gpointer user_data) {
739 g_autoptr(GError) error = nullptr;
740 gboolean r = fl_engine_remove_view_finish(FL_ENGINE(object), result, &error);
741 EXPECT_TRUE(r);
742 EXPECT_EQ(error, nullptr);
743
744 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
745 }
746
747 TEST(FlEngineTest, RemoveView) {
748 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
749
750 g_autoptr(FlDartProject) project = fl_dart_project_new();
751 g_autoptr(FlEngine) engine = fl_engine_new(project);
752
753 bool called = false;
754 fl_engine_get_embedder_api(engine)->RemoveView = MOCK_ENGINE_PROC(
755 RemoveView, ([&called](auto engine, const FlutterRemoveViewInfo* info) {
756 called = true;
757 EXPECT_EQ(info->view_id, 123);
758
759 FlutterRemoveViewResult result;
760 result.struct_size = sizeof(FlutterRemoveViewResult);
761 result.removed = true;
762 result.user_data = info->user_data;
763 info->remove_view_callback(&result);
764
765 return kSuccess;
766 }));
767
768 fl_engine_remove_view(engine, 123, nullptr, remove_view_cb, loop);
769 EXPECT_TRUE(called);
770
771 // Blocks here until remove_view_cb is called.
772 g_main_loop_run(loop);
773 }
774
775 static void remove_view_error_cb(GObject* object,
776 GAsyncResult* result,
777 gpointer user_data) {
778 g_autoptr(GError) error = nullptr;
779 gboolean r = fl_engine_remove_view_finish(FL_ENGINE(object), result, &error);
780 EXPECT_FALSE(r);
781 EXPECT_NE(error, nullptr);
782
783 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
784 }
785
786 TEST(FlEngineTest, RemoveViewError) {
787 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
788
789 g_autoptr(FlDartProject) project = fl_dart_project_new();
790 g_autoptr(FlEngine) engine = fl_engine_new(project);
791
792 fl_engine_get_embedder_api(engine)->RemoveView = MOCK_ENGINE_PROC(
793 RemoveView, ([](auto engine, const FlutterRemoveViewInfo* info) {
794 FlutterRemoveViewResult result;
795 result.struct_size = sizeof(FlutterRemoveViewResult);
796 result.removed = false;
797 result.user_data = info->user_data;
798 info->remove_view_callback(&result);
799
800 return kSuccess;
801 }));
802
803 fl_engine_remove_view(engine, 123, nullptr, remove_view_error_cb, loop);
804
805 // Blocks here until remove_view_error_cb is called.
806 g_main_loop_run(loop);
807 }
808
809 static void remove_view_engine_error_cb(GObject* object,
810 GAsyncResult* result,
811 gpointer user_data) {
812 g_autoptr(GError) error = nullptr;
813 gboolean r = fl_engine_remove_view_finish(FL_ENGINE(object), result, &error);
814 EXPECT_FALSE(r);
815 EXPECT_NE(error, nullptr);
816
817 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
818 }
819
820 TEST(FlEngineTest, RemoveViewEngineError) {
821 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
822
823 g_autoptr(FlDartProject) project = fl_dart_project_new();
824 g_autoptr(FlEngine) engine = fl_engine_new(project);
825
826 fl_engine_get_embedder_api(engine)->RemoveView = MOCK_ENGINE_PROC(
827 RemoveView, ([](auto engine, const FlutterRemoveViewInfo* info) {
828 return kInvalidArguments;
829 }));
830
831 fl_engine_remove_view(engine, 123, nullptr, remove_view_engine_error_cb,
832 loop);
833
834 // Blocks here until remove_view_engine_error_cb is called.
835 g_main_loop_run(loop);
836 }
837
838 TEST(FlEngineTest, SendKeyEvent) {
839 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
840
841 g_autoptr(FlDartProject) project = fl_dart_project_new();
842 g_autoptr(FlEngine) engine = fl_engine_new(project);
843
844 g_autoptr(GError) error = nullptr;
845 EXPECT_TRUE(fl_engine_start(engine, &error));
846 EXPECT_EQ(error, nullptr);
847
848 bool called;
849 fl_engine_get_embedder_api(engine)->SendKeyEvent = MOCK_ENGINE_PROC(
850 SendKeyEvent,
851 ([&called](auto engine, const FlutterKeyEvent* event,
852 FlutterKeyEventCallback callback, void* user_data) {
853 called = true;
854 EXPECT_EQ(event->timestamp, 1234);
855 EXPECT_EQ(event->type, kFlutterKeyEventTypeUp);
856 EXPECT_EQ(event->physical, static_cast<uint64_t>(42));
857 EXPECT_EQ(event->logical, static_cast<uint64_t>(123));
858 EXPECT_TRUE(event->synthesized);
859 EXPECT_EQ(event->device_type, kFlutterKeyEventDeviceTypeKeyboard);
860 callback(TRUE, user_data);
861 return kSuccess;
862 }));
863
864 FlutterKeyEvent event = {.struct_size = sizeof(FlutterKeyEvent),
865 .timestamp = 1234,
866 .type = kFlutterKeyEventTypeUp,
867 .physical = 42,
868 .logical = 123,
869 .character = nullptr,
870 .synthesized = true,
871 .device_type = kFlutterKeyEventDeviceTypeKeyboard};
872 fl_engine_send_key_event(
873 engine, &event, nullptr,
874 [](GObject* object, GAsyncResult* result, gpointer user_data) {
875 gboolean handled;
876 g_autoptr(GError) error = nullptr;
877 EXPECT_TRUE(fl_engine_send_key_event_finish(FL_ENGINE(object), result,
878 &handled, &error));
879 EXPECT_EQ(error, nullptr);
880 EXPECT_TRUE(handled);
881 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
882 },
883 loop);
884
885 g_main_loop_run(loop);
886 EXPECT_TRUE(called);
887 }
888
889 TEST(FlEngineTest, SendKeyEventNotHandled) {
890 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
891
892 g_autoptr(FlDartProject) project = fl_dart_project_new();
893 g_autoptr(FlEngine) engine = fl_engine_new(project);
894
895 g_autoptr(GError) error = nullptr;
896 EXPECT_TRUE(fl_engine_start(engine, &error));
897 EXPECT_EQ(error, nullptr);
898
899 bool called;
900 fl_engine_get_embedder_api(engine)->SendKeyEvent = MOCK_ENGINE_PROC(
901 SendKeyEvent,
902 ([&called](auto engine, const FlutterKeyEvent* event,
903 FlutterKeyEventCallback callback, void* user_data) {
904 called = true;
905 callback(FALSE, user_data);
906 return kSuccess;
907 }));
908
909 FlutterKeyEvent event = {.struct_size = sizeof(FlutterKeyEvent),
910 .timestamp = 1234,
911 .type = kFlutterKeyEventTypeUp,
912 .physical = 42,
913 .logical = 123,
914 .character = nullptr,
915 .synthesized = true,
916 .device_type = kFlutterKeyEventDeviceTypeKeyboard};
917 fl_engine_send_key_event(
918 engine, &event, nullptr,
919 [](GObject* object, GAsyncResult* result, gpointer user_data) {
920 gboolean handled;
921 g_autoptr(GError) error = nullptr;
922 EXPECT_TRUE(fl_engine_send_key_event_finish(FL_ENGINE(object), result,
923 &handled, &error));
924 EXPECT_EQ(error, nullptr);
925 EXPECT_FALSE(handled);
926 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
927 },
928 loop);
929
930 g_main_loop_run(loop);
931 EXPECT_TRUE(called);
932 }
933
934 TEST(FlEngineTest, SendKeyEventError) {
935 g_autoptr(GMainLoop) loop = g_main_loop_new(nullptr, 0);
936
937 g_autoptr(FlDartProject) project = fl_dart_project_new();
938 g_autoptr(FlEngine) engine = fl_engine_new(project);
939
940 g_autoptr(GError) error = nullptr;
941 EXPECT_TRUE(fl_engine_start(engine, &error));
942 EXPECT_EQ(error, nullptr);
943
944 bool called;
945 fl_engine_get_embedder_api(engine)->SendKeyEvent = MOCK_ENGINE_PROC(
946 SendKeyEvent,
947 ([&called](auto engine, const FlutterKeyEvent* event,
948 FlutterKeyEventCallback callback, void* user_data) {
949 called = true;
950 return kInvalidArguments;
951 }));
952
953 FlutterKeyEvent event = {.struct_size = sizeof(FlutterKeyEvent),
954 .timestamp = 1234,
955 .type = kFlutterKeyEventTypeUp,
956 .physical = 42,
957 .logical = 123,
958 .character = nullptr,
959 .synthesized = true,
960 .device_type = kFlutterKeyEventDeviceTypeKeyboard};
961 fl_engine_send_key_event(
962 engine, &event, nullptr,
963 [](GObject* object, GAsyncResult* result, gpointer user_data) {
964 gboolean handled;
965 g_autoptr(GError) error = nullptr;
966 EXPECT_FALSE(fl_engine_send_key_event_finish(FL_ENGINE(object), result,
967 &handled, &error));
968 EXPECT_NE(error, nullptr);
969 EXPECT_STREQ(error->message, "Failed to send key event");
970 g_main_loop_quit(static_cast<GMainLoop*>(user_data));
971 },
972 loop);
973
974 g_main_loop_run(loop);
975 EXPECT_TRUE(called);
976 }
977
978 TEST(FlEngineTest, ChildObjects) {
979 g_autoptr(FlDartProject) project = fl_dart_project_new();
980 g_autoptr(FlEngine) engine = fl_engine_new(project);
981
982 // Check objects exist before engine started.
983 EXPECT_NE(fl_engine_get_binary_messenger(engine), nullptr);
984 EXPECT_NE(fl_engine_get_compositor(engine), nullptr);
985 EXPECT_NE(fl_engine_get_display_monitor(engine), nullptr);
986 EXPECT_NE(fl_engine_get_task_runner(engine), nullptr);
987 EXPECT_NE(fl_engine_get_keyboard_manager(engine), nullptr);
988 EXPECT_NE(fl_engine_get_mouse_cursor_handler(engine), nullptr);
989 EXPECT_NE(fl_engine_get_windowing_handler(engine), nullptr);
990 }
991
992 // NOLINTEND(clang-analyzer-core.StackAddressEscape)
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:50
fl_dart_project_set_dart_entrypoint_arguments
G_MODULE_EXPORT void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject *self, char **argv)
Definition: fl_dart_project.cc:110
fl_engine_get_mouse_cursor_handler
FlMouseCursorHandler * fl_engine_get_mouse_cursor_handler(FlEngine *self)
Definition: fl_engine.cc:1334
fl_engine_send_mouse_pointer_event
void fl_engine_send_mouse_pointer_event(FlEngine *self, FlutterViewId view_id, FlutterPointerPhase phase, size_t timestamp, double x, double y, FlutterPointerDeviceKind device_kind, double scroll_delta_x, double scroll_delta_y, int64_t buttons)
Definition: fl_engine.cc:989
fl_engine_send_key_event_finish
gboolean fl_engine_send_key_event_finish(FlEngine *self, GAsyncResult *result, gboolean *handled, GError **error)
Definition: fl_engine.cc:1215
fl_engine_get_embedder_api
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition: fl_engine.cc:726
fl_engine_dispatch_semantics_action
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1232
fl_engine_notify_display_update
void fl_engine_notify_display_update(FlEngine *self, const FlutterEngineDisplay *displays, size_t displays_length)
Definition: fl_engine.cc:730
fl_engine_get_compositor
FlCompositor * fl_engine_get_compositor(FlEngine *self)
Definition: fl_engine.cc:598
fl_engine_send_window_metrics_event
void fl_engine_send_window_metrics_event(FlEngine *self, FlutterEngineDisplayId display_id, FlutterViewId view_id, size_t width, size_t height, double pixel_ratio)
Definition: fl_engine.cc:967
fl_engine_get_windowing_handler
FlWindowingHandler * fl_engine_get_windowing_handler(FlEngine *self)
Definition: fl_engine.cc:1319
fl_engine_remove_view_finish
gboolean fl_engine_remove_view_finish(FlEngine *self, GAsyncResult *result, GError **error)
Definition: fl_engine.cc:841
fl_engine_get_task_runner
FlTaskRunner * fl_engine_get_task_runner(FlEngine *self)
Definition: fl_engine.cc:1287
fl_engine_get_keyboard_manager
FlKeyboardManager * fl_engine_get_keyboard_manager(FlEngine *self)
Definition: fl_engine.cc:1324
fl_engine_get_display_monitor
FlDisplayMonitor * fl_engine_get_display_monitor(FlEngine *self)
Definition: fl_engine.cc:608
fl_engine_send_platform_message_response
gboolean fl_engine_send_platform_message_response(FlEngine *self, const FlutterPlatformMessageResponseHandle *handle, GBytes *response, GError **error)
Definition: fl_engine.cc:867
fl_engine_send_platform_message
void fl_engine_send_platform_message(FlEngine *self, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:899
fl_engine_for_id
FlEngine * fl_engine_for_id(int64_t id)
Definition: fl_engine.cc:578
fl_engine_remove_view
void fl_engine_remove_view(FlEngine *self, FlutterViewId view_id, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:814
fl_engine_get_binary_messenger
G_MODULE_EXPORT FlBinaryMessenger * fl_engine_get_binary_messenger(FlEngine *self)
Definition: fl_engine.cc:1281
fl_engine_add_view_finish
gboolean fl_engine_add_view_finish(FlEngine *self, GAsyncResult *result, GError **error)
Definition: fl_engine.cc:799
fl_engine_send_key_event
void fl_engine_send_key_event(FlEngine *self, const FlutterKeyEvent *event, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:1192
fl_engine_send_pointer_pan_zoom_event
void fl_engine_send_pointer_pan_zoom_event(FlEngine *self, FlutterViewId view_id, size_t timestamp, double x, double y, FlutterPointerPhase phase, double pan_x, double pan_y, double scale, double rotation)
Definition: fl_engine.cc:1153
fl_engine_add_view
FlutterViewId fl_engine_add_view(FlEngine *self, FlRenderable *renderable, size_t width, size_t height, double pixel_ratio, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition: fl_engine.cc:750
fl_engine_start
gboolean fl_engine_start(FlEngine *self, GError **error)
Definition: fl_engine.cc:613
fl_engine_new
G_MODULE_EXPORT FlEngine * fl_engine_new(FlDartProject *project)
Definition: fl_engine.cc:584
fl_engine.h
fl_engine_private.h
on_pre_engine_restart_cb
void on_pre_engine_restart_cb(FlEngine *engine, gpointer user_data)
Definition: fl_engine_test.cc:334
remove_view_engine_error_cb
static void remove_view_engine_error_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:809
TEST
TEST(FlEngineTest, NotifyDisplayUpdate)
Definition: fl_engine_test.cc:19
remove_view_cb
static void remove_view_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:736
add_view_error_cb
static void add_view_error_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:666
add_view_engine_error_cb
static void add_view_engine_error_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:704
remove_view_error_cb
static void remove_view_error_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:775
add_view_cb
static void add_view_cb(GObject *object, GAsyncResult *result, gpointer user_data)
Definition: fl_engine_test.cc:621
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
fl_json_message_codec_new
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
Definition: fl_json_message_codec.cc:306
fl_json_message_codec.h
fl_message_codec_decode_message
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
Definition: fl_message_codec.cc:33
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1117
fl_string_codec.h
fl_value_lookup_string
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
Definition: fl_value.cc:811
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:68
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:65
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:67
view_id
G_BEGIN_DECLS FlutterViewId view_id
Definition: fl_view_accessible.h:49