state: Add sizing unit test
This commit is contained in:
@ -313,8 +313,8 @@ pub type PixelSize = Size<u32>;
|
|||||||
/// wl_output mode
|
/// wl_output mode
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct Mode {
|
pub struct Mode {
|
||||||
width: i32,
|
pub width: i32,
|
||||||
height: i32,
|
pub height: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
|||||||
25
src/state.rs
25
src/state.rs
@ -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,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user