未验证 提交 805a8874 编写于 作者: R Robert Ancell 提交者: GitHub

Add first Linux shell tests (#18159)

上级 cf13c7f7
......@@ -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",
......
// 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.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册