From 253bc2ea64321684fe91c0d1ff49c753107a2bdc Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Thu, 19 Nov 2026 01:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=97=B6=E5=BA=8F=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=89=8D=E7=9A=84=E5=90=8E=E7=BB=AD=E9=9D=99=E6=80=81?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=B8=8D=E4=BC=9A=E8=AF=AF=E6=94=BE=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ObservationWindowChecks.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/VisionDecision.Smoke/ObservationWindowChecks.cs b/tests/VisionDecision.Smoke/ObservationWindowChecks.cs index 95c2c4a..b5227de 100644 --- a/tests/VisionDecision.Smoke/ObservationWindowChecks.cs +++ b/tests/VisionDecision.Smoke/ObservationWindowChecks.cs @@ -37,6 +37,10 @@ internal static class ObservationWindowChecks config.Sop.Regions["work"] = new() { X1 = 0, Y1 = 0, X2 = 100, Y2 = 100 }; config.Sop.Steps.Add(new() { Id = 1, Name = "通用过程", Description = "目标经历指定状态变化后到位", Detection = new() { Method = ConditionMethod.HandInRegion, Region = "work", Hand = "right", StableFrames = 1, Tolerance = 1 }, AiConfirmation = options }); + config.Sop.Regions["next"] = new() { X1 = 0, Y1 = 0, X2 = 100, Y2 = 100 }; + config.Sop.Steps.Add(new() { Id = 2, Name = "后续静态步骤", Description = "后续结果可见", + Detection = new() { Method = ConditionMethod.HandInRegion, Region = "next", Hand = "right", StableFrames = 1, Tolerance = 1 }, + AiConfirmation = new() }); var client = new Client(); var engine = new SopEngine { VisionDecisionClient = client }; engine.Load(config); engine.Start(); VisionDecisionRequest? accepted = null; var evaluated = 0; engine.DecisionEvaluated += (r, d, ok) => { evaluated++; if (ok) accepted = r; }; @@ -59,9 +63,17 @@ internal static class ObservationWindowChecks var third = client.Calls.ElementAt(2); var frames = third.Request.Frames!; var finish = frames[^2]; third.Result.SetResult(new(true, .99, "状态变化与结果均可见", VisionDecisionStatus.Completed, [frames[0].FrameId, finish.FrameId], finish.FrameId)); - await Until(() => { engine.ProcessFrame(Frame(7)); return engine.State == EngineState.Completed; }); - Check(engine.State == EngineState.Completed && accepted?.FrameId == finish.FrameId && accepted.SourceSeconds == finish.SourceSeconds, + await Until(() => { engine.ProcessFrame(Frame(7)); return engine.CurrentStep?.Id == 2; }); + Check(accepted?.FrameId == finish.FrameId && accepted.SourceSeconds == finish.SourceSeconds, "完成证据和时间必须来自模型引用的真实完成帧,不能使用请求尾帧或返回时间"); + engine.ProcessFrame(Frame(7)); + Check(client.Calls.Count == 3 && !engine.HasPendingDecision && engine.State == EngineState.Running, + "前序过程完成之前捕获的后续静态图必须丢弃,不能按旧图放行"); + Feed(8); await Until(() => client.Calls.Count == 4); + var fourth = client.Calls.ElementAt(3); + Check(fourth.Request.StepId == 2 && fourth.Request.FrameId == 8, "后续静态步骤须重新获取前序完成之后的真实画面"); + fourth.Result.SetResult(new(true, .99, "后续可见结果")); + await Until(() => { engine.ProcessFrame(Frame(8)); return engine.State == EngineState.Completed; }); engine.Stop(); Check(!engine.HasPendingDecision, "停止必须清空过程缓存"); using var http = new HttpClient(); var blocked = await new D3VisionDecisionClient(http).DecideAsync(first.Request, default);