using Avalonia.Media.Imaging;
using AvParser.Core.Collecting;
using AvParser.UI.Media;
namespace AvParser.UI.HeadlessTests;
///
/// A cache that decodes nothing.
///
///
/// Returning null is exactly what the real cache does for a video or a missing blob, so the view
/// models are already required to cope with it — which is what makes this an honest stand-in
/// rather than a convenient one. It records what was asked for, so tests can assert that a page
/// requested previews at all.
///
internal sealed class FakeThumbnailCache : IThumbnailCache
{
public List<(string Sha256, int Width)> Requested { get; } = [];
public Task GetAsync(
string sha256,
string extension,
MediaKind kind,
int width,
CancellationToken ct = default
)
{
lock (Requested)
{
Requested.Add((sha256, width));
}
return Task.FromResult(null);
}
public void Clear() => Requested.Clear();
}