Merge remote-tracking branch 'origin/main' into t4306

# Conflicts:
#	packaging/linux/flatpak/cargo-sources.json
This commit is contained in:
FredApps
2026-11-16 08:02:37 +01:00
8 changed files with 105 additions and 95 deletions
Generated
+19 -10
View File
@@ -1271,10 +1271,11 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f"
source = "git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4#947dc5fb0ec436c0841f560eac0d65c6ad055ed4"
dependencies = [
"craft-jpeg",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)",
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4)",
"crc32fast",
"exr",
"flate2",
@@ -1302,6 +1303,14 @@ dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4#947dc5fb0ec436c0841f560eac0d65c6ad055ed4"
dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "craft-jxl"
version = "0.1.0"
@@ -1315,11 +1324,11 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f"
source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2"
dependencies = [
"brotli-decompressor 6.0.1",
"chrono",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)",
"quick-xml 0.41.0",
"serde",
]
@@ -1327,11 +1336,11 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2"
source = "git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4#947dc5fb0ec436c0841f560eac0d65c6ad055ed4"
dependencies = [
"brotli-decompressor 6.0.1",
"chrono",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4)",
"quick-xml 0.41.0",
"serde",
]
@@ -1395,7 +1404,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f#478c50560d3c6fad3d613af2a30b35c3bc9f4c0f"
source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -1404,7 +1413,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2#94777dcf7f8962476e96b049d08d22e25b9330c2"
source = "git+https://github.com/storytold/craft-libs?rev=947dc5fb0ec436c0841f560eac0d65c6ad055ed4#947dc5fb0ec436c0841f560eac0d65c6ad055ed4"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -3903,7 +3912,7 @@ dependencies = [
"craft-gif",
"craft-heif",
"craft-image-codecs",
"craft-jpeg",
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)",
"craft-jxl",
"craft-psd",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=94777dcf7f8962476e96b049d08d22e25b9330c2)",
+1 -1
View File
@@ -23,7 +23,7 @@ craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f3
# Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949)
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "94777dcf7f8962476e96b049d08d22e25b9330c2" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "947dc5fb0ec436c0841f560eac0d65c6ad055ed4" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
# craft-update: app-specific pretend versions apply to startup and manual checks.
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] }
+12 -35
View File
@@ -1,4 +1,4 @@
//! TIFF decode via `craft-image-codecs` and header/IFD inspection via `craft-tiff`.
//! TIFF decode and header inspection via `craft-image-codecs`.
use crate::convert::{Buf, Meta, Model, Raw, check_size, finish};
use crate::{DecodeOptions, Decoded, Error, Format, Result};
@@ -10,15 +10,9 @@ fn err(e: impl std::fmt::Display) -> Error {
}
pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
let (tiff, complete) = craft_tiff::Tiff::parse_with_status(bytes, &Default::default()).map_err(err)?;
if !complete {
return Err(err("truncated TIFF"));
}
let ifd = tiff.ifds.first().ok_or_else(|| err("no IFD"))?;
let info = ifd.image().map_err(err)?;
check_size(F, info.width as u64, info.height as u64, opts)?;
let orientation = ifd.u16(craft_tiff::tags::ORIENTATION);
let bit_depth = info.bits_per_sample.first().copied().unwrap_or(8) as u8;
let info = craft_image_codecs::tiff_probe::decode_info(bytes, opts.max_pixels).map_err(probe_error)?;
let orientation = info.orientation;
let bit_depth = info.bit_depth;
let ic_opts = craft_image_codecs::DecodeOptions {
limits: craft_image_codecs::Limits {
@@ -68,30 +62,13 @@ pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
/// as a decode would refuse it: a layout or compression we can't decode, or strips/tiles that
/// start past the end of the file (truncated). The compressed data itself is not checked.
pub(crate) fn header(bytes: &[u8]) -> Result<(u32, u32, u16)> {
let (tiff, complete) = craft_tiff::Tiff::parse_with_status(bytes, &Default::default()).map_err(err)?;
if !complete {
return Err(err("truncated TIFF"));
craft_image_codecs::tiff_probe::header(bytes, DecodeOptions::default().max_pixels).map_err(probe_error)
}
fn probe_error(error: craft_image_codecs::tiff_probe::Error) -> Error {
match error {
craft_image_codecs::tiff_probe::Error::TooLarge { width, height } => Error::TooLarge(u64::from(width), u64::from(height)),
craft_image_codecs::tiff_probe::Error::Unsupported(reason) => Error::Unsupported(F, reason),
craft_image_codecs::tiff_probe::Error::Malformed(message) => err(message),
}
let ifd = tiff.ifds.first().ok_or_else(|| err("no IFD"))?;
let info = ifd.image().map_err(err)?;
check_size(F, info.width as u64, info.height as u64, &DecodeOptions::default())?;
let bits = info.bits_per_sample.first().copied().unwrap_or(1);
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) {
return Err(Error::Unsupported(F, "colour type"));
}
// what `craft-image-codecs`'s TIFF decoder decompresses: none, CCITT G4, LZW, JPEG, Deflate, PackBits
if !matches!(info.compression, 1 | 4 | 5 | 7 | 8 | 32773 | 32946) {
return Err(Error::Unsupported(F, "compression method"));
}
let len = bytes.len() as u64;
if info.offsets.is_empty()
|| info.offsets.iter().zip(&info.byte_counts).any(|(&o, &c)| c > 0 && (o >= len || (info.compression == 1 && o.saturating_add(c) > len)))
{
return Err(err("truncated: image data past the end of the file"));
}
let orientation = ifd.u16(craft_tiff::tags::ORIENTATION).filter(|o| (1..=8).contains(o)).unwrap_or(1);
Ok((info.width, info.height, orientation))
}
+1 -1
View File
@@ -2343,7 +2343,7 @@ fn preview_only_raw_shows_badge_and_notices() {
// …which re-reads the file and says what came of it (a demo photo has none to re-read)
let r = h.request("ui.clickWidget", json!({"id": "button:reloadPreviewOnly:info"}), t);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
// Read the timed toast before settling advances the simulated clock past its expiry.
assert_eq!(h.app.ui.toast.clone().map(|x| x.0).as_deref(), Some("This raw variant still can't be decoded"));
// a regular photo: no notice
h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [other.0]}}), t);
+1 -1
View File
@@ -509,7 +509,7 @@ fn batch_merge_runs_each_set_in_turn() {
let rows = h.app.session.activity.list();
assert_eq!((rows.len(), rows.first().map(|r| r.kind)), (1, Some("merge")));
// the first merge finishes and the second starts by itself
assert!(h.step_until(T, |h| h.app.merge.batch.len() == 1 && h.app.merge.final_task.is_some()));
assert!(h.step_until(super::ui_settle_timeout(), |h| h.app.merge.batch.len() == 1 && h.app.merge.final_task.is_some()));
assert_eq!(h.app.session.catalog.len(), 10);
// cancelling the second drops the third
let rows = h.app.session.activity.list();
+3 -3
View File
@@ -162,7 +162,7 @@ mod in_the_loupe {
let mut h = Headless::new(app, size, 1.0);
let r = h.request("ui.set", json!({"view": "detail", "right": "none", "filmstrip": false}), T);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
h.settle(super::super::ui_settle_timeout());
let native = {
let id = h.app.session.active().expect("a photo is open");
let p = h.app.session.catalog.photo(id).expect("it is in the catalog");
@@ -848,7 +848,7 @@ mod in_the_loupe {
#[test]
fn pinch_display_fit_does_not_follow_the_old_photo() {
let (mut h, _) = demo_detail_in([1400.0, 900.0]);
assert!(h.settle(SETTLE));
assert!(h.settle(super::super::ui_settle_timeout()));
let old = h.app.session.active().unwrap();
let next = h.app.session.visible_cloned().into_iter().find(|id| *id != old).unwrap();
let initial_fit = drawn_fit(&h);
@@ -874,7 +874,7 @@ mod in_the_loupe {
fn pinch_display_fit_is_shared_with_a_hover_during_the_hold() {
let (mut h, _) = demo_detail_in([1400.0, 900.0]);
assert_eq!(h.request("engine.execute", json!({"command": "panel.profiles"}), T)["ok"], true);
assert!(h.settle(SETTLE));
assert!(h.settle(super::super::ui_settle_timeout()));
let initial_fit = drawn_fit(&h);
let work = std::rc::Rc::new(std::cell::RefCell::new(PinchWork::default()));
h.app.renderer.set_offload(Box::new(PinchOffload(work.clone())));
+3 -3
View File
@@ -457,7 +457,7 @@ fn a_photo_deleted_while_it_plays_does_not_stall_the_slideshow() {
run(&mut h, "photo.delete", json!({"ids": [next.0]}));
run(&mut h, "photo.deletePermanently", json!({"ids": [next.0]}));
assert!(h.app.session.catalog.photo(next).is_none());
assert!(h.step_until(SETTLE, |h| h.app.ui.slideshow.as_ref().is_some_and(|r| r.play.position().0 >= 3)), "it plays on");
assert!(h.step_until(super::ui_settle_timeout(), |h| h.app.ui.slideshow.as_ref().is_some_and(|r| r.play.position().0 >= 3)), "it plays on");
assert!(photos.len() > 3);
h.settle(SETTLE);
}
@@ -630,7 +630,7 @@ fn settings_shows_the_slide_layout_and_a_live_preview() {
assert!(has(&h, w), "{w}");
}
// the preview is the composed slide, rendered off the UI thread
assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == first)));
assert!(h.step_until(super::ui_settle_timeout(), |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == first)));
// a checkbox goes through slideshow.layout, and its controls appear (scrolled into view)
reveal(&mut h, "check:settings.slideshowShadow");
let r = h.request("ui.clickWidget", json!({"id": "check:settings.slideshowShadow"}), T);
@@ -641,7 +641,7 @@ fn settings_shows_the_slide_layout_and_a_live_preview() {
// a changed layout renders the preview again (once it has settled)
let before = h.app.renderer.textures.get(&Slot::SlidePreview).map(|t| t.key);
run(&mut h, "slideshow.layout", json!({"margins": 0.2, "backdropColor": "#00ff00"}));
assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).map(|t| t.key) != before));
assert!(h.step_until(super::ui_settle_timeout(), |h| h.app.renderer.textures.get(&Slot::SlidePreview).map(|t| t.key) != before));
h.step();
// (the preview is pinned above the page: in view already)
reveal(&mut h, "slideshow:preview");
File diff suppressed because one or more lines are too long