mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Match storytold main's profile tables, fix merged frame-tool tests for the boxed app, report withdrawn injected input in remove_channel_target
The Remove-channel-target control-pointer test now asserts the injected press was delivered rather than withdrawn, and its assertion messages include the active layer, text-edit state and job state.
This commit is contained in:
1 parent
8bc1e51260
commit
435d6e5a51
3 files changed
+21
-9
No files matched your search
+3
-6
@@ -243,19 +243,16 @@ codegen-units = 1
|
|||||||
|
|
||||||
# The browser build (apps/photocraft-web, `data-cargo-profile` in its index.html). Hosts cap the
|
# 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
|
# 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
|
# "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).
|
# 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"`
|
# 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.
|
# 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]
|
[profile.wasm-release]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = "thin"
|
lto = "fat"
|
||||||
codegen-units = 16
|
codegen-units = 1
|
||||||
strip = "debuginfo"
|
strip = "debuginfo"
|
||||||
|
|
||||||
[profile.wasm-release.package."*"]
|
[profile.wasm-release.package."*"]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//! Frame drags pick content under the drag independently of the active layer (#13860).
|
//! Frame drags pick content under the drag independently of the active layer (#13860).
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::canvas::ToolEvent;
|
||||||
|
|
||||||
fn raster(name: &str, bounds: Rect, format: photocraft_color::PixelFormat) -> Layer {
|
fn raster(name: &str, bounds: Rect, format: photocraft_color::PixelFormat) -> Layer {
|
||||||
let mut layer = Layer::raster(name, format);
|
let mut layer = Layer::raster(name, format);
|
||||||
@@ -7,7 +8,7 @@ fn raster(name: &str, bounds: Rect, format: photocraft_color::PixelFormat) -> La
|
|||||||
layer
|
layer
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scene() -> (PhotocraftApp, LayerId, LayerId, LayerId) {
|
fn scene() -> (Box<PhotocraftApp>, LayerId, LayerId, LayerId) {
|
||||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||||
app.run("file.new", json!({"width":600,"height":400})).unwrap();
|
app.run("file.new", json!({"width":600,"height":400})).unwrap();
|
||||||
let ids = app
|
let ids = app
|
||||||
|
|||||||
@@ -14,6 +14,16 @@ fn run(s: &mut Session, id: &str, p: &str) {
|
|||||||
s.execute(id, p.parse().unwrap()).unwrap();
|
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<f32> {
|
fn pixels(s: &Session, doc: usize, id: LayerId) -> Vec<f32> {
|
||||||
let d = &s.documents()[doc].doc;
|
let d = &s.documents()[doc].doc;
|
||||||
d.layer(id).unwrap().surface().unwrap().read_region(d.bounds())
|
d.layer(id).unwrap().surface().unwrap().read_region(d.bounds())
|
||||||
@@ -87,11 +97,15 @@ fn probe(input: Input) {
|
|||||||
}
|
}
|
||||||
h.run_steps(1);
|
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 };
|
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();
|
let a = h.state_mut();
|
||||||
a.session.set_active(1);
|
a.session.set_active(1);
|
||||||
|
|||||||
Reference in new issue
Block a user