mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-27 11:37:13 -06:00
Merge PR #1165: LR-IMP-FORMATS: folder import finds Sony SR2 and SRF files
docs/parity-checklist.md: LR-IMP-FORMATS row keeps main's DNG/Hasselblad text and adds #1165's SR2/SRF phrase; revision rows are the union docs/raw-parity.md, docs/gaps.md: revision rows are the union
This commit is contained in:
@@ -32,10 +32,11 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::Session;
|
||||
use crate::media::ProbeInfo;
|
||||
|
||||
/// File extensions LightCraft imports (lower case).
|
||||
/// File extensions offered by import discovery and file pickers (lower case).
|
||||
/// This includes preview-only raws; the file probe decides whether sensor decoding is available.
|
||||
pub const EXTENSIONS: &[&str] = &[
|
||||
"jpg", "jpeg", "png", "tif", "tiff", "webp", "dng", "cr2", "cr3", "nef", "nrw", "arw", "raf", "orf", "rw2", "rwl", "raw", "pef", "srw", "psd",
|
||||
"jxl", "gif", "bmp",
|
||||
"jpg", "jpeg", "png", "tif", "tiff", "webp", "dng", "cr2", "cr3", "nef", "nrw", "arw", "sr2", "srf", "raf", "orf", "rw2", "rwl", "raw", "pef",
|
||||
"srw", "psd", "jxl", "gif", "bmp",
|
||||
// Decoded when built with the codecs' `heif` feature; otherwise the import reports them as
|
||||
// failed with the reason ("HEIC/HEIF support isn't included in this build").
|
||||
"heic", "heif", "avif", // no AV1 decoder yet: reported as failed, like a HEIC without the feature
|
||||
|
||||
@@ -30,6 +30,25 @@ fn ids(v: &Value, key: &str) -> usize {
|
||||
v[key].as_array().map(Vec::len).unwrap_or(0)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_discovery_includes_sony_sr2_and_srf_case_insensitively() {
|
||||
let src = temp_dir("sony-discovery");
|
||||
std::fs::create_dir_all(src.join("trip/day2")).unwrap();
|
||||
let names = ["r1.SR2", "f828.srf", "trip/r1.sr2", "trip/f828.SRF", "trip/day2/r1.Sr2", "trip/day2/f828.SrF", "control.JPG"];
|
||||
let mut expected: Vec<String> = names.iter().map(|name| src.join(name).to_string_lossy().into_owned()).collect();
|
||||
for path in &expected {
|
||||
std::fs::write(path, b"discovery only, not a decoded photo").unwrap();
|
||||
}
|
||||
std::fs::write(src.join("trip/notes.txt"), b"not a photo").unwrap();
|
||||
|
||||
let mut found = crate::import::expand(&[src.to_string_lossy().into_owned()], None);
|
||||
found.sort();
|
||||
expected.sort();
|
||||
assert_eq!(found, expected);
|
||||
assert_eq!(crate::import::expand(&expected, None), expected, "folder and direct discovery agree");
|
||||
std::fs::remove_dir_all(src).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recursive_import_with_duplicates() {
|
||||
let src = temp_dir("src");
|
||||
|
||||
Reference in New Issue
Block a user