Skip to content

Commit

Permalink
Allow unicode class names
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Sep 11, 2024
1 parent d477589 commit d8c21f3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ env:
GODOT_BASE_BRANCH: master
# Used to select the version of Godot to run the tests with.
GODOT_TEST_VERSION: master
# Use UTF-8 on Linux.
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
Expand Down
2 changes: 1 addition & 1 deletion include/godot_cpp/classes/wrapped.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public:
} \
\
static const ::godot::StringName &get_class_static() { \
static const ::godot::StringName string_name = ::godot::StringName(#m_class); \
static const ::godot::StringName string_name = ::godot::StringName(U## #m_class); \
return string_name; \
} \
\
Expand Down
4 changes: 4 additions & 0 deletions test/project/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ func _ready():
assert_equal(library_path, ProjectSettings.globalize_path(library_path))
assert_equal(FileAccess.file_exists(library_path), true)

# Test a class with a unicode name.
var przykład = ExamplePrzykład.new()
assert_equal(przykład.get_the_word(), "słowo to przykład")

exit_with_status()

func _on_Example_custom_signal(signal_name, value):
Expand Down
8 changes: 8 additions & 0 deletions test/src/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,3 +736,11 @@ ExampleRuntime::ExampleRuntime() {

ExampleRuntime::~ExampleRuntime() {
}

void ExamplePrzykład::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word);
}

String ExamplePrzykład::get_the_word() const {
return U"słowo to przykład";
}
10 changes: 10 additions & 0 deletions test/src/example.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,14 @@ class ExampleRuntime : public Node {
~ExampleRuntime();
};

class ExamplePrzykład : public RefCounted {
GDCLASS(ExamplePrzykład, RefCounted);

protected:
static void _bind_methods();

public:
String get_the_word() const;
};

#endif // EXAMPLE_CLASS_H
1 change: 1 addition & 0 deletions test/src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void initialize_example_module(ModuleInitializationLevel p_level) {
GDREGISTER_CLASS(ExampleBase);
GDREGISTER_CLASS(ExampleChild);
GDREGISTER_RUNTIME_CLASS(ExampleRuntime);
GDREGISTER_CLASS(ExamplePrzykład);
}

void uninitialize_example_module(ModuleInitializationLevel p_level) {
Expand Down

0 comments on commit d8c21f3

Please sign in to comment.