mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
This adds a `Harness::new_ui`, which accepts a Ui closure and shows the ui in a central panel. One big benefit is that this allows us to add a fit_contents method that can run the ui closure with a sizing pass and resize the "screen" based on the content size. I also used this to add a snapshot test for the rendering_test at different scales.
15 lines
277 B
Rust
15 lines
277 B
Rust
use egui_kittest::Harness;
|
|
|
|
#[test]
|
|
fn test_shrink() {
|
|
let mut harness = Harness::new_ui(|ui| {
|
|
ui.label("Hello, world!");
|
|
ui.separator();
|
|
ui.label("This is a test");
|
|
});
|
|
|
|
harness.fit_contents();
|
|
|
|
harness.wgpu_snapshot("test_shrink");
|
|
}
|