test(app): screen smoke tests and thumbnail decoding on Windows
Every screen is rendered from the --capture sample data in an off-screen main window in both themes; thumbnails are decoded from embedded previews with orientation. The sign-in flow now stores the login token on every IServerApi, and thumbnail pending loads include index lookups so capture waits for them. A cancelled-load test no longer depends on scheduling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+461
-9
No files matched your search
@@ -118,17 +118,22 @@ public sealed class ThumbnailCacheTests
|
||||
public async Task ALoadAfterACancelledOneStartsFresh()
|
||||
{
|
||||
var attempts = 0;
|
||||
var blocked = true;
|
||||
using var cache = new ThumbnailCache<int, string>(8, async (k, ct) =>
|
||||
{
|
||||
if (Interlocked.Increment(ref attempts) == 1) await Task.Delay(Timeout.Infinite, ct);
|
||||
Interlocked.Increment(ref attempts);
|
||||
if (Volatile.Read(ref blocked)) await Task.Delay(Timeout.Infinite, ct);
|
||||
return "img" + k;
|
||||
});
|
||||
using var scrolledAway = new CancellationTokenSource();
|
||||
var first = cache.GetAsync(9, scrolledAway.Token);
|
||||
scrolledAway.Cancel();
|
||||
await Assert.ThrowsAsync<OperationCanceledException>(() => first);
|
||||
Volatile.Write(ref blocked, false);
|
||||
Assert.Equal("img9", await cache.GetAsync(9, CancellationToken.None).WaitAsync(Wait));
|
||||
Assert.Equal(2, attempts);
|
||||
// The cancelled load may have stopped before it reached the decoder.
|
||||
Assert.InRange(Volatile.Read(ref attempts), 1, 2);
|
||||
Assert.Equal(0, cache.PendingLoads);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user