Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ group("flutter") {
"//flutter/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
]
}
if (is_linux) {
public_deps +=
[ "//flutter/shell/platform/linux:flutter_linux_unittests" ]
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.h
FILE: ../../../flutter/shell/platform/linux/fl_binary_messenger.cc
FILE: ../../../flutter/shell/platform/linux/fl_binary_messenger_private.h
FILE: ../../../flutter/shell/platform/linux/fl_dart_project.cc
FILE: ../../../flutter/shell/platform/linux/fl_dart_project_test.cc
FILE: ../../../flutter/shell/platform/linux/fl_engine.cc
FILE: ../../../flutter/shell/platform/linux/fl_engine_private.h
FILE: ../../../flutter/shell/platform/linux/fl_renderer.cc
Expand Down
26 changes: 26 additions & 0 deletions shell/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
assert(is_linux)

import("//flutter/shell/platform/glfw/config.gni")
import("//flutter/testing/testing.gni")

group("linux") {
deps = [
Expand Down Expand Up @@ -80,6 +81,31 @@ source_set("flutter_linux") {
]
}

test_fixtures("flutter_linux_fixtures") {
fixtures = []
}

executable("flutter_linux_unittests") {
testonly = true

sources = [
"fl_dart_project_test.cc",
]

public_configs = [ "//flutter:config" ]

configs += [ "//flutter/shell/platform/linux/config:gtk" ]

# Set flag to allow public headers to be directly included (library users should not do this)
defines = [ "FLUTTER_LINUX_COMPILATION" ]

deps = [
":flutter_linux",
":flutter_linux_fixtures",
"//flutter/testing",
]
}

shared_library("flutter_linux_gtk") {
deps = [
":flutter_linux",
Expand Down
37 changes: 37 additions & 0 deletions shell/platform/linux/fl_dart_project_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h"
#include "gtest/gtest.h"

#include <gmodule.h>

TEST(FlDartProjectTest, GetPath) {
g_autoptr(FlDartProject) project =
fl_dart_project_new("/projects/my_dart_project");
EXPECT_STREQ(fl_dart_project_get_path(project), "/projects/my_dart_project");
}

TEST(FlDartProjectTest, GetPathRelative) {
g_autoptr(FlDartProject) project = fl_dart_project_new("foo");
g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr);
ASSERT_TRUE(exe_path != nullptr);
g_autofree gchar* dir = g_path_get_dirname(exe_path);
g_autofree gchar* expected_path = g_build_filename(dir, "foo", nullptr);
EXPECT_STREQ(fl_dart_project_get_path(project), expected_path);
}

TEST(FlDartProjectTest, GetAssetsPath) {
g_autoptr(FlDartProject) project =
fl_dart_project_new("/projects/my_dart_project");
g_autofree gchar* assets_path = fl_dart_project_get_assets_path(project);
EXPECT_STREQ(assets_path, "/projects/my_dart_project/flutter_assets");
}

TEST(FlDartProjectTest, GetIcuDataPath) {
g_autoptr(FlDartProject) project =
fl_dart_project_new("/projects/my_dart_project");
g_autofree gchar* assets_path = fl_dart_project_get_icu_data_path(project);
EXPECT_STREQ(assets_path, "/projects/my_dart_project/icudtl.dat");
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const gchar* fl_dart_project_get_path(FlDartProject* project);
* application.
*
* Returns: (type filename): a file path, e.g.
* "/projects/my_dart_project/assets"
* "/projects/my_dart_project/flutter_assets"
*/
gchar* fl_dart_project_get_assets_path(FlDartProject* project);

Expand Down
3 changes: 3 additions & 0 deletions testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ def RunCCTests(build_dir, filter):
if IsLinux():
RunEngineExecutable(build_dir, 'txt_unittests', filter, shuffle_flags)

if IsLinux():
RunEngineExecutable(build_dir, 'flutter_linux_unittests', filter, shuffle_flags)


def RunEngineBenchmarks(build_dir, filter):
print("Running Engine Benchmarks.")
Expand Down