|
8 | 8 | use std::str::FromStr;
|
9 | 9 |
|
10 | 10 | use godot::builtin::{vslice, NodePath};
|
11 |
| -use godot::classes::{Node, Node3D, PackedScene, SceneTree}; |
12 |
| -use godot::global; |
13 |
| -use godot::obj::{NewAlloc, NewGd}; |
| 11 | +use godot::classes::{Node, Node3D}; |
| 12 | +use godot::obj::NewAlloc; |
14 | 13 |
|
15 | 14 | use crate::framework::{itest, TestContext};
|
16 | 15 |
|
@@ -60,35 +59,18 @@ fn node_path_from_str(ctx: &TestContext) {
|
60 | 59 | );
|
61 | 60 | }
|
62 | 61 |
|
63 |
| -#[itest(skip)] |
64 |
| -fn node_scene_tree() { |
65 |
| - let mut child = Node::new_alloc(); |
66 |
| - child.set_name("kid"); |
67 |
| - |
68 |
| - let mut parent = Node::new_alloc(); |
69 |
| - parent.set_name("parent"); |
70 |
| - parent.add_child(&child); |
71 |
| - |
72 |
| - let mut scene = PackedScene::new_gd(); |
73 |
| - let err = scene.pack(&parent); |
74 |
| - assert_eq!(err, global::Error::OK); |
75 |
| - |
76 |
| - let mut tree = SceneTree::new_alloc(); |
77 |
| - let err = tree.change_scene_to_packed(&scene); |
78 |
| - assert_eq!(err, global::Error::OK); |
79 |
| - |
80 |
| - // Note: parent + child are not owned by PackedScene, thus need to be freed |
81 |
| - // (verified by porting this very test to GDScript) |
82 |
| - tree.free(); |
83 |
| - parent.free(); |
84 |
| - child.free(); |
85 |
| -} |
86 |
| - |
| 62 | +// Regression test against call_group() crashing, see https://github.com/godot-rust/gdext/pull/167. |
| 63 | +// https://github.com/godot-rust/gdext/commit/207c4e72ac0c24cfb83bab16f856dd09ebc8671c |
87 | 64 | #[itest]
|
88 | 65 | fn node_call_group(ctx: &TestContext) {
|
89 | 66 | let mut node = ctx.scene_tree.clone();
|
90 | 67 | let mut tree = node.get_tree().unwrap();
|
91 | 68 |
|
92 | 69 | node.add_to_group("group");
|
93 |
| - tree.call_group("group", "set_name", vslice!["name"]); |
| 70 | + |
| 71 | + tree.call_group("group", "set_meta", vslice!["something", true]); |
| 72 | + assert!(node.has_meta("something")); |
| 73 | + |
| 74 | + tree.call_group("group", "remove_meta", vslice!["something"]); |
| 75 | + assert!(!node.has_meta("something")); |
94 | 76 | }
|
0 commit comments