PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Tests: every GPU test holds gpu_lock (STATUS_ACCESS_VIOLATION on Windows)
LochLogic708d393988f7
diff --git a/crates/ui-egui/src/clipping_indicator_tests.rs b/crates/ui-egui/src/clipping_indicator_tests.rsindex 9bfb600b6..7395a533d 100644--- a/crates/ui-egui/src/clipping_indicator_tests.rs+++ b/crates/ui-egui/src/clipping_indicator_tests.rs@@ -83,6 +83,7 @@ fn alt_click_clipping_still_creates_releases_and_undoes_without_moving_rows() {#[test]#[ignore = "writes synthetic English Layers-panel screenshots for before/after inspection"]fn write_clipping_indicator_preview() {+ let _gpu = photocraft_testkit::gpu_lock();let output = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../plan/evidence/clipping");std::fs::create_dir_all(&output).unwrap();for theme in crate::theme::ThemeKind::ALL {diff --git a/crates/ui-egui/src/gpu_canvas_mip_tests.rs b/crates/ui-egui/src/gpu_canvas_mip_tests.rsindex a1c3e8ee1..82e911bae 100644--- a/crates/ui-egui/src/gpu_canvas_mip_tests.rs+++ b/crates/ui-egui/src/gpu_canvas_mip_tests.rs@@ -51,6 +51,7 @@ fn read_mips(gpu: &GpuCanvas, key: u64) -> Vec<Vec<[f32; 4]>> {#[test]fn canvas_mips_preserve_opaque_pixels_and_partial_updates() {+ let _gpu = photocraft_testkit::gpu_lock();let rs = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| egui_kittest::wgpu::create_render_state(wgpu_setup(), Default::default())));let Ok(rs) = rs else {eprintln!("skipping mip readback: no GPU adapter");diff --git a/crates/ui-egui/src/navigator_gpu_tests.rs b/crates/ui-egui/src/navigator_gpu_tests.rsindex 51326597f..d2342d17a 100644--- a/crates/ui-egui/src/navigator_gpu_tests.rs+++ b/crates/ui-egui/src/navigator_gpu_tests.rs@@ -47,6 +47,7 @@ fn near(a: [u8; 4], b: [u8; 3]) -> bool {#[test]fn navigator_draws_the_gpu_canvas_texture_and_follows_edits() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness() else { return };h.run_steps(8);if !h.state().perf.gpu {diff --git a/crates/ui-egui/src/panel_docking_tests.rs b/crates/ui-egui/src/panel_docking_tests.rsindex c6feeff63..a4ae378ed 100644--- a/crates/ui-egui/src/panel_docking_tests.rs+++ b/crates/ui-egui/src/panel_docking_tests.rs@@ -175,6 +175,7 @@ fn shared_layout_keeps_panel_identity_across_themes_and_respects_workspace_lock(/// Explicit offscreen evidence; this creates no native windows.#[test]fn capture_custom_panel_docking_visual_fixtures() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(directory) = std::env::var_os("CRAFT_UI_DOCKING_FIXTURES").map(std::path::PathBuf::from) else { return };std::fs::create_dir_all(&directory).unwrap();for theme in crate::theme::ThemeKind::ALL {@@ -211,6 +212,7 @@ fn capture_custom_panel_docking_visual_fixtures() {#[test]fn floating_group_titles_are_opaque_in_studio_themes() {+ let _gpu = photocraft_testkit::gpu_lock();// Studio's tab strip is transparent over the dock's card; a floating group must not show the canvas (#4509).let mut app = app();app.run("window.panel.float", json!({"panel":"swatches","x":40,"y":60,"width":300,"height":300})).unwrap();@@ -346,6 +348,7 @@ fn splitting_a_short_column_keeps_the_layers_footer_visible_and_usable() {#[test]fn populated_canvas_keeps_a_real_opacity_edit_after_floating_and_redocking() {+ let _gpu = photocraft_testkit::gpu_lock();let mut app = app();app.ui.theme = crate::theme::ThemeKind::Studio;app.run("file.new", json!({"width":480,"height":360})).unwrap();diff --git a/crates/ui-egui/src/type_tool_tests.rs b/crates/ui-egui/src/type_tool_tests.rsindex c7b54c887..7a23c9ccc 100644--- a/crates/ui-egui/src/type_tool_tests.rs+++ b/crates/ui-egui/src/type_tool_tests.rs@@ -1130,6 +1130,7 @@ fn temporary_type_transform_captures_press_and_rejects_collapsed_geometry() {#[test]#[ignore = "writes visual evidence to target/issue-1091; run explicitly for visual QA"]fn temporary_type_transform_visual_evidence() {+ let _gpu = photocraft_testkit::gpu_lock();let out = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../target/issue-1091");std::fs::create_dir_all(&out).unwrap();for (index, theme) in crate::theme::ThemeKind::ALL.into_iter().enumerate() {diff --git a/crates/ui-egui/tests/adjust_preview_gpu.rs b/crates/ui-egui/tests/adjust_preview_gpu.rsindex 82d47596f..c7104f72e 100644--- a/crates/ui-egui/tests/adjust_preview_gpu.rs+++ b/crates/ui-egui/tests/adjust_preview_gpu.rs@@ -126,6 +126,7 @@ fn max_diff(a: &[[f32; 4]], b: &[[f32; 4]], skip: usize) -> f32 {#[test]fn preview_layer_composites_on_the_gpu_like_the_command() {+ let _gpu = photocraft_testkit::gpu_lock();let Some((device, queue, mut comp)) = gpu() else { return };// GPU vs CPU of the same document (as the compositor parity tests), and GPU preview vs the// command's CPU result (adds the command's rounding to the layer depth).@@ -170,6 +171,7 @@ fn preview_layer_composites_on_the_gpu_like_the_command() {/// The zoomed-out proxy preview (own document and layer ids) composites on the GPU like the CPU.#[test]fn proxy_preview_composites_on_the_gpu() {+ let _gpu = photocraft_testkit::gpu_lock();use photocraft_ui_egui::adjust_preview::{base_document, proxy_base, proxy_with_settings};let Some((device, queue, mut comp)) = gpu() else { return };for selection in [false, true] {diff --git a/crates/ui-egui/tests/checker_canvas.rs b/crates/ui-egui/tests/checker_canvas.rsindex e626b4212..3c5e061af 100644--- a/crates/ui-egui/tests/checker_canvas.rs+++ b/crates/ui-egui/tests/checker_canvas.rs@@ -278,6 +278,7 @@ fn grid_line_contrast_over_grey(h: &mut Harness, grey: u8) -> i32 {#[test]fn pixel_grid_does_not_flip_colour_across_mid_tones() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness() else { return };h.run_steps(4);// 0x87 and 0x90 sit either side of luma 0.55, where the line used to switch from a full whitediff --git a/crates/ui-egui/tests/layout_perf.rs b/crates/ui-egui/tests/layout_perf.rsindex fb17833e1..1afb0f36c 100644--- a/crates/ui-egui/tests/layout_perf.rs+++ b/crates/ui-egui/tests/layout_perf.rs@@ -220,6 +220,7 @@ fn the_move_preview_is_what_the_move_commits() {#[test]fn layout_document_composites_on_the_gpu_like_the_cpu() {+ let _gpu = photocraft_testkit::gpu_lock();use eframe::wgpu;fn block_on<F: std::future::Future>(f: F) -> F::Output {let mut cx = std::task::Context::from_waker(std::task::Waker::noop());diff --git a/crates/ui-egui/tests/marquee_autoscroll.rs b/crates/ui-egui/tests/marquee_autoscroll.rsindex 2fc577260..ab5b6f6bb 100644--- a/crates/ui-egui/tests/marquee_autoscroll.rs+++ b/crates/ui-egui/tests/marquee_autoscroll.rs@@ -82,6 +82,7 @@ fn selection(h: &Harness) -> Option<[i32; 4]> {#[test]fn marquee_dragged_past_the_right_edge_scrolls_and_selects_beyond_the_view() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness() else { return };setup(&mut h, "rectMarquee");let start = xf(&h);@@ -121,6 +122,7 @@ fn marquee_dragged_past_the_right_edge_scrolls_and_selects_beyond_the_view() {#[test]fn a_drag_inside_the_canvas_does_not_scroll() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness() else { return };setup(&mut h, "rectMarquee");let start = xf(&h);@@ -139,6 +141,7 @@ fn a_drag_inside_the_canvas_does_not_scroll() {#[test]fn rotated_marquee_scrolls_on_the_axis_that_is_visibly_clipped() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness_with_size(egui::vec2(1200.0, 640.0)) else { return };setup(&mut h, "rectMarquee");let rect = xf(&h).rect;diff --git a/crates/ui-egui/tests/pattern_preview_canvas.rs b/crates/ui-egui/tests/pattern_preview_canvas.rsindex 627bbddaa..aef11c00d 100644--- a/crates/ui-egui/tests/pattern_preview_canvas.rs+++ b/crates/ui-egui/tests/pattern_preview_canvas.rs@@ -52,6 +52,7 @@ fn near(a: [u8; 3], b: [u8; 3]) -> bool {#[test]fn pattern_preview_repeats_the_document_on_gpu_and_cpu_canvases() {+ let _gpu = photocraft_testkit::gpu_lock();let Some(mut h) = harness() else { return };let app = h.state_mut();app.run("file.new", json!({"width": 200, "height": 100, "mode": "rgb", "depth": 8})).expect("new");