11 #include "gtest/gtest.h"
13 TEST(FlDartProjectTest, GetPaths) {
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);
21 expected_aot_library_path);
22 g_autofree gchar* expected_assets_path =
23 g_build_filename(dir,
"data",
"flutter_assets",
nullptr);
25 g_autofree gchar* expected_icu_data_path =
26 g_build_filename(dir,
"data",
"icudtl.dat",
nullptr);
28 expected_icu_data_path);
31 TEST(FlDartProjectTest, OverrideAotLibraryPath) {
34 char aot_library_path[] =
"/normal/tuesday/night/for/shia/labeouf";
39 TEST(FlDartProjectTest, OverrideAssetsPath) {
42 char assets_path[] =
"/normal/tuesday/night/for/shia/labeouf";
47 TEST(FlDartProjectTest, OverrideIcuDataPath) {
50 char icu_data_path[] =
"/living/in/the/woods/icudtl.dat";
55 TEST(FlDartProjectTest, DartEntrypointArgs) {
58 char** retrieved_args =
61 EXPECT_EQ(retrieved_args,
nullptr);
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));
75 EXPECT_NE(retrieved_args,
args);
77 EXPECT_EQ(g_strv_length(retrieved_args), 3U);