From acb90d2daa928d98a37f10e99f0a8b3fc879f2e8 Mon Sep 17 00:00:00 2001 From: Lars Ostwald Date: Sun, 15 Nov 2026 09:44:42 +0100 Subject: [PATCH 1/2] 4264: simplify TIFF header colour-type predicate --- crates/codecs/src/tiff_codec.rs | 2 +- crates/codecs/tests/it/header.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/codecs/src/tiff_codec.rs b/crates/codecs/src/tiff_codec.rs index 9a3678ab4b..1ad9c802f8 100644 --- a/crates/codecs/src/tiff_codec.rs +++ b/crates/codecs/src/tiff_codec.rs @@ -79,7 +79,7 @@ pub(crate) fn header(bytes: &[u8]) -> Result<(u32, u32, u16)> { if bits < 8 && info.planar == 2 && info.samples_per_pixel > 1 { return Err(Error::Unsupported(F, "planar TIFF with samples narrower than a byte")); } - if !matches!(info.photometric, 0 | 1 | 2 | 3 | 5) && !(info.photometric == 6 && info.compression == 7) { + if !(matches!(info.photometric, 0 | 1 | 2 | 3 | 5) || info.photometric == 6 && info.compression == 7) { return Err(Error::Unsupported(F, "colour type")); } // what `craft-image-codecs`'s TIFF decoder decompresses: none, CCITT G4, LZW, JPEG, Deflate, PackBits diff --git a/crates/codecs/tests/it/header.rs b/crates/codecs/tests/it/header.rs index acdcead85f..03ae13d08a 100644 --- a/crates/codecs/tests/it/header.rs +++ b/crates/codecs/tests/it/header.rs @@ -128,6 +128,31 @@ fn header_matches_decode() { assert_eq!((o("jpeg 420 o6"), o("png rgba o8"), o("webp o6"), o("psd o8"), o("tiff o6"), o("jpeg 444 o0")), (6, 8, 6, 8, 6, 1)); } +/// The header probe's colour/compression policy is unchanged by the Clippy repair (#4264). +/// These are header-only fixtures, not compressed image streams for the decoder. +#[test] +fn tiff_header_colour_and_compression_policy() { + for photometric in [0, 1, 2, 3, 4, 5, 6, 8, u16::MAX] { + for compression in [1, 4, 5, 6, 7, 8, 32773, 32946, u16::MAX] { + let mut ifd = craft_tiff::IfdBuilder::new() + .with(craft_tiff::tags::IMAGE_WIDTH, craft_tiff::Value::Long(vec![1])) + .with(craft_tiff::tags::IMAGE_LENGTH, craft_tiff::Value::Long(vec![1])) + .with(craft_tiff::tags::BITS_PER_SAMPLE, craft_tiff::Value::Short(vec![8, 8, 8])) + .with(craft_tiff::tags::SAMPLES_PER_PIXEL, craft_tiff::Value::Short(vec![3])) + .with(craft_tiff::tags::COMPRESSION, craft_tiff::Value::Short(vec![compression])) + .with(craft_tiff::tags::PHOTOMETRIC, craft_tiff::Value::Short(vec![photometric])); + ifd.set_image(craft_tiff::ImageData::Strips { rows_per_strip: 1, strips: vec![vec![0; 3]] }); + let bytes = craft_tiff::TiffWriter::new(craft_tiff::ByteOrder::Little, false).write(&[ifd]).unwrap(); + let accepted = match photometric { + 0 | 1 | 2 | 3 | 5 => [1, 4, 5, 7, 8, 32773, 32946].contains(&compression), + 6 => compression == 7, // YCbCr is supported only with JPEG compression. + _ => false, + }; + assert_eq!(read_header(&bytes).is_ok(), accepted, "photometric={photometric}, compression={compression}"); + } + } +} + /// Whenever the decode the probe used to run accepts a file (here: every cut of every fixture), /// the header agrees with it: reading headers never refuses a file that decodes. The reverse /// is checked for truncation, which the header readers detect. From 0857ef7898afdc54db652895e012117890b698c1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 11:15:37 +0000 Subject: [PATCH 2/2] Wait for GPU warm-up in welcome test --- crates/ui-egui/src/tests/welcome.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/ui-egui/src/tests/welcome.rs b/crates/ui-egui/src/tests/welcome.rs index 993a10192a..3290bcd38e 100644 --- a/crates/ui-egui/src/tests/welcome.rs +++ b/crates/ui-egui/src/tests/welcome.rs @@ -109,6 +109,18 @@ fn the_first_frame_opens_the_tour_for_a_window_host_only() { updated.ui.seen_version = Some("0.0.1".to_string()); logic(&mut updated); assert!(matches!(updated.ui.dialog, Some(Dialog::WhatsNew)), "{:?}", updated.ui.dialog); + + // The first logic tick requests the process-wide GPU warm-up. A nextest process can otherwise + // exit while the driver is still initializing, racing driver teardown (issue #620). + #[cfg(not(target_arch = "wasm32"))] + { + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30); + while !lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::enabled() && std::time::Instant::now() < deadline { + std::thread::sleep(std::time::Duration::from_millis(10)); + } + assert!(lightcraft_engine::gpu::ready() || !lightcraft_engine::gpu::enabled(), "GPU warm-up did not finish"); + assert!(lightcraft_engine::gpu::wait_idle(std::time::Duration::from_secs(30)), "GPU work did not finish"); + } } /// The version is recorded when the dialog is presented, not when the logic tick picks it: a