Skip to content

Commit 7fca545

Browse files
authored
Merge pull request #1574 from dsnopek/unicode-class-names
Allow unicode class names
2 parents dfdc047 + 536ea85 commit 7fca545

File tree

7 files changed

+34
-7
lines changed

7 files changed

+34
-7
lines changed

.github/workflows/ci.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ env:
66
GODOT_BASE_BRANCH: master
77
# Used to select the version of Godot to run the tests with.
88
GODOT_TEST_VERSION: master
9+
# Use UTF-8 on Linux.
10+
LANG: en_US.UTF-8
11+
LC_ALL: en_US.UTF-8
912

1013
concurrency:
1114
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
@@ -20,15 +23,15 @@ jobs:
2023
matrix:
2124
include:
2225
- name: 🐧 Linux (GCC)
23-
os: ubuntu-20.04
26+
os: ubuntu-22.04
2427
platform: linux
2528
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
2629
artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
2730
run-tests: true
2831
cache-name: linux-x86_64
2932

3033
- name: 🐧 Linux (GCC, Double Precision)
31-
os: ubuntu-20.04
34+
os: ubuntu-22.04
3235
platform: linux
3336
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
3437
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
@@ -63,7 +66,7 @@ jobs:
6366
cache-name: macos-universal
6467

6568
- name: 🤖 Android (arm64)
66-
os: ubuntu-20.04
69+
os: ubuntu-22.04
6770
platform: android
6871
artifact-name: godot-cpp-android-arm64-release
6972
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
@@ -81,7 +84,7 @@ jobs:
8184
cache-name: ios-arm64
8285

8386
- name: 🌐 Web (wasm32)
84-
os: ubuntu-20.04
87+
os: ubuntu-22.04
8588
platform: web
8689
artifact-name: godot-cpp-web-wasm32-release
8790
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
@@ -206,7 +209,7 @@ jobs:
206209

207210
linux-cmake:
208211
name: 🐧 Build (Linux, GCC, CMake)
209-
runs-on: ubuntu-20.04
212+
runs-on: ubuntu-22.04
210213
steps:
211214
- name: Checkout
212215
uses: actions/checkout@v4
@@ -230,7 +233,7 @@ jobs:
230233
231234
linux-cmake-ninja:
232235
name: 🐧 Build (Linux, GCC, CMake Ninja)
233-
runs-on: ubuntu-20.04
236+
runs-on: ubuntu-22.04
234237
steps:
235238
- name: Checkout
236239
uses: actions/checkout@v4

include/godot_cpp/classes/wrapped.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public:
245245
} \
246246
\
247247
static const ::godot::StringName &get_class_static() { \
248-
static const ::godot::StringName string_name = ::godot::StringName(#m_class); \
248+
static const ::godot::StringName string_name = ::godot::StringName(U## #m_class); \
249249
return string_name; \
250250
} \
251251
\

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
3838
# using Visual Studio C++
3939
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP
4040
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND")
41+
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /utf-8")
4142

4243
if(CMAKE_BUILD_TYPE MATCHES Debug)
4344
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi

test/project/main.gd

+4
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ func _ready():
279279
assert_equal(library_path, ProjectSettings.globalize_path(library_path))
280280
assert_equal(FileAccess.file_exists(library_path), true)
281281

282+
# Test a class with a unicode name.
283+
var przykład = ExamplePrzykład.new()
284+
assert_equal(przykład.get_the_word(), "słowo to przykład")
285+
282286
exit_with_status()
283287

284288
func _on_Example_custom_signal(signal_name, value):

test/src/example.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -755,3 +755,11 @@ ExampleRuntime::ExampleRuntime() {
755755

756756
ExampleRuntime::~ExampleRuntime() {
757757
}
758+
759+
void ExamplePrzykład::_bind_methods() {
760+
ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word);
761+
}
762+
763+
String ExamplePrzykład::get_the_word() const {
764+
return U"słowo to przykład";
765+
}

test/src/example.h

+10
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,14 @@ class ExampleRuntime : public Node {
275275
~ExampleRuntime();
276276
};
277277

278+
class ExamplePrzykład : public RefCounted {
279+
GDCLASS(ExamplePrzykład, RefCounted);
280+
281+
protected:
282+
static void _bind_methods();
283+
284+
public:
285+
String get_the_word() const;
286+
};
287+
278288
#endif // EXAMPLE_CLASS_H

test/src/register_types.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void initialize_example_module(ModuleInitializationLevel p_level) {
3030
GDREGISTER_CLASS(ExampleBase);
3131
GDREGISTER_CLASS(ExampleChild);
3232
GDREGISTER_RUNTIME_CLASS(ExampleRuntime);
33+
GDREGISTER_CLASS(ExamplePrzykład);
3334
}
3435

3536
void uninitialize_example_module(ModuleInitializationLevel p_level) {

0 commit comments

Comments
 (0)