@@ -10,29 +10,30 @@ use godot::builtin::varray;
10
10
use godot:: classes:: input:: CursorShape ;
11
11
use godot:: classes:: mesh:: PrimitiveType ;
12
12
use godot:: classes:: { time, ArrayMesh } ;
13
- use godot:: global:: { Orientation , Key } ;
13
+ use godot:: global:: { Key , Orientation } ;
14
+ use godot:: obj:: NewGd ;
14
15
use std:: collections:: HashSet ;
15
16
16
17
#[ itest]
17
18
fn enum_ords ( ) {
18
19
use godot:: obj:: EngineEnum ;
19
- assert_eq ! ( CursorShape :: CURSOR_ARROW . ord( ) , 0 ) ;
20
- assert_eq ! ( CursorShape :: CURSOR_IBEAM . ord( ) , 1 ) ;
21
- assert_eq ! ( CursorShape :: CURSOR_POINTING_HAND . ord( ) , 2 ) ;
22
- assert_eq ! ( CursorShape :: CURSOR_CROSS . ord( ) , 3 ) ;
23
- assert_eq ! ( CursorShape :: CURSOR_WAIT . ord( ) , 4 ) ;
24
- assert_eq ! ( CursorShape :: CURSOR_BUSY . ord( ) , 5 ) ;
25
- assert_eq ! ( CursorShape :: CURSOR_DRAG . ord( ) , 6 ) ;
26
- assert_eq ! ( CursorShape :: CURSOR_CAN_DROP . ord( ) , 7 ) ;
27
- assert_eq ! ( CursorShape :: CURSOR_FORBIDDEN . ord( ) , 8 ) ;
28
- assert_eq ! ( CursorShape :: CURSOR_VSIZE . ord( ) , 9 ) ;
29
- assert_eq ! ( CursorShape :: CURSOR_HSIZE . ord( ) , 10 ) ;
30
- assert_eq ! ( CursorShape :: CURSOR_BDIAGSIZE . ord( ) , 11 ) ;
31
- assert_eq ! ( CursorShape :: CURSOR_FDIAGSIZE . ord( ) , 12 ) ;
32
- assert_eq ! ( CursorShape :: CURSOR_MOVE . ord( ) , 13 ) ;
33
- assert_eq ! ( CursorShape :: CURSOR_VSPLIT . ord( ) , 14 ) ;
34
- assert_eq ! ( CursorShape :: CURSOR_HSPLIT . ord( ) , 15 ) ;
35
- assert_eq ! ( CursorShape :: CURSOR_HELP . ord( ) , 16 ) ;
20
+ assert_eq ! ( CursorShape :: ARROW . ord( ) , 0 ) ;
21
+ assert_eq ! ( CursorShape :: IBEAM . ord( ) , 1 ) ;
22
+ assert_eq ! ( CursorShape :: POINTING_HAND . ord( ) , 2 ) ;
23
+ assert_eq ! ( CursorShape :: CROSS . ord( ) , 3 ) ;
24
+ assert_eq ! ( CursorShape :: WAIT . ord( ) , 4 ) ;
25
+ assert_eq ! ( CursorShape :: BUSY . ord( ) , 5 ) ;
26
+ assert_eq ! ( CursorShape :: DRAG . ord( ) , 6 ) ;
27
+ assert_eq ! ( CursorShape :: CAN_DROP . ord( ) , 7 ) ;
28
+ assert_eq ! ( CursorShape :: FORBIDDEN . ord( ) , 8 ) ;
29
+ assert_eq ! ( CursorShape :: VSIZE . ord( ) , 9 ) ;
30
+ assert_eq ! ( CursorShape :: HSIZE . ord( ) , 10 ) ;
31
+ assert_eq ! ( CursorShape :: BDIAGSIZE . ord( ) , 11 ) ;
32
+ assert_eq ! ( CursorShape :: FDIAGSIZE . ord( ) , 12 ) ;
33
+ assert_eq ! ( CursorShape :: MOVE . ord( ) , 13 ) ;
34
+ assert_eq ! ( CursorShape :: VSPLIT . ord( ) , 14 ) ;
35
+ assert_eq ! ( CursorShape :: HSPLIT . ord( ) , 15 ) ;
36
+ assert_eq ! ( CursorShape :: HELP . ord( ) , 16 ) ;
36
37
}
37
38
38
39
#[ itest]
@@ -48,18 +49,18 @@ fn enum_equality() {
48
49
#[ itest]
49
50
fn enum_hash ( ) {
50
51
let mut months = HashSet :: new ( ) ;
51
- months. insert ( time:: Month :: MONTH_JANUARY ) ;
52
- months. insert ( time:: Month :: MONTH_FEBRUARY ) ;
53
- months. insert ( time:: Month :: MONTH_MARCH ) ;
54
- months. insert ( time:: Month :: MONTH_APRIL ) ;
55
- months. insert ( time:: Month :: MONTH_MAY ) ;
56
- months. insert ( time:: Month :: MONTH_JUNE ) ;
57
- months. insert ( time:: Month :: MONTH_JULY ) ;
58
- months. insert ( time:: Month :: MONTH_AUGUST ) ;
59
- months. insert ( time:: Month :: MONTH_SEPTEMBER ) ;
60
- months. insert ( time:: Month :: MONTH_OCTOBER ) ;
61
- months. insert ( time:: Month :: MONTH_NOVEMBER ) ;
62
- months. insert ( time:: Month :: MONTH_DECEMBER ) ;
52
+ months. insert ( time:: Month :: JANUARY ) ;
53
+ months. insert ( time:: Month :: FEBRUARY ) ;
54
+ months. insert ( time:: Month :: MARCH ) ;
55
+ months. insert ( time:: Month :: APRIL ) ;
56
+ months. insert ( time:: Month :: MAY ) ;
57
+ months. insert ( time:: Month :: JUNE ) ;
58
+ months. insert ( time:: Month :: JULY ) ;
59
+ months. insert ( time:: Month :: AUGUST ) ;
60
+ months. insert ( time:: Month :: SEPTEMBER ) ;
61
+ months. insert ( time:: Month :: OCTOBER ) ;
62
+ months. insert ( time:: Month :: NOVEMBER ) ;
63
+ months. insert ( time:: Month :: DECEMBER ) ;
63
64
64
65
assert_eq ! ( months. len( ) , 12 ) ;
65
66
}
@@ -68,15 +69,15 @@ fn enum_hash() {
68
69
// This fails upon calling the function, we don't actually need to make a good call.
69
70
#[ itest]
70
71
fn add_surface_from_arrays ( ) {
71
- let mut mesh = ArrayMesh :: new ( ) ;
72
- mesh. add_surface_from_arrays ( PrimitiveType :: PRIMITIVE_TRIANGLES , varray ! [ ] ) ;
72
+ let mut mesh = ArrayMesh :: new_gd ( ) ;
73
+ mesh. add_surface_from_arrays ( PrimitiveType :: TRIANGLES , & varray ! [ ] ) ;
73
74
}
74
75
75
76
#[ itest]
76
77
fn enum_as_str ( ) {
77
78
use godot:: obj:: EngineEnum ;
78
- assert_eq ! ( Orientation :: Vertical . as_str( ) , "VERTICAL" ) ;
79
- assert_eq ! ( Orientation :: Horizontal . as_str( ) , "HORIZONTAL" ) ;
79
+ assert_eq ! ( Orientation :: VERTICAL . as_str( ) , "VERTICAL" ) ;
80
+ assert_eq ! ( Orientation :: HORIZONTAL . as_str( ) , "HORIZONTAL" ) ;
80
81
81
82
assert_eq ! ( Key :: NONE . as_str( ) , "NONE" ) ;
82
83
assert_eq ! ( Key :: SPECIAL . as_str( ) , "SPECIAL" ) ;
@@ -88,8 +89,14 @@ fn enum_as_str() {
88
89
#[ itest]
89
90
fn enum_godot_name ( ) {
90
91
use godot:: obj:: EngineEnum ;
91
- assert_eq ! ( Orientation :: Vertical . godot_name( ) , Orientation :: Vertical . as_str( ) ) ;
92
- assert_eq ! ( Orientation :: Horizontal . godot_name( ) , Orientation :: Vertical . as_str( ) ) ;
92
+ assert_eq ! (
93
+ Orientation :: VERTICAL . godot_name( ) ,
94
+ Orientation :: VERTICAL . as_str( )
95
+ ) ;
96
+ assert_eq ! (
97
+ Orientation :: HORIZONTAL . godot_name( ) ,
98
+ Orientation :: HORIZONTAL . as_str( )
99
+ ) ;
93
100
94
101
assert_eq ! ( Key :: NONE . godot_name( ) , "KEY_NONE" ) ;
95
102
assert_eq ! ( Key :: SPECIAL . godot_name( ) , "KEY_SPECIAL" ) ;
0 commit comments