state: Add sizing unit test

This commit is contained in:
Dorota Czaplejewicz
2022-04-07 14:30:46 +00:00
parent 14d7d5d4e0
commit 397f5e126e
2 changed files with 27 additions and 2 deletions

View File

@ -313,8 +313,8 @@ pub type PixelSize = Size<u32>;
/// wl_output mode
#[derive(Clone, Copy, Debug)]
pub struct Mode {
width: i32,
height: i32,
pub width: i32,
pub height: i32,
}
#[derive(Clone, Copy, Debug)]

View File

@ -566,4 +566,29 @@ pub mod test {
);
}
#[test]
fn size_l5() {
use crate::outputs::{Mode, Geometry, c, Size};
assert_eq!(
Application::get_preferred_height(&OutputState {
current_mode: Some(Mode {
width: 720,
height: 1440,
}),
geometry: Some(Geometry{
transform: c::Transform::Normal,
phys_size: Size {
width: Some(Millimeter(65)),
height: Some(Millimeter(130)),
},
}),
scale: 2,
}),
Some(PixelSize {
scale_factor: 2,
pixels: 420,
}),
);
}
}