forked from godot-rust/gdnative
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
50 lines (35 loc) · 1.2 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use gdnative::*;
#[no_mangle]
pub extern "C" fn run_tests(
_data: *mut gdnative::libc::c_void,
_args: *mut gdnative::sys::godot_array
) -> gdnative::sys::godot_variant {
let mut status = true;
status &= gdnative::test_string();
status &= gdnative::test_dictionary();
// status &= gdnative::test_dictionary_clone_clear();
status &= gdnative::test_array();
// status &= gdnative::test_array_clone_clear();
status &= gdnative::test_variant_nil();
status &= gdnative::test_variant_i64();
status &= gdnative::test_vector2_variants();
status &= gdnative::test_vector3_variants();
status &= test_constructor();
gdnative::Variant::from_bool(status).forget()
}
fn test_constructor() -> bool {
println!(" -- test_constructor");
use gdnative::{GDNativeLibrary, Path2D, FreeOnDrop};
// Just create an object and call a method as a sanity check for the
// generated constructors.
let lib = GDNativeLibrary::new();
let _ = lib.is_singleton();
unsafe {
let path = FreeOnDrop::new(Path2D::new());
let _ = path.get_z_index();
}
return true;
}
godot_gdnative_init!();
godot_nativescript_init!();
godot_gdnative_terminate!();