diff options
| author | David Snopek <dsnopek@gmail.com> | 2024-10-29 13:09:45 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 13:09:45 -0500 |
| commit | 7fca5458854c30fed862609cf516910e432508c1 (patch) | |
| tree | 957304f3c4004fd947c5a83c60273a40c4916f5f /test | |
| parent | dfdc0474597a5c7918a3101529f0e2c69cf18d8b (diff) | |
| parent | 536ea8561e00b8d6183ddc522476dd232c1d3bef (diff) | |
| download | redot-cpp-7fca5458854c30fed862609cf516910e432508c1.tar.gz | |
Merge pull request #1574 from dsnopek/unicode-class-names
Allow unicode class names
Diffstat (limited to 'test')
| -rw-r--r-- | test/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | test/project/main.gd | 4 | ||||
| -rw-r--r-- | test/src/example.cpp | 8 | ||||
| -rw-r--r-- | test/src/example.h | 10 | ||||
| -rw-r--r-- | test/src/register_types.cpp | 1 |
5 files changed, 24 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 42ea6e0..f1c4c0d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,6 +38,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # using Visual Studio C++ set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND") + set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /utf-8") if(CMAKE_BUILD_TYPE MATCHES Debug) set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi diff --git a/test/project/main.gd b/test/project/main.gd index 386d188..b75dc6e 100644 --- a/test/project/main.gd +++ b/test/project/main.gd @@ -279,6 +279,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): diff --git a/test/src/example.cpp b/test/src/example.cpp index 692d004..f51db57 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -755,3 +755,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"; +} diff --git a/test/src/example.h b/test/src/example.h index a28deff..3ce390a 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -275,4 +275,14 @@ public: ~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 diff --git a/test/src/register_types.cpp b/test/src/register_types.cpp index 7cfe689..d9290c8 100644 --- a/test/src/register_types.cpp +++ b/test/src/register_types.cpp @@ -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) { |
