Move code to Rust

This commit is contained in:
Alex Kotov 2022-09-07 20:07:56 +04:00
parent 69eb29ba37
commit 21554b3f6f
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 17 additions and 0 deletions

View File

@ -85,6 +85,14 @@ impl WinGeom {
pub fn border_width(&self) -> c_int {
self.border_width
}
pub fn total_width(&self) -> c_int {
self.basic.sizes.width + 2 * self.border_width
}
pub fn total_height(&self) -> c_int {
self.basic.sizes.height + 2 * self.border_width
}
}
#[cfg(test)]
@ -107,4 +115,13 @@ mod tests {
fn win_geom_default() {
assert_eq!(WinGeom::default().border_width(), 0);
}
#[test]
fn win_geom_total_width_height() {
let sizes = Sizes::new(34, 56);
let basic_geom = BasicGeom::new(Default::default(), sizes);
let win_geom = WinGeom::new(basic_geom, 12);
assert_eq!(win_geom.total_width(), 58);
assert_eq!(win_geom.total_height(), 80);
}
}