| Flutter Linux Embedder |

Functions
fl_dart_project_test.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h"`
`#include <gmodule.h>`
`#include <cstdlib>`
`#include "gtest/gtest.h"`

Go to the source code of this file.

## Functions
| TEST (FlDartProjectTest, GetPaths)
| TEST (FlDartProjectTest, OverrideAotLibraryPath)
| TEST (FlDartProjectTest, OverrideAssetsPath)
| TEST (FlDartProjectTest, OverrideIcuDataPath)
| TEST (FlDartProjectTest, DartEntrypointArgs)

## Function Documentation

## ◆ TEST() [1/5]

TEST | ( | FlDartProjectTest | ,
|  | DartEntrypointArgs |
| ) |  |

Definition at line 55 of file fl_dart_project_test.cc.

55 {
56 g_autoptr(FlDartProject) project = fl_dart_project_new();
57
58 char** retrieved_args =
59 fl_dart_project_get_dart_entrypoint_arguments(project);
60
61 EXPECT_EQ(retrieved_args, nullptr);
62
63 GPtrArray* args_array = g_ptr_array_new();
64 g_ptr_array_add(args_array, const_cast<char*>("arg_one"));
65 g_ptr_array_add(args_array, const_cast<char*>("arg_two"));
66 g_ptr_array_add(args_array, const_cast<char*>("arg_three"));
67 g_ptr_array_add(args_array, nullptr);
68 gchar** args = reinterpret_cast<gchar**>(g_ptr_array_free(args_array, false));
69
70 fl_dart_project_set_dart_entrypoint_arguments(project, args);
71
72 retrieved_args = fl_dart_project_get_dart_entrypoint_arguments(project);
73
74 // FlDartProject should have done a deep copy of the args
75 EXPECT_NE(retrieved_args, args);
76
77 EXPECT_EQ(g_strv_length(retrieved_args), 3U);
78 }
fl_dart_project_new
G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:52
fl_dart_project_get_dart_entrypoint_arguments
G_MODULE_EXPORT gchar ** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject *self)
Definition: fl_dart_project.cc:106
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:112
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89

References args, fl_dart_project_get_dart_entrypoint_arguments(), fl_dart_project_new(), and fl_dart_project_set_dart_entrypoint_arguments().

## ◆ TEST() [2/5]

TEST | ( | FlDartProjectTest | ,
|  | GetPaths |
| ) |  |

Definition at line 13 of file fl_dart_project_test.cc.

13 {
14 g_autoptr(FlDartProject) project = fl_dart_project_new();
15 g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr);
16 ASSERT_TRUE(exe_path != nullptr);
17 g_autofree gchar* dir = g_path_get_dirname(exe_path);
18 g_autofree gchar* expected_aot_library_path =
19 g_build_filename(dir, "lib", "libapp.so", nullptr);
20 EXPECT_STREQ(fl_dart_project_get_aot_library_path(project),
21 expected_aot_library_path);
22 g_autofree gchar* expected_assets_path =
23 g_build_filename(dir, "data", "flutter_assets", nullptr);
24 EXPECT_STREQ(fl_dart_project_get_assets_path(project), expected_assets_path);
25 g_autofree gchar* expected_icu_data_path =
26 g_build_filename(dir, "data", "icudtl.dat", nullptr);
27 EXPECT_STREQ(fl_dart_project_get_icu_data_path(project),
28 expected_icu_data_path);
29 }
fl_dart_project_get_aot_library_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_aot_library_path(FlDartProject *self)
Definition: fl_dart_project.cc:74
fl_dart_project_get_icu_data_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_icu_data_path(FlDartProject *self)
Definition: fl_dart_project.cc:100
fl_dart_project_get_assets_path
G_MODULE_EXPORT const gchar * fl_dart_project_get_assets_path(FlDartProject *self)
Definition: fl_dart_project.cc:87

References fl_dart_project_get_aot_library_path(), fl_dart_project_get_assets_path(), fl_dart_project_get_icu_data_path(), and fl_dart_project_new().

## ◆ TEST() [3/5]

TEST | ( | FlDartProjectTest | ,
|  | OverrideAotLibraryPath |
| ) |  |

Definition at line 31 of file fl_dart_project_test.cc.

31 {
32 g_autoptr(FlDartProject) project = fl_dart_project_new();
33
34 char aot_library_path[] = "/normal/tuesday/night/for/shia/labeouf";
35 fl_dart_project_set_aot_library_path(project, aot_library_path);
36 EXPECT_STREQ(fl_dart_project_get_aot_library_path(project), aot_library_path);
37 }
fl_dart_project_set_aot_library_path
G_MODULE_EXPORT void fl_dart_project_set_aot_library_path(FlDartProject *self, const gchar *path)
Definition: fl_dart_project.cc:67

References fl_dart_project_get_aot_library_path(), fl_dart_project_new(), and fl_dart_project_set_aot_library_path().

## ◆ TEST() [4/5]

TEST | ( | FlDartProjectTest | ,
|  | OverrideAssetsPath |
| ) |  |

Definition at line 39 of file fl_dart_project_test.cc.

39 {
40 g_autoptr(FlDartProject) project = fl_dart_project_new();
41
42 char assets_path[] = "/normal/tuesday/night/for/shia/labeouf";
43 fl_dart_project_set_assets_path(project, assets_path);
44 EXPECT_STREQ(fl_dart_project_get_assets_path(project), assets_path);
45 }
fl_dart_project_set_assets_path
G_MODULE_EXPORT void fl_dart_project_set_assets_path(FlDartProject *self, gchar *path)
Definition: fl_dart_project.cc:80

References fl_dart_project_get_assets_path(), fl_dart_project_new(), and fl_dart_project_set_assets_path().

## ◆ TEST() [5/5]

TEST | ( | FlDartProjectTest | ,
|  | OverrideIcuDataPath |
| ) |  |

Definition at line 47 of file fl_dart_project_test.cc.

47 {
48 g_autoptr(FlDartProject) project = fl_dart_project_new();
49
50 char icu_data_path[] = "/living/in/the/woods/icudtl.dat";
51 fl_dart_project_set_icu_data_path(project, icu_data_path);
52 EXPECT_STREQ(fl_dart_project_get_icu_data_path(project), icu_data_path);
53 }
fl_dart_project_set_icu_data_path
G_MODULE_EXPORT void fl_dart_project_set_icu_data_path(FlDartProject *self, gchar *path)
Definition: fl_dart_project.cc:93

References fl_dart_project_get_icu_data_path(), fl_dart_project_new(), and fl_dart_project_set_icu_data_path().