Signature table for every format and tie-break; every FrameMetadata field from JPEG in both byte orders; timestamp fallbacks (digitized, XMP, GPS, file time), sub-seconds and offsets, orientation, ISO and APEX rules, GPS validation; XMP attribute/element forms, priority, DTD refusal, size cap and extended-XMP reassembly; CR2/NEF/DNG/ARW/ORF/RW2 main-image selection, previews with real sizes and MakerNote fallbacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using Titano.Core.Metadata;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.Core.Tests.Metadata;
|
|
|
|
internal static class MetadataTestHelpers
|
|
{
|
|
public static FrameMetadata Read(byte[] data, string? fileName = null, DateTime? modified = null) =>
|
|
MetadataReader.Read(new MemoryStream(data, writable: false), fileName, modified);
|
|
|
|
/// <summary>The reader's safety net turns parser defects into "Parser fault" warnings; tests require none.</summary>
|
|
public static void AssertNoFault(FrameMetadata m)
|
|
{
|
|
foreach (var w in m.Warnings)
|
|
{
|
|
if (w.StartsWith("Parser fault", StringComparison.Ordinal)) Assert.Fail(w);
|
|
}
|
|
}
|
|
|
|
public static void AssertPreviews(FrameMetadata m, params (int Width, int Height, PreviewKind Kind)[] expected)
|
|
{
|
|
Assert.SequenceEqual(expected, m.Previews.Select(p => (p.Width, p.Height, p.Kind)), "previews");
|
|
foreach (var p in m.Previews) Assert.True(p.Offset > 0 && p.Length > 0, $"preview at {p.Offset} length {p.Length}");
|
|
}
|
|
}
|