Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Fix print fuzzing and Windows crop GPU test fixtures (#4726)

Skyfuller6ddb0e0b0df5
diff --git a/crates/ui-egui/tests/crop_default_mode.rs b/crates/ui-egui/tests/crop_default_mode.rs
index b16e62821..7c426410d 100644
--- a/crates/ui-egui/tests/crop_default_mode.rs
+++ b/crates/ui-egui/tests/crop_default_mode.rs
@@ -106,6 +106,9 @@ fn setup() -> Option<Harness> {
#[test]
fn a_ratio_dropdown_updates_the_preview_and_enter_without_touching_a_handle() {
+ // Windows WARP can access-violate when GPU harnesses initialize or tear down concurrently:
+ // hold the GPU lock for the whole test, harness included.
+ let _gpu = photocraft_testkit::gpu_lock();
let Some(mut h) = setup() else { return };
h.get_by_value("Ratio").click();
h.run_steps(3);
@@ -124,6 +127,9 @@ fn a_ratio_dropdown_updates_the_preview_and_enter_without_touching_a_handle() {
#[test]
fn the_swap_button_and_x_apply_the_same_inscribed_ratio() {
+ // Windows WARP can access-violate when GPU harnesses initialize or tear down concurrently:
+ // hold the GPU lock for the whole test, harness included.
+ let _gpu = photocraft_testkit::gpu_lock();
let Some(mut h) = setup() else { return };
let original = [30.0, 20.0, 270.0, 180.0];
h.state_mut().ui.crop_rect = Some(original);
@@ -148,6 +154,9 @@ fn the_swap_button_and_x_apply_the_same_inscribed_ratio() {
#[test]
fn a_resize_renders_the_frame_and_image_with_the_same_camera() {
+ // Windows WARP can access-violate when GPU harnesses initialize or tear down concurrently:
+ // hold the GPU lock for the whole test, harness included.
+ let _gpu = photocraft_testkit::gpu_lock();
let Some(mut h) = setup() else { return };
let box0 = screen_box(&h);
let c = mid(box0);