E3: prove di codec, rimuxaggio, fotogrammi, copie e conversione

Le prove del nucleo della tappa E3 (WP6a), con i media costruiti dalle
prove: il controllo delle foto (stesso formato, HEIC/AVIF/raw, animate,
CMYK e oltre 8 bit, budget di pixel), metadati nei blocchi giusti e
perdite annotate, pixel identici in WEBP senza perdita; il rimuxaggio
da MOV (nuovo TestVideos.Mov) e Matroska a MP4 con campioni, date,
rotazione, lingua ed edit; i fotogrammi H.264 e H.265 all'istante, ogni
k secondi e N in tutto; i suffissi protetti dal taglio a 240; le copie
convertite, com'è con nota, adozione, «già copiato» in ogni forma,
«Copia di nuovo» esatta, spazio sul convertito, fotogrammi nella
cartella delle copie (FrameOnly, una copia per campione, lotti su più
pagine, tetto); la conversione della libreria (perdite, rimuxaggio,
doppioni, importazione delle copie convertite).

Servono a fissare il comportamento di E3 prima dell'unione. Nessun
codice del prodotto cambia; un limite trovato (istanti a meno di 1 ms
in «N in tutto») è annotato per Alberto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-28 11:00:40 +01:00
1 parent d06b587806
commit f5e12c5d74
9 files changed
+1408 -4

No files matched your search

@@ -150,6 +150,53 @@ public sealed class ExportPathsTests
Assert.IsLessThanOrEqualTo(WindowsFileNames.MaxPathLength, Path.TrimEndingDirectorySeparator(root).Length + 1 + numbered.Length);
}
[TestMethod]
public void TheTargetExtensionReplacesTheSourceOneAndAFrameSuffixFollowsTheStem()
{
// Tappa E3 (WP1.8): a converted copy takes the extension of its format, a frame adds its suffix before it.
var asJpg = new ExportNameOptions(".jpg", null);
var png = Photo(1) with { RelativePath = "post/2026/vecchio_1.PNG" };
CollectionAssert.AreEqual(
new[] { "marta.demo", "post", "2026", "2026-10-13_10-00-00_C500_1.jpg" },
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), png, null, false, TestZones.Rome, asJpg).ToArray());
var frame = new ExportNameOptions(".png", "_t0m01s250");
CollectionAssert.AreEqual(
new[] { "marta.demo", "post", "2026", "2026-10-13_10-00-00_C500_1_t0m01s250.png" },
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), png, null, false, TestZones.Rome, frame).ToArray());
// A file of «importati/» keeps its name, with the extension swapped too.
var imported = Photo(1) with { RelativePath = "importati/vacanze/IMG 0001.HEIC.mov" };
CollectionAssert.AreEqual(
new[] { "marta.demo", "importati", "vacanze", "IMG 0001.HEIC.mp4" },
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), imported, null, false, TestZones.Rome, new ExportNameOptions(".mp4", null)).ToArray());
CollectionAssert.AreEqual(
new[] { "marta.demo", "importati", "vacanze", "IMG 0001.HEIC_f001.png" },
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), imported, null, false, TestZones.Rome, new ExportNameOptions(".png", "_f001")).ToArray());
// No options: nothing changes.
CollectionAssert.AreEqual(
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), png, null, false, TestZones.Rome).ToArray(),
ExportPaths.Segments(General(), LibraryNaming.Default, Marta, Post(), png, null, false, TestZones.Rome, new ExportNameOptions(null, null)).ToArray());
}
[TestMethod]
public void TheFrameSuffixSurvivesTheShorteningTo240()
{
var root = Path.Combine(Path.GetTempPath(), new string('r', 120));
var deep = General() with { RootPath = root };
var segments = new[] { "marta.demo", new string('a', 60), new string('b', 80) + "_t12m05s340.png" };
var fitted = ExportPaths.RelativePathFor(deep, segments, keepSuffix: "_t12m05s340");
Assert.IsLessThanOrEqualTo(WindowsFileNames.MaxPathLength, Path.TrimEndingDirectorySeparator(root).Length + 1 + fitted.Length);
StringAssert.EndsWith(fitted, "_t12m05s340.png");
// The numbered names of the safe writer keep it and put the number after it.
var numbered = ExportPaths.NumberedName(root, fitted, 2, keepSuffix: "_t12m05s340");
StringAssert.EndsWith(numbered, "_t12m05s340 (2).png");
Assert.IsLessThanOrEqualTo(WindowsFileNames.MaxPathLength, Path.TrimEndingDirectorySeparator(root).Length + 1 + numbered.Length);
Assert.AreEqual("marta.demo/x_f001.png", ExportPaths.RelativePathFor(deep, ["marta.demo", "x_f001.png"], keepSuffix: "_f001"), "short paths are not touched");
}
[TestMethod]
public void TheNamingPreviewOfADestinationTakesTheLibrarySchemesWhenNull()
{