Move code to Rust
This commit is contained in:
parent
69eb29ba37
commit
21554b3f6f
1 changed files with 17 additions and 0 deletions
17
src/geom.rs
17
src/geom.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue