Skip to content

Commit 3356a35

Browse files
committed
Allow unicode class names
1 parent d477589 commit 3356a35

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-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
@@ -250,7 +250,7 @@ public:
250250
} \
251251
\
252252
static const ::godot::StringName &get_class_static() { \
253-
static const ::godot::StringName string_name = ::godot::StringName(#m_class); \
253+
static const ::godot::StringName string_name = ::godot::StringName(U## #m_class); \
254254
return string_name; \
255255
} \
256256
\

test/project/main.gd

+4
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ func _ready():
276276
assert_equal(library_path, ProjectSettings.globalize_path(library_path))
277277
assert_equal(FileAccess.file_exists(library_path), true)
278278

279+
# Test a class with a unicode name.
280+
var przykład = ExamplePrzykład.new()
281+
assert_equal(przykład.get_the_word(), "słowo to przykład")
282+
279283
exit_with_status()
280284

281285
func _on_Example_custom_signal(signal_name, value):

test/src/example.cpp

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

737737
ExampleRuntime::~ExampleRuntime() {
738738
}
739+
740+
void ExamplePrzykład::_bind_methods() {
741+
ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word);
742+
}
743+
744+
String ExamplePrzykład::get_the_word() const {
745+
return U"słowo to przykład";
746+
}

test/src/example.h

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

276+
class ExamplePrzykład : public RefCounted {
277+
GDCLASS(ExamplePrzykład, RefCounted);
278+
279+
protected:
280+
static void _bind_methods();
281+
282+
public:
283+
String get_the_word() const;
284+
};
285+
276286
#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)