diff --git a/Cargo.toml b/Cargo.toml index 3585e9cbf4..d4893f6317 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -243,19 +243,16 @@ codegen-units = 1 # The browser build (apps/photocraft-web, `data-cargo-profile` in its index.html). Hosts cap the # size of a single file (Cloudflare Pages/Workers: 25 MiB), and the wasm is downloaded on every -# visit, so this profile optimizes for size: opt-level "z" for PhotoCraft's own crates, +# visit, so this profile optimizes for size: fat LTO, opt-level "z" for PhotoCraft's own crates, # "s" for dependencies and for the crates that decode files, and 3 for pixel processing (filters # and compositing). Dependencies stay at "s": at "z" the whole wasm grows (by 0.4 MB, measured). # panic stays the target default (wasm32-unknown-unknown aborts; AGENTS.md's `panic = "unwind"` # is for the native app shell). packaging/web/package.sh fails the build above 24 MiB. -# Thin LTO over 16 codegen units keeps the link step near 8 GB, inside a 16 GB CI runner (one -# fat-LTO unit needs about 21 GB); after trunk's wasm-opt -Oz the wasm is within 3% of the -# fat-LTO size (71.6 MB against 69.7 MB, measured). [profile.wasm-release] inherits = "release" opt-level = "z" -lto = "thin" -codegen-units = 16 +lto = "fat" +codegen-units = 1 strip = "debuginfo" [profile.wasm-release.package."*"] diff --git a/crates/ui-egui/src/tools/frame_tool/content_pick_tests.rs b/crates/ui-egui/src/tools/frame_tool/content_pick_tests.rs index 86c4cbede2..23c4c6a614 100644 --- a/crates/ui-egui/src/tools/frame_tool/content_pick_tests.rs +++ b/crates/ui-egui/src/tools/frame_tool/content_pick_tests.rs @@ -1,5 +1,6 @@ //! Frame drags pick content under the drag independently of the active layer (#13860). use super::*; +use crate::canvas::ToolEvent; fn raster(name: &str, bounds: Rect, format: photocraft_color::PixelFormat) -> Layer { let mut layer = Layer::raster(name, format); @@ -7,7 +8,7 @@ fn raster(name: &str, bounds: Rect, format: photocraft_color::PixelFormat) -> La layer } -fn scene() -> (PhotocraftApp, LayerId, LayerId, LayerId) { +fn scene() -> (Box, LayerId, LayerId, LayerId) { let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); app.run("file.new", json!({"width":600,"height":400})).unwrap(); let ids = app diff --git a/crates/ui-egui/tests/it/remove_channel_target.rs b/crates/ui-egui/tests/it/remove_channel_target.rs index b63400666b..a8ca2950a8 100644 --- a/crates/ui-egui/tests/it/remove_channel_target.rs +++ b/crates/ui-egui/tests/it/remove_channel_target.rs @@ -14,6 +14,16 @@ fn run(s: &mut Session, id: &str, p: &str) { s.execute(id, p.parse().unwrap()).unwrap(); } +/// Context for assertion messages: who is active, whether a text edit is open, and whether the job is done. +fn state_line(app: &PhotocraftApp, job: photocraft_engine::jobs::JobId) -> String { + format!( + "active layer {:?}, text-edit session open {}, job finished {}", + app.session.active().and_then(|d| d.active_layer), + app.ui.text_edit.is_some(), + app.session.job(job).is_none() + ) +} + fn pixels(s: &Session, doc: usize, id: LayerId) -> Vec { let d = &s.documents()[doc].doc; d.layer(id).unwrap().surface().unwrap().read_region(d.bounds()) @@ -87,11 +97,15 @@ fn probe(input: Input) { } h.run_steps(1); } - assert!(host.injected_idle(), "the canvas consumed the queued pointer input"); + let state = state_line(h.state(), job); + assert!(host.injected_idle(), "the canvas consumed the queued pointer input; {state}"); + // `injected_idle` is also true when the step was withdrawn (focus change before its + // pass) instead of delivered, so delivery is asserted separately. + assert!(!host.take_injected_withdrawn(), "the injected press was delivered, not withdrawn; {state}"); } } let selected = if matches!(input, Input::None) { target } else { text }; - assert_eq!(h.state().session.active().unwrap().active_layer, Some(selected), "the input selects the text layer"); + assert_eq!(h.state().session.active().unwrap().active_layer, Some(selected), "the input selects the text layer; {}", state_line(h.state(), job)); let a = h.state_mut(); a.session.set_active(1);