|
| 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 | +#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h" |
| 6 | +#include "gtest/gtest.h" |
| 7 | + |
| 8 | +#include <gmodule.h> |
| 9 | + |
| 10 | +TEST(FlDartProjectTest, GetPath) { |
| 11 | + g_autoptr(FlDartProject) project = |
| 12 | + fl_dart_project_new("/projects/my_dart_project"); |
| 13 | + EXPECT_STREQ(fl_dart_project_get_path(project), "/projects/my_dart_project"); |
| 14 | +} |
| 15 | + |
| 16 | +TEST(FlDartProjectTest, GetPathRelative) { |
| 17 | + g_autoptr(FlDartProject) project = fl_dart_project_new("foo"); |
| 18 | + g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr); |
| 19 | + ASSERT_TRUE(exe_path != nullptr); |
| 20 | + g_autofree gchar* dir = g_path_get_dirname(exe_path); |
| 21 | + g_autofree gchar* expected_path = g_build_filename(dir, "foo", nullptr); |
| 22 | + EXPECT_STREQ(fl_dart_project_get_path(project), expected_path); |
| 23 | +} |
| 24 | + |
| 25 | +TEST(FlDartProjectTest, GetAssetsPath) { |
| 26 | + g_autoptr(FlDartProject) project = |
| 27 | + fl_dart_project_new("/projects/my_dart_project"); |
| 28 | + g_autofree gchar* assets_path = fl_dart_project_get_assets_path(project); |
| 29 | + EXPECT_STREQ(assets_path, "/projects/my_dart_project/flutter_assets"); |
| 30 | +} |
| 31 | + |
| 32 | +TEST(FlDartProjectTest, GetIcuDataPath) { |
| 33 | + g_autoptr(FlDartProject) project = |
| 34 | + fl_dart_project_new("/projects/my_dart_project"); |
| 35 | + g_autofree gchar* assets_path = fl_dart_project_get_icu_data_path(project); |
| 36 | + EXPECT_STREQ(assets_path, "/projects/my_dart_project/icudtl.dat"); |
| 37 | +} |
0 commit comments