Move code to Rust
This commit is contained in:
parent
69eb29ba37
commit
21554b3f6f
17
src/geom.rs
17
src/geom.rs
|
@ -85,6 +85,14 @@ impl WinGeom {
|
||||||
pub fn border_width(&self) -> c_int {
|
pub fn border_width(&self) -> c_int {
|
||||||
self.border_width
|
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)]
|
#[cfg(test)]
|
||||||
|
@ -107,4 +115,13 @@ mod tests {
|
||||||
fn win_geom_default() {
|
fn win_geom_default() {
|
||||||
assert_eq!(WinGeom::default().border_width(), 0);
|
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…
Reference in New Issue