mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add first Linux shell tests (#18159)
This commit is contained in:
parent
cf13c7f7c1
commit
805a8874cb
4
BUILD.gn
4
BUILD.gn
@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
assert(is_linux)
|
||||
|
||||
import("//flutter/shell/platform/glfw/config.gni")
|
||||
import("//flutter/testing/testing.gni")
|
||||
|
||||
group("linux") {
|
||||
deps = [
|
||||
@ -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",
|
||||
|
||||
37
shell/platform/linux/fl_dart_project_test.cc
Normal file
37
shell/platform/linux/fl_dart_project_test.cc
Normal file
@ -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");
|
||||
}
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user