diff --git a/test/build_profile.json b/test/build_profile.json index 57d847a11..b4de43479 100644 --- a/test/build_profile.json +++ b/test/build_profile.json @@ -8,6 +8,7 @@ "OS", "TileMap", "TileSet", + "Tween", "Viewport" ] } diff --git a/test/project/main.gd b/test/project/main.gd index 3d9ca7f34..c6edaac40 100644 --- a/test/project/main.gd +++ b/test/project/main.gd @@ -225,6 +225,9 @@ func _ready(): assert_equal(new_tilemap.tile_set, new_tileset) new_tilemap.queue_free() + # Creates a Tween and checks that it's valid. Improper refcount handling will crash now or at shutdown. + assert_equal(example.test_tween_smoke_test(), true) + # Test variant call. var test_obj = TestClass.new() assert_equal(example.test_variant_call(test_obj), "hello world") diff --git a/test/src/example.cpp b/test/src/example.cpp index 9d3e62b91..f32203c1f 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -222,6 +222,7 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_add_child", "node"), &Example::test_add_child); ClassDB::bind_method(D_METHOD("test_set_tileset", "tilemap", "tileset"), &Example::test_set_tileset); + ClassDB::bind_method(D_METHOD("test_tween_smoke_test"), &Example::test_tween_smoke_test); ClassDB::bind_method(D_METHOD("test_variant_call", "variant"), &Example::test_variant_call); @@ -616,6 +617,11 @@ void Example::test_set_tileset(TileMap *p_tilemap, const Ref &p_tileset p_tilemap->set_tileset(p_tileset); } +bool Example::test_tween_smoke_test() { + Ref tween = create_tween(); + return tween.is_valid() && tween->is_class("Tween") && tween->get_reference_count() > 1; +} + Variant Example::test_variant_call(Variant p_variant) { return p_variant.call("test", "hello"); } diff --git a/test/src/example.h b/test/src/example.h index 403d59f79..7dfe6d663 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -154,6 +155,7 @@ class Example : public Control { void test_add_child(Node *p_node); void test_set_tileset(TileMap *p_tilemap, const Ref &p_tileset) const; + bool test_tween_smoke_test(); Variant test_variant_call(Variant p_variant);