summaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/example.cpp13
-rw-r--r--test/src/example.h12
-rw-r--r--test/src/register_types.cpp1
3 files changed, 26 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;
diff --git a/test/src/example.h b/test/src/example.h
index 6db6f9b..e72051b 100644
--- a/test/src/example.h
+++ b/test/src/example.h
@@ -39,6 +39,17 @@
using namespace godot;
+class ExampleRef : public RefCounted {
+ GDCLASS(ExampleRef, RefCounted);
+
+protected:
+ static void _bind_methods() {}
+
+public:
+ ExampleRef();
+ ~ExampleRef();
+};
+
class Example : public Control {
GDCLASS(Example, Control);
@@ -64,6 +75,7 @@ public:
void simple_const_func() const;
String return_something(const String &base);
Viewport *return_something_const() const;
+ ExampleRef *return_extended_ref() const;
Variant varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error);
void emit_custom_signal(const String &name, int value);
diff --git a/test/src/register_types.cpp b/test/src/register_types.cpp
index 35f2693..52e5b57 100644
--- a/test/src/register_types.cpp
+++ b/test/src/register_types.cpp
@@ -41,6 +41,7 @@
using namespace godot;
void register_example_types() {
+ ClassDB::register_class<ExampleRef>();
ClassDB::register_class<Example>();
}