forked from godot-rust/gdnative
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate accessor methods for indexed properties
Getters and setters are now generated for indexed properties that are naturally accessible in GDScript (i.e. do not have '/' in the name), like `SpatialMaterial::albedo_texture`. Doc generation for the underlying accessors has also been improved. Close godot-rust#689
- Loading branch information
Showing
4 changed files
with
197 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use gdnative::core_types::Margin; | ||
use gdnative::prelude::*; | ||
|
||
pub(crate) fn run_tests() -> bool { | ||
let mut status = true; | ||
|
||
status &= test_indexed_props(); | ||
|
||
status | ||
} | ||
|
||
pub(crate) fn register(_handle: InitHandle) {} | ||
|
||
crate::godot_itest! { test_indexed_props { | ||
let control = Control::new(); | ||
|
||
assert_eq!(0, control.margin_top()); | ||
assert_eq!(0, control.margin_left()); | ||
|
||
control.set_margin_top(42); | ||
|
||
assert_eq!(42, control.margin_top()); | ||
assert_eq!(42, control.margin(Margin::Top.into()) as i64); | ||
assert_eq!(0, control.margin_left()); | ||
assert_eq!(0, control.margin(Margin::Left.into()) as i64); | ||
|
||
control.set_margin(Margin::Left.into(), 24.0); | ||
|
||
assert_eq!(24, control.margin_left()); | ||
|
||
control.free(); | ||
}} |