Merge remote-tracking branch 'origin/main' into codex/lightcraft-jpeg-writer

This commit is contained in:
Dylan M. Taylor committed 2026-11-15 06:42:24 +00:00
commit 9e6396129d
7 files changed
+69 -11

No files matched your search

+17 -1
View File
@@ -10,6 +10,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use lightcraft_denoise::manifest::{DenoiserManifest, Domain, Gain};
use lightcraft_denoise::run::TileRunner;
use serde_json::{Value, json};
use web_time::Duration;
use crate::Session;
use crate::denoise::{Loader, Model, PhotoState, RunOn};
@@ -179,8 +180,23 @@ fn photo(s: &Session) -> lightcraft_catalog::PhotoId {
}
/// Pump until `n` photos are ready (the job runs on its own thread).
fn denoise_ready_timeout_for_instrumentation(instrumented: bool) -> Duration {
Duration::from_secs(if instrumented { 600 } else { 30 })
}
fn denoise_ready_timeout() -> Duration {
denoise_ready_timeout_for_instrumentation(std::env::var_os("LLVM_PROFILE_FILE").is_some())
}
#[test]
fn denoise_pump_budget_only_expands_for_llvm_coverage_runs() {
assert_eq!(denoise_ready_timeout_for_instrumentation(false), Duration::from_secs(30));
assert_eq!(denoise_ready_timeout_for_instrumentation(true), Duration::from_secs(600));
}
fn pump_until_ready(s: &mut Session, n: u64) -> Value {
for _ in 0..600 {
let deadline = std::time::Instant::now() + denoise_ready_timeout();
while std::time::Instant::now() < deadline {
let r = s.execute("denoise.pump", &json!({"pace": "full"})).unwrap();
if r["ready"].as_u64() >= Some(n) {
return r;
+15 -1
View File
@@ -239,8 +239,22 @@ fn video_in_webm_with_a_fade_colour() {
assert_eq!(seg + 12 + size as usize, d.len());
}
fn wait_timeout_for_instrumentation(instrumented: bool) -> Duration {
Duration::from_secs(if instrumented { 600 } else { 120 })
}
fn wait_timeout() -> Duration {
wait_timeout_for_instrumentation(std::env::var_os("LLVM_PROFILE_FILE").is_some())
}
#[test]
fn slideshow_export_wait_budget_only_expands_for_llvm_coverage_runs() {
assert_eq!(wait_timeout_for_instrumentation(false), Duration::from_secs(120));
assert_eq!(wait_timeout_for_instrumentation(true), Duration::from_secs(600));
}
fn wait_for(s: &Session) -> Value {
let deadline = Instant::now() + Duration::from_secs(120);
let deadline = Instant::now() + wait_timeout();
loop {
let run = s.slideshow_export.clone().unwrap();
if !run.running() {
+14
View File
@@ -1,3 +1,17 @@
fn settle_timeout_for_instrumentation(instrumented: bool) -> std::time::Duration {
std::time::Duration::from_secs(if instrumented { 600 } else { 120 })
}
fn ui_settle_timeout() -> std::time::Duration {
settle_timeout_for_instrumentation(std::env::var_os("LLVM_PROFILE_FILE").is_some())
}
#[test]
fn settle_budget_only_expands_for_llvm_coverage_runs() {
assert_eq!(settle_timeout_for_instrumentation(false), std::time::Duration::from_secs(120));
assert_eq!(settle_timeout_for_instrumentation(true), std::time::Duration::from_secs(600));
}
mod activity;
mod album_picker;
mod album_remove;
+1 -1
View File
@@ -298,7 +298,7 @@ fn compare_zoom_window_tracks_the_zoomed_pane() {
let r = h.request("engine.execute", json!({"command": "view.compare"}), T);
assert_eq!(r["ok"], true, "{r}");
h.app.ui.zoom = Zoom::Percent(100.0);
h.settle(SETTLE);
h.settle(super::ui_settle_timeout());
let candidate = vis[1];
let photo = h.app.session.catalog.photo(lightcraft_catalog::PhotoId(candidate)).cloned().expect("photo");
let frame = lightcraft_pipeline::geometry::Frame::with_lens(
+19 -5
View File
@@ -13,6 +13,20 @@ use lightcraft_engine::import::ImportCandidate;
const T: Duration = Duration::from_secs(30);
fn import_preview_settle_timeout_for_instrumentation(instrumented: bool) -> Duration {
Duration::from_secs(if instrumented { 600 } else { 30 })
}
fn import_preview_settle_timeout() -> Duration {
import_preview_settle_timeout_for_instrumentation(std::env::var_os("LLVM_PROFILE_FILE").is_some())
}
#[test]
fn import_preview_setup_timeout_only_expands_for_llvm_coverage_runs() {
assert_eq!(import_preview_settle_timeout_for_instrumentation(false), Duration::from_secs(30));
assert_eq!(import_preview_settle_timeout_for_instrumentation(true), Duration::from_secs(600));
}
/// Size buckets follow physical pixels, with finite fallbacks and a fixed allocation ceiling.
#[test]
fn import_thumb_edges_follow_size_and_display_density() {
@@ -65,7 +79,7 @@ impl Review {
let mut app = LightcraftApp::new(lightcraft_engine::Session::new().with_fs(), Services::default());
app.ui.dialog = Some(Dialog::Import { opts: Box::new(ImportDialog::new(candidates)) });
let mut h = Headless::new(app, [1366.0, 1000.0], scale);
assert!(h.settle(T));
assert!(h.settle(import_preview_settle_timeout()));
Self { h, dir }
}
@@ -89,7 +103,7 @@ impl Review {
/// Set thumbnail size through its command and wait for the resulting previews to settle.
fn size(&mut self, size: f32) {
self.request("engine.execute", json!({"command": "view.importThumbSize", "params": {"size": size}}));
assert!(self.h.settle(T));
assert!(self.h.settle(import_preview_settle_timeout()));
}
}
@@ -113,11 +127,11 @@ fn import_thumbnail_slider_reflows_without_changing_selection_or_badges() {
assert!(!checked[0] && !checked[1] && !checked[2]);
// Real pointer input on the slider, including its end stops.
review.request("ui.clickWidget", json!({"id": "slider:importThumbSize", "fx": 0.0}));
assert!(review.h.settle(T));
assert!(review.h.settle(import_preview_settle_timeout()));
assert_eq!(review.rect("import:0").width(), 80.0);
let slider = review.rect("slider:importThumbSize");
review.request("ui.dragWidget", json!({"id": "slider:importThumbSize", "toX": slider.right(), "toY": slider.center().y}));
assert!(review.h.settle(T));
assert!(review.h.settle(import_preview_settle_timeout()));
assert_eq!(review.rect("import:0").width(), 320.0);
assert_eq!(review.checks(), checked);
let text = review.h.painted_text().join("\n");
@@ -235,7 +249,7 @@ fn import_thumbnail_exact_entry_escape_keeps_the_review_open() {
review.request("ui.key", json!({"key": "a", "cmd": true}));
review.request("ui.text", json!({"text": "240"}));
review.request("ui.key", json!({"key": key}));
assert!(review.h.settle(T));
assert!(review.h.settle(import_preview_settle_timeout()));
assert_eq!(review.h.app.ui.import_thumb_size, expected);
assert_eq!(review.checks(), checked, "the review remains open after exact-value editing");
}
+1 -1
View File
@@ -748,7 +748,7 @@ mod in_the_loupe {
#[test]
fn pinch_display_fit_keeps_the_request_key_until_the_hold_expires() {
let (mut h, native) = demo_detail_in([1400.0, 900.0]);
assert!(h.settle(SETTLE), "the starting render must be complete");
assert!(h.settle(super::super::ui_settle_timeout()), "the starting render must be complete");
let main = h.app.renderer.textures.get(&Slot::Main).unwrap();
let (original_key, original_size) = (main.key, main.size);
let work = std::rc::Rc::new(std::cell::RefCell::new(PinchWork::default()));
+2 -2
View File
@@ -48,7 +48,7 @@ fn fixture_grid(count: usize, open: Rc<Cell<bool>>) -> (RenderFixture, Headless)
// consume the wall-clock budget before the slideshow scheduling assertions begin.
assert!(open.get(), "the native grid setup gate starts open");
h.app.renderer.set_offload(Box::new(RenderGate::new(open)));
assert!(h.settle(SETTLE), "the grid renders settle before controlling slide renders");
assert!(h.settle(super::ui_settle_timeout()), "the grid renders settle before controlling slide renders");
assert_eq!(h.app.session.catalog.len(), count, "the slideshow fixture photos");
let id = h.app.session.active().expect("a photo is open");
let photo = h.app.session.catalog.photo(id).expect("it is in the catalog");
@@ -241,7 +241,7 @@ fn a_manual_slideshow_waits_for_the_arrow_keys() {
assert_eq!(r["settings"]["manual"], true, "{r}");
// once the first two slides are rendered, and far longer than the slide duration: the first
// photo stays up
assert!(h.step_until(SETTLE, |h| has_slide(h, photos[0]) && has_slide(h, photos[1])), "the slides are rendered");
assert!(h.step_until(super::ui_settle_timeout(), |h| has_slide(h, photos[0]) && has_slide(h, photos[1])), "the slides are rendered");
for _ in 0..120 {
h.step();
}