@@ -51,14 +51,14 @@ fn property_template_test(ctx: &TestContext) {
51
51
52
52
assert ! ( !properties. is_empty( ) ) ;
53
53
54
- for property in gdscript_properties. get_property_list ( ) . iter_shared ( ) {
55
- let name = property . get ( "name" ) . unwrap ( ) . to :: < String > ( ) ;
54
+ for mut gdscript_prop in gdscript_properties. get_property_list ( ) . iter_shared ( ) {
55
+ let name = gdscript_prop . at ( "name" ) . to :: < String > ( ) ;
56
56
57
57
let Some ( mut rust_prop) = properties. remove ( & name) else {
58
58
continue ;
59
59
} ;
60
60
61
- let mut rust_usage = rust_prop. get ( "usage" ) . unwrap ( ) . to :: < i64 > ( ) ;
61
+ let mut rust_usage = rust_prop. at ( "usage" ) . to :: < i64 > ( ) ;
62
62
63
63
// the GDSscript variables are script variables, and so have `PROPERTY_USAGE_SCRIPT_VARIABLE` set.
64
64
if rust_usage == PropertyUsageFlags :: STORAGE . ord ( ) as i64 {
@@ -71,9 +71,26 @@ fn property_template_test(ctx: &TestContext) {
71
71
72
72
rust_prop. set ( "usage" , rust_usage) ;
73
73
74
- if rust_prop != property {
74
+ // From Godot 4.4, GDScript uses `.0` for integral floats, see https://github.com/godotengine/godot/pull/47502.
75
+ // We still register them the old way, to test compatibility. See also godot-core/src/registry/property.rs.
76
+ // Since GDScript now registers them with `.0`, we need to account for that.
77
+ if GdextBuild :: since_api ( "4.4" ) {
78
+ let mut hint_string = gdscript_prop. at ( "hint_string" ) . to :: < String > ( ) ;
79
+
80
+ // Don't check against `.0` to not accidentally catch `.02`. We don't have regex available here.
81
+ if hint_string. contains ( ".0," ) {
82
+ hint_string = hint_string. replace ( ".0," , "," ) ;
83
+ gdscript_prop. set ( "hint_string" , hint_string. clone ( ) ) ;
84
+ }
85
+
86
+ if hint_string. ends_with ( ".0" ) {
87
+ gdscript_prop. set ( "hint_string" , hint_string. trim_end_matches ( ".0" ) ) ;
88
+ }
89
+ }
90
+
91
+ if rust_prop != gdscript_prop {
75
92
errors. push ( format ! (
76
- "mismatch in property {name}:\n GDScript: {property :?}\n Rust: {rust_prop:?}"
93
+ "mismatch in property {name}:\n GDScript: {gdscript_prop :?}\n Rust: {rust_prop:?}"
77
94
) ) ;
78
95
}
79
96
}
0 commit comments