From b7a293ce31b61fccdfbc4e7914f90bb9a4ca277c Mon Sep 17 00:00:00 2001 From: routersys Date: Sun, 13 Sep 2026 17:09:40 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=AD=E3=81=AE=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E3=81=AE=E8=A9=A6=E9=A8=93=E3=81=8B=E3=82=89=E7=AB=B6?= =?UTF-8?q?=E5=90=88=E3=82=92=E5=8F=96=E3=82=8A=E9=99=A4=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProxyForge.Tests/ProxySourceProviderTests.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ProxyForge.Tests/ProxySourceProviderTests.cs b/ProxyForge.Tests/ProxySourceProviderTests.cs index fdfbbbf..6599fd4 100644 --- a/ProxyForge.Tests/ProxySourceProviderTests.cs +++ b/ProxyForge.Tests/ProxySourceProviderTests.cs @@ -22,7 +22,7 @@ public sealed class ProxySourceProviderTests : IDisposable readonly TaskCompletionSource release = new(); bool exporting; bool refuseAll; - bool holdEncodes; + bool holdOpen; int encoded; public ProxySourceProviderTests() @@ -55,17 +55,18 @@ public sealed class ProxySourceProviderTests : IDisposable FailedRetention = TimeSpan.FromMilliseconds(50), }; - Task Open(ProxyEncodeRequest request, CancellationToken cancellationToken) + async Task Open(ProxyEncodeRequest request, CancellationToken cancellationToken) { + if (holdOpen) + await release.Task; + var analysis = new ProxyAnalysis(new ProxyGeometry(960, 540), new DisplayBounds(-960f, -540f, 1920f, 1080f), new FrameRate(30, 1), TimeSpan.FromSeconds(20), 600); - return Task.FromResult(new FakeEncodeSession(analysis, async (_, _, output, _, _) => + return new FakeEncodeSession(analysis, (_, _, output, _, _) => { - if (holdEncodes) - await release.Task; encoded++; File.WriteAllBytes(output, new byte[64]); - return 64L; - })); + return Task.FromResult(64L); + }); } IVideoFileSource? Factory(IGraphicsDevicesAndContext target, string path) @@ -307,13 +308,14 @@ public sealed class ProxySourceProviderTests : IDisposable { var path = CreateFile(); var identity = IdentityOf(path); - holdEncodes = true; + holdOpen = true; queue.TryEnqueue(identity, 50); settings.GeneratesAutomatically = false; using var source = CreateProvider().Create(context, path); var proxy = Assert.IsType(source); + Assert.True(proxy.HasOriginal); Assert.Equal(TimeSpan.FromSeconds(20), proxy.Duration); release.SetResult(); await queue.WhenIdleAsync();