[test] add e2e egui test

This commit is contained in:
Emil Ernerfeldt 2020-09-09 12:14:53 +02:00
parent 23d99b07c8
commit 672ffb6cd6
3 changed files with 22 additions and 0 deletions

View file

@ -82,3 +82,21 @@ pub use {
ui::Ui,
widgets::*,
};
#[test]
pub fn text_egui_e2e() {
let mut demo_app = crate::demos::DemoApp::default();
let mut ctx = crate::Context::new();
let raw_input = crate::RawInput {
screen_size: crate::vec2(1280.0, 1024.0),
..Default::default()
};
const NUM_FRAMES: usize = 5;
for _ in 0..NUM_FRAMES {
let mut ui = ctx.begin_frame(raw_input.clone());
demo_app.ui(&mut ui, "");
let (_output, paint_jobs) = ctx.end_frame();
assert!(!paint_jobs.is_empty());
}
}

View file

@ -426,6 +426,7 @@ pub fn rgb_from_hsv((h, s, v): (f32, f32, f32)) -> (f32, f32, f32) {
}
#[test]
#[ignore] // a bit expensive
fn test_hsv_roundtrip() {
for r in 0..=255 {
for g in 0..=255 {

View file

@ -193,6 +193,9 @@ impl Font {
scale_in_points: f32,
pixels_per_point: f32,
) -> Font {
assert!(scale_in_points > 0.0);
assert!(pixels_per_point > 0.0);
let font = rusttype::Font::try_from_bytes(font_data).expect("Error constructing Font");
let scale_in_pixels = pixels_per_point * scale_in_points;