diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-09-24 17:11:50 +0200 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2021-09-27 23:08:12 +1000 |
commit | 59d38a4119471cd68db70ece12d5dd43f4b6e026 (patch) | |
tree | cc01db88d7625df0a0cd5246887fa8171d2a8913 /test/src/example.cpp | |
parent | 42dd64f22fc0cddaec4d2ba57640fa3adaae8823 (diff) | |
download | redot-cpp-59d38a4119471cd68db70ece12d5dd43f4b6e026.tar.gz |
Add test for extended object creation/deletion.
Diffstat (limited to 'test/src/example.cpp')
-rw-r--r-- | test/src/example.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp index 43ad8b3..e3ed316 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -38,12 +38,21 @@ using namespace godot; +ExampleRef::ExampleRef() { + UtilityFunctions::print("ExampleRef created."); +} + +ExampleRef::~ExampleRef() { + UtilityFunctions::print("ExampleRef destroyed."); +} + void Example::_bind_methods() { // Methods. ClassDB::bind_method(D_METHOD("simple_func"), &Example::simple_func); ClassDB::bind_method(D_METHOD("simple_const_func"), &Example::simple_const_func); ClassDB::bind_method(D_METHOD("return_something"), &Example::return_something); ClassDB::bind_method(D_METHOD("return_something_const"), &Example::return_something_const); + ClassDB::bind_method(D_METHOD("return_extended_ref"), &Example::return_extended_ref); { MethodInfo mi; @@ -94,6 +103,10 @@ Viewport *Example::return_something_const() const { return nullptr; } +ExampleRef *Example::return_extended_ref() const { + return memnew(ExampleRef()); +} + Variant Example::varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error) { UtilityFunctions::print("Varargs called with ", String::num(arg_count), " arguments"); return arg_count; |