Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 523e0ba

Browse files
committed
Add test
1 parent d45d1bb commit 523e0ba

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ FILE: ../../../flutter/impeller/compiler/source_options.h
11231123
FILE: ../../../flutter/impeller/compiler/spirv_sksl.cc
11241124
FILE: ../../../flutter/impeller/compiler/spirv_sksl.h
11251125
FILE: ../../../flutter/impeller/compiler/switches.cc
1126+
FILE: ../../../flutter/impeller/compiler/switches_unittests.cc
11261127
FILE: ../../../flutter/impeller/compiler/switches.h
11271128
FILE: ../../../flutter/impeller/compiler/types.cc
11281129
FILE: ../../../flutter/impeller/compiler/types.h

impeller/compiler/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ impeller_component("compiler_unittests") {
120120
"compiler_test.cc",
121121
"compiler_test.h",
122122
"compiler_unittests.cc",
123+
"switches_unittests.cc",
123124
]
124125

125126
deps = [
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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/fml/command_line.h"
6+
#include "flutter/fml/file.h"
7+
#include "flutter/testing/testing.h"
8+
#include "impeller/compiler/switches.h"
9+
#include "impeller/compiler/utilities.h"
10+
11+
namespace impeller {
12+
namespace compiler {
13+
namespace testing {
14+
15+
TEST(SwitchesTest, DoesntMangleUnicodeIncludes) {
16+
const char* directory_name = "test_shader_include_�";
17+
fml::CreateDirectory(flutter::testing::OpenFixturesDirectory(),
18+
{directory_name}, fml::FilePermission::kRead);
19+
20+
auto include_path =
21+
std::string(flutter::testing::GetFixturesPath()) + "/" + directory_name;
22+
auto include_option = "--include=" + include_path;
23+
24+
const auto cl = fml::CommandLineFromInitializerList(
25+
{"impellerc", "--opengl-desktop", "--input=input.vert",
26+
"--sl=output.vert", "--spirv=output.spirv", include_option.c_str()});
27+
Switches switches(cl);
28+
ASSERT_TRUE(switches.AreValid(std::cout));
29+
ASSERT_EQ(switches.include_directories.size(), 1u);
30+
ASSERT_NE(switches.include_directories[0].dir, nullptr);
31+
ASSERT_EQ(switches.include_directories[0].name, include_path);
32+
}
33+
34+
} // namespace testing
35+
} // namespace compiler
36+
} // namespace impeller

0 commit comments

Comments
 (0)