LK56CXDULK2QZHR4QOKKDZYTDJ6JZU676CLMUT4HOU32IUQG2IEAC
BYFMGWJ5ZPXZTCIFDHP66KK7JTEKT2NO7HR2XY7T5WRAAG3L5WYQC
O5P6HCPWGMGJBFJEMC3SYQJ5OEW2AQV4KEJCMRVTTS3K6M45Z3BAC
Y4JIGMJIDT3RS23FHKHYW2YMSW5OSVXCRHFXRQ33RHQFQIRJAKHQC
KID2E3YKLHUFPHWYYGRQZTX73THWMAXQWPT5XZEJJO46BCQD27HQC
L6RIUKGLJZLAOKFGUDTZKBPP4HUBPEZAKHJEQHO34WFF62AB2ZIQC
DOR7S6M2PZ5FQ7TFGWIK7FUFUZENXKU4G42I5HQITODPBBEJB4YQC
L5SVCVPJMJPDARA4H43U5INQMAKHUIB5PUP55IDRKAPQDB35MXZQC
7B5SB3V7YC4HKFX6PIX6IHJ4U3BKYLD5EBMEY6O5FQ7YGN4VVI4AC
34CROJEM52NB7TGBCGGMIYAQ2AZUI44FWO25MGYYUSCMHLCLJNAQC
);
}
#[test]
fn camera_updates_aspect_properly() {
let mut camera = Camera {
width: 400.0,
height: 400.0,
..Default::default()
};
// The ratio of screen to camera is about the same (is the same in this case)
assert_eq!(
camera.update_aspect(PhysicalSize::new(400, 400)),
Some((1.0, 1.0))
// we dont update it if we don't have to.
assert_eq!(camera.update_aspect(PhysicalSize::new(400, 400)), None);
// window is too wide, scale down width
assert_eq!(
camera.update_aspect(PhysicalSize::new(400, 200)),
Some((0.5, 1.0))
);
// window is too tall, scale down height
assert_eq!(
camera.update_aspect(PhysicalSize::new(200, 400)),
Some((1.0, 0.5))
)