Build engine TUs with C++20. (#174471)

The changes:

* Creating a bit-mask with different enum values is now a warning. Fixed
offending instances.
* `char8_t` is a different type. Fixed those instances.
* Disabling modules in Objective-C requires bypassing the driver.
* Aggregate initialization fails when there are other constructors for
structs. Added explicit constructors.
* `gn format` doesn't seem to be run on erstwhile buildroot GN files.
Fixes the formatting. But can back this out since it is technically
unrelated to C++20.
This commit is contained in:
Chinmay Garde 2025-09-02 11:31:21 -07:00 committed by GitHub
parent fb754dc30c
commit c6f2de7aba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 248 additions and 46 deletions

2
DEPS
View File

@ -256,7 +256,7 @@ deps = {
Var('chromium_git') + '/vulkan-deps' + '@' + '938de304bdcb33049ec39ce45f16223eb6a960b6',
'engine/src/flutter/third_party/flatbuffers':
Var('chromium_git') + '/external/github.com/google/flatbuffers' + '@' + '0a80646371179f8a7a5c1f42c31ee1d44dcf6709',
Var('chromium_git') + '/external/github.com/google/flatbuffers' + '@' + '067bfdbde9b10c1beb5d6b02d67ae9db8b96f736',
'engine/src/flutter/third_party/icu':
Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '1b2e3e8a421efae36141a7b932b41e315b089af8',

View File

@ -116,6 +116,7 @@ config("compiler") {
} else if (!is_ios && !is_wasm && !is_qnx) {
cflags += [
"-fstack-protector",
# 8 is the default, but make this explicit here so that we don't have to
# go hunting for the flag name if we ever want a value that is
# different from the default.
@ -300,7 +301,8 @@ config("compiler") {
if (wasm_use_workers) {
cflags += [ "-sWASM_WORKERS=1" ]
ldflags += [ "-sWASM_WORKERS=1" ]
} if (wasm_shared_memory) {
}
if (wasm_shared_memory) {
cflags += [ "-sSHARED_MEMORY=1" ]
ldflags += [ "-sSHARED_MEMORY=1" ]
}
@ -356,9 +358,7 @@ config("compiler") {
# Linux/Android common flags setup.
# ---------------------------------
if (is_linux || is_android || is_qnx) {
cflags += [
"-fPIC",
]
cflags += [ "-fPIC" ]
if (!is_qnx) {
cflags += [
@ -382,7 +382,7 @@ config("compiler") {
if (target_cpu == "arm64") {
qnx_arch_flags += [
"-V",
"gcc_ntoaarch64le"
"gcc_ntoaarch64le",
]
} else {
assert(false, "Unknown QNX architecture")
@ -474,20 +474,55 @@ config("compiler") {
# Fuchsia-specific flags setup.
# -----------------------------
if (is_fuchsia) {
configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:compiler"]
configs = [ "//flutter/tools/fuchsia/gn-sdk/src/config:compiler" ]
}
asmflags = cflags
}
# C++ modules (available and enabled by default in C++20 and above) are
# prohibited by the style guide.
config("cxx_disable_modules") {
disable_modules_flags = [
"-fno-modules",
# Some Clang versions do not disable ObjC modules (as tested by
# __has_feature(objc_modules)) when just -fno-modules is present.
"-Xclang",
"-fno-cxx-modules",
]
cflags_c = disable_modules_flags
cflags_cc = disable_modules_flags
cflags_objc = disable_modules_flags
cflags_objcc = disable_modules_flags
}
config("cxx_version_default") {
if (is_win) {
cc_std = [ "/std:c++17" ]
cc_std = [ "/std:c++20" ]
} else {
cc_std = [ "-std=c++17" ]
cc_std = [ "-std=c++20" ]
}
configs = [ ":cxx_disable_modules" ]
cflags_cc = cc_std
cflags_objcc = cc_std
# The following corrections are only in place for targets that have opted into
# the default version. These targets have not had to opportunity to upgrade to
# a newer version. Targets that have explicitly opted into the newer version
# must fix the errors they run into.
if (is_clang) {
extra_warning_flags_cc = [
# TODO(174665): Third-party dependency (Angle) needs to patched to work
# around this.
"-Wno-deprecated-this-capture",
]
cflags_cc += extra_warning_flags_cc
cflags_objcc += extra_warning_flags_cc
}
}
config("cxx_version_11") {
@ -528,6 +563,8 @@ config("cxx_version_20") {
}
cflags_cc = cc_std
cflags_objcc = cc_std
configs = [ ":cxx_disable_modules" ]
}
config("compiler_arm_fpu") {
@ -575,8 +612,10 @@ config("runtime_library") {
# Add libcxx[abi]/include via cflags_cc, cflags_objcc to apply to
# C++/Obj-C++ only. Adding them via include_dirs is problematic for Swift,
# whose core libraries expect the Apple SDK C++ headers, module.modulemap.
_libcxx_include = rebase_path("//flutter/third_party/libcxx/include", root_build_dir)
_libcxxabi_include = rebase_path("//flutter/third_party/libcxxabi/include", root_build_dir)
_libcxx_include =
rebase_path("//flutter/third_party/libcxx/include", root_build_dir)
_libcxxabi_include =
rebase_path("//flutter/third_party/libcxxabi/include", root_build_dir)
cflags_cc += [
"-nostdinc++",
"-I" + _libcxx_include,
@ -604,9 +643,7 @@ config("runtime_library") {
ldflags += [ "-nostdlib" ]
ldflags += [
"-Wl,--warn-shared-textrel",
]
ldflags += [ "-Wl,--warn-shared-textrel" ]
libs += [
"c",
@ -639,7 +676,7 @@ config("runtime_library") {
# Fuchsia standard library setup.
if (is_fuchsia) {
configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:runtime_library"]
configs = [ "//flutter/tools/fuchsia/gn-sdk/src/config:runtime_library" ]
}
}
@ -653,6 +690,7 @@ default_warning_flags_cc = []
if (is_qnx) {
default_warning_flags_cc += [ "-fpermissive" ]
}
if (is_win) {
default_warning_flags += [
# Permanent.
@ -1013,9 +1051,7 @@ config("no_optimize") {
# On WASM we don't want to fully deoptimize the debug build because the
# compiled binary will have some functions with too many local variables
# and Chrome will reject it.
cflags = [
"-O1",
]
cflags = [ "-O1" ]
ldflags = common_optimize_on_ldflags
} else {
cflags = [ "-O0" ]
@ -1112,6 +1148,7 @@ config("prevent_unsafe_narrowing") {
"-Wshorten-64-to-32",
"-Wimplicit-int-conversion",
"-Wsign-compare",
# Avoid bugs of the form `if (size_t i = size; i >= 0; --i)` while
# fixing types to be sign-correct.
"-Wtautological-unsigned-zero-compare",

View File

@ -15,11 +15,12 @@ source_set("flatbuffers") {
"$_src_root/include/flatbuffers/allocator.h",
"$_src_root/include/flatbuffers/array.h",
"$_src_root/include/flatbuffers/base.h",
"$_src_root/include/flatbuffers/bfbs_generator.h",
"$_src_root/include/flatbuffers/buffer.h",
"$_src_root/include/flatbuffers/buffer_ref.h",
"$_src_root/include/flatbuffers/code_generator.h",
"$_src_root/include/flatbuffers/default_allocator.h",
"$_src_root/include/flatbuffers/detached_buffer.h",
"$_src_root/include/flatbuffers/file_manager.h",
"$_src_root/include/flatbuffers/flatbuffer_builder.h",
"$_src_root/include/flatbuffers/flatbuffers.h",
"$_src_root/include/flatbuffers/flex_flat_util.h",
@ -62,18 +63,28 @@ executable("flatc") {
"$_src_root/grpc/src/compiler/swift_generator.h",
"$_src_root/grpc/src/compiler/ts_generator.cc",
"$_src_root/grpc/src/compiler/ts_generator.h",
"$_src_root/include/codegen/idl_namer.h",
"$_src_root/include/codegen/namer.h",
"$_src_root/include/codegen/python.cc",
"$_src_root/include/codegen/python.h",
"$_src_root/include/flatbuffers/code_generators.h",
"$_src_root/src/annotated_binary_text_gen.cpp",
"$_src_root/src/annotated_binary_text_gen.h",
"$_src_root/src/bfbs_gen.h",
"$_src_root/src/bfbs_gen_lua.cpp",
"$_src_root/src/bfbs_gen_lua.h",
"$_src_root/src/bfbs_gen_nim.cpp",
"$_src_root/src/bfbs_gen_nim.h",
"$_src_root/src/bfbs_namer.h",
"$_src_root/src/binary_annotator.cpp",
"$_src_root/src/binary_annotator.h",
"$_src_root/src/code_generators.cpp",
"$_src_root/src/file_binary_writer.cpp",
"$_src_root/src/file_name_saving_file_manager.cpp",
"$_src_root/src/file_writer.cpp",
"$_src_root/src/flatc.cpp",
"$_src_root/src/flatc_main.cpp",
"$_src_root/src/idl_gen_binary.cpp",
"$_src_root/src/idl_gen_cpp.cpp",
"$_src_root/src/idl_gen_csharp.cpp",
"$_src_root/src/idl_gen_dart.cpp",
@ -83,8 +94,8 @@ executable("flatc") {
"$_src_root/src/idl_gen_java.cpp",
"$_src_root/src/idl_gen_json_schema.cpp",
"$_src_root/src/idl_gen_kotlin.cpp",
"$_src_root/src/idl_gen_kotlin_kmp.cpp",
"$_src_root/src/idl_gen_lobster.cpp",
"$_src_root/src/idl_gen_lua.cpp",
"$_src_root/src/idl_gen_php.cpp",
"$_src_root/src/idl_gen_python.cpp",
"$_src_root/src/idl_gen_rust.cpp",

View File

@ -13,8 +13,6 @@ DlPaint::DlPaint(DlColor color)
draw_style_(static_cast<unsigned>(DlDrawStyle::kDefaultStyle)),
stroke_cap_(static_cast<unsigned>(DlStrokeCap::kDefaultCap)),
stroke_join_(static_cast<unsigned>(DlStrokeJoin::kDefaultJoin)),
is_anti_alias_(false),
is_invert_colors_(false),
color_(color),
stroke_width_(kDefaultWidth),
stroke_miter_(kDefaultMiter) {}

View File

@ -221,12 +221,12 @@ class DlPaint {
union {
struct {
unsigned blend_mode_ : kBlendModeBits;
unsigned draw_style_ : kDrawStyleBits;
unsigned stroke_cap_ : kStrokeCapBits;
unsigned stroke_join_ : kStrokeJoinBits;
unsigned is_anti_alias_ : 1;
unsigned is_invert_colors_ : 1;
unsigned blend_mode_ : kBlendModeBits = {};
unsigned draw_style_ : kDrawStyleBits = {};
unsigned stroke_cap_ : kStrokeCapBits = {};
unsigned stroke_join_ : kStrokeJoinBits = {};
unsigned is_anti_alias_ : 1 = {};
unsigned is_invert_colors_ : 1 = {};
};
};

View File

@ -343,7 +343,7 @@ TEST(FileTest, FileTestsWork) {
TEST(FileTest, FileTestsSupportsUnicode) {
fml::ScopedTemporaryDirectory dir;
ASSERT_TRUE(dir.fd().is_valid());
const char* filename = u8"äëïöüテスト☃";
const auto* filename = reinterpret_cast<const char*>(u8"äëïöüテスト☃");
auto fd =
fml::OpenFile(dir.fd(), filename, true, fml::FilePermission::kWrite);
ASSERT_TRUE(fd.is_valid());

View File

@ -62,7 +62,8 @@ std::unique_ptr<Screenshot> ReadTexture(
&CGColorSpaceRelease);
CGBitmapInfo bitmap_info =
texture->GetTextureDescriptor().format == PixelFormat::kB8G8R8A8UNormInt
? kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little
? static_cast<uint32_t>(kCGImageAlphaPremultipliedFirst) |
static_cast<uint32_t>(kCGBitmapByteOrder32Little)
: kCGImageAlphaPremultipliedLast;
CGContextPtr context(
CGBitmapContextCreate(

View File

@ -69,6 +69,9 @@
}
#define VULKAN_HPP_NO_EXCEPTIONS
// The spaceship operator behaves differently on 32-bit platforms.
#define VULKAN_HPP_NO_SPACESHIP_OPERATOR
#include "vulkan/vulkan.hpp" // IWYU pragma: keep.
static_assert(VK_HEADER_VERSION >= 215, "Vulkan headers must not be too old.");

View File

@ -134,22 +134,22 @@ TEST(StandardMessageCodec, CanEncodeAndDecodeDouble) {
TEST(StandardMessageCodec, CanEncodeAndDecodeString) {
std::vector<uint8_t> bytes = {0x07, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64};
CheckEncodeDecode(EncodableValue(u8"hello world"), bytes);
CheckEncodeDecode(EncodableValue("hello world"), bytes);
}
TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonAsciiCodePoint) {
std::vector<uint8_t> bytes = {0x07, 0x05, 0x68, 0xe2, 0x98, 0xba, 0x77};
CheckEncodeDecode(EncodableValue(u8"h\u263Aw"), bytes);
CheckEncodeDecode(EncodableValue("h\u263Aw"), bytes);
}
TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonBMPCodePoint) {
std::vector<uint8_t> bytes = {0x07, 0x06, 0x68, 0xf0, 0x9f, 0x98, 0x82, 0x77};
CheckEncodeDecode(EncodableValue(u8"h\U0001F602w"), bytes);
CheckEncodeDecode(EncodableValue("h\U0001F602w"), bytes);
}
TEST(StandardMessageCodec, CanEncodeAndDecodeEmptyString) {
std::vector<uint8_t> bytes = {0x07, 0x00};
CheckEncodeDecode(EncodableValue(u8""), bytes);
CheckEncodeDecode(EncodableValue(""), bytes);
}
TEST(StandardMessageCodec, CanEncodeAndDecodeList) {

View File

@ -3812,8 +3812,10 @@ fml::RefPtr<fml::TaskRunner> GetDefaultTaskRunner() {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
// Draw the pixel on `point` in the context.
CGContextRef context = CGBitmapContextCreate(
pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast);
CGContextRef context =
CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace,
static_cast<uint32_t>(kCGBitmapAlphaInfoMask) &
static_cast<uint32_t>(kCGImageAlphaPremultipliedLast));
CGContextTranslateCTM(context, -point.x, -point.y);
[view.layer renderInContext:context];

View File

@ -939,7 +939,8 @@ TEST_F(FlutterViewControllerTest, testViewControllerIsReleased) {
CGEventRef cgEventDiscreteShift =
CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 1, 0);
CGEventSetType(cgEventDiscreteShift, kCGEventScrollWheel);
CGEventSetFlags(cgEventDiscreteShift, kCGEventFlagMaskShift | flutter::kModifierFlagShiftLeft);
CGEventSetFlags(cgEventDiscreteShift, static_cast<uint64_t>(kCGEventFlagMaskShift) |
static_cast<uint64_t>(flutter::kModifierFlagShiftLeft));
CGEventSetIntegerValueField(cgEventDiscreteShift, kCGScrollWheelEventIsContinuous, 0);
CGEventSetIntegerValueField(cgEventDiscreteShift, kCGScrollWheelEventDeltaAxis2,
0); // scroll_delta_x

View File

@ -73,6 +73,8 @@ source_set("flutter_glfw") {
"IOKit.framework",
]
}
cflags_cc = [ "-Wno-deprecated-declarations" ]
}
test_fixtures("flutter_glfw_fixtures") {

View File

@ -75,6 +75,12 @@ config("relative_flutter_linux_headers") {
include_dirs = [ "public" ]
}
config("disable_warnings") {
warning_flags = [ "-Wno-deprecated-volatile" ]
cflags = warning_flags
cflags_cc = warning_flags
}
source_set("flutter_linux_sources") {
public = _public_headers + [
"fl_binary_messenger_private.h",
@ -99,6 +105,8 @@ source_set("flutter_linux_sources") {
configs += [ "//flutter/shell/platform/linux/config:gtk" ]
public_configs = [ ":disable_warnings" ]
sources = [
"fl_accessible_node.cc",
"fl_accessible_text_field.cc",

View File

@ -125,6 +125,8 @@ source_set("flutter_windows_source") {
"text_input_manager.h",
"text_input_plugin.cc",
"text_input_plugin.h",
"wchar_util.cc",
"wchar_util.h",
"window_binding_handler.h",
"window_binding_handler_delegate.h",
"window_manager.cc",

View File

@ -8,6 +8,7 @@
#include "flutter/shell/platform/windows/direct_manipulation.h"
#include "flutter/shell/platform/windows/flutter_window.h"
#include "flutter/shell/platform/windows/wchar_util.h"
#include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
#define RETURN_IF_FAILED(operation) \
@ -259,7 +260,7 @@ void DirectManipulationOwner::Update() {
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<LPWSTR>(&message), 0, NULL);
FML_LOG(ERROR) << message;
FML_LOG(ERROR) << WCharBufferToString(message);
}
}
}

View File

@ -69,11 +69,11 @@ UniqueAotDataPtr FlutterProjectBundle::LoadAotData(
return UniqueAotDataPtr(nullptr, nullptr);
}
if (!std::filesystem::exists(aot_library_path_)) {
FML_LOG(ERROR) << "Can't load AOT data from "
<< aot_library_path_.u8string() << "; no such file.";
FML_LOG(ERROR) << "Can't load AOT data from " << aot_library_path_
<< "; no such file.";
return UniqueAotDataPtr(nullptr, nullptr);
}
std::string path_string = aot_library_path_.u8string();
std::string path_string = aot_library_path_.string();
FlutterEngineAOTDataSource source = {};
source.type = kFlutterEngineAOTDataSourceTypeElfPath;
source.elf_path = path_string.c_str();

View File

@ -274,8 +274,8 @@ bool FlutterWindowsEngine::Run(std::string_view entrypoint) {
FML_LOG(ERROR) << "Missing or unresolvable paths to assets.";
return false;
}
std::string assets_path_string = project_->assets_path().u8string();
std::string icu_path_string = project_->icu_path().u8string();
std::string assets_path_string = project_->assets_path().string();
std::string icu_path_string = project_->icu_path().string();
if (embedder_api_.RunsAOTCompiledDartCode()) {
aot_data_ = project_->LoadAotData(embedder_api_);
if (!aot_data_) {

View File

@ -11,6 +11,7 @@
#include "flutter/shell/platform/windows/flutter_window.h"
#include "flutter/shell/platform/windows/flutter_windows_view_controller.h"
#include "flutter/shell/platform/windows/rect_helper.h"
#include "flutter/shell/platform/windows/wchar_util.h"
#include "flutter/shell/platform/windows/window_manager.h"
namespace {
@ -317,8 +318,9 @@ std::unique_ptr<HostWindow> HostWindow::CreateRegularWindow(
window_class.lpszClassName = kWindowClassName;
if (!RegisterClassEx(&window_class)) {
FML_LOG(ERROR) << "Cannot register window class " << kWindowClassName
<< ": " << GetLastErrorAsString();
FML_LOG(ERROR) << "Cannot register window class "
<< WCharBufferToString(kWindowClassName) << ": "
<< GetLastErrorAsString();
return nullptr;
}
}

View File

@ -0,0 +1,42 @@
// 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/windows/wchar_util.h"
#include <dwmapi.h>
namespace flutter {
std::string WCharBufferToString(const wchar_t* wstr) {
if (!wstr) {
return "";
}
int buffer_size = WideCharToMultiByte(CP_UTF8, //
0, //
wstr, //
-1, //
nullptr, //
0, //
nullptr, //
nullptr //
);
if (buffer_size <= 0) {
return "";
}
std::string result(buffer_size - 1, 0);
WideCharToMultiByte(CP_UTF8, //
0, //
wstr, //
-1, //
result.data(), //
buffer_size, //
nullptr, //
nullptr //
);
return result;
}
} // namespace flutter

View File

@ -0,0 +1,29 @@
// 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.
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_
#define FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_
#include <string>
namespace flutter {
//------------------------------------------------------------------------------
/// @brief Convert a null terminated wchar_t buffer to a std::string using
/// Windows utilities.
///
/// The reliance on wchar_t buffers is problematic on C++20 since
/// their interop with standard library components has been
/// deprecated/removed.
///
/// @param[in] wstr The null terminated buffer.
///
/// @return The converted string if conversion is possible. Empty string
/// otherwise.
///
std::string WCharBufferToString(const wchar_t* wstr);
} // namespace flutter
#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_

View File

@ -34764,6 +34764,22 @@ Copyright 2023 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--------------------------------------------------------------------------------
flatbuffers
Copyright 2023 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--------------------------------------------------------------------------------
cpu_features
Copyright 2023 Google LLC
@ -34972,6 +34988,22 @@ Copyright 2024 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--------------------------------------------------------------------------------
flatbuffers
Copyright 2024 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--------------------------------------------------------------------------------
skia
Copyright 2024 Google LLC

View File

@ -113,6 +113,16 @@ class AXPositionTest : public testing::Test, public TestAXTreeManager {
struct ExpandToEnclosingTextBoundaryTestParam {
ExpandToEnclosingTextBoundaryTestParam() = default;
ExpandToEnclosingTextBoundaryTestParam(
ax::mojom::TextBoundary p_boundary,
AXRangeExpandBehavior p_expand_behavior,
std::string p_expected_anchor_position,
std::string p_expected_focus_position)
: boundary(p_boundary),
expand_behavior(p_expand_behavior),
expected_anchor_position(std::move(p_expected_anchor_position)),
expected_focus_position(std::move(p_expected_focus_position)) {}
// Required by GTest framework.
ExpandToEnclosingTextBoundaryTestParam(
const ExpandToEnclosingTextBoundaryTestParam& other) = default;
@ -157,6 +167,15 @@ class AXPositionExpandToEnclosingTextBoundaryTestWithParam
struct CreatePositionAtTextBoundaryTestParam {
CreatePositionAtTextBoundaryTestParam() = default;
CreatePositionAtTextBoundaryTestParam(ax::mojom::TextBoundary p_boundary,
ax::mojom::MoveDirection p_direction,
AXBoundaryBehavior p_boundary_behavior,
std::string p_expected_text_position)
: boundary(p_boundary),
direction(p_direction),
boundary_behavior(p_boundary_behavior),
expected_text_position(std::move(p_expected_text_position)) {}
// Required by GTest framework.
CreatePositionAtTextBoundaryTestParam(
const CreatePositionAtTextBoundaryTestParam& other) = default;
@ -203,6 +222,16 @@ class AXPositionCreatePositionAtTextBoundaryTestWithParam
struct TextNavigationTestParam {
TextNavigationTestParam() = default;
TextNavigationTestParam(
std::function<TestPositionType(const TestPositionType&)> p_TestMethod,
AXNode::AXID p_start_node_id,
int p_start_offset,
std::vector<std::string> p_expectations)
: TestMethod(std::move(p_TestMethod)),
start_node_id(p_start_node_id),
start_offset(p_start_offset),
expectations(std::move(p_expectations)) {}
// Required by GTest framework.
TextNavigationTestParam(const TextNavigationTestParam& other) = default;
TextNavigationTestParam& operator=(const TextNavigationTestParam& other) =

View File

@ -51,7 +51,7 @@ bool TemplaterMain(const fml::CommandLine& command_line) {
rendered_template.size()};
auto current_dir =
fml::OpenDirectory(std::filesystem::current_path().u8string().c_str(),
fml::OpenDirectory(std::filesystem::current_path().string().c_str(),
false, fml::FilePermission::kReadWrite);
if (!current_dir.is_valid()) {
FML_LOG(ERROR) << "Could not open current directory.";

View File

@ -19,6 +19,7 @@
namespace flutter {
namespace testing {
[[maybe_unused]]
static const std::string kEmojiFontFile =
#if FML_OS_MACOSX
"Apple Color Emoji.ttc";
@ -26,6 +27,7 @@ static const std::string kEmojiFontFile =
"NotoColorEmoji.ttf";
#endif
[[maybe_unused]]
static const std::string kEmojiFontName =
#if FML_OS_MACOSX
"Apple Color Emoji";