精简主界面统计并为每个步骤累计正常与异常次数
This commit is contained in:
parent
f0574a2e3c
commit
716077061b
@ -57,6 +57,8 @@ pwsh -File tools/Publish-Avalonia.ps1
|
||||
|
||||
`--import-recipes 原数据根目录` 可以导入已有配方,`--check-standalone` / `--check-runtime` 检查本地手部模型和使用模拟 AI 的步骤门控,`--check-gpu` 额外要求手部推理使用 GPU;这些本地诊断不代表真实 D3 接口联调成功。
|
||||
|
||||
主界面每个步骤显示正常次数和异常次数:正常完成计入正常,异常跳过计入异常;按配方累计本次运行的结果,复位、停止或重新应用配方不会清零,重启软件后重新统计。
|
||||
|
||||
## 验证
|
||||
|
||||
```powershell
|
||||
|
||||
@ -61,7 +61,6 @@
|
||||
</Border>
|
||||
<Grid Grid.Column="1" Grid.RowSpan="2" Margin="10,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@ -81,17 +80,13 @@
|
||||
<TextBlock Text="帧率" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding FpsText}" TextWrapping="Wrap" Foreground="{StaticResource FgDim}" />
|
||||
</Grid>
|
||||
<Grid x:Name="RunStatisticsPanel" ColumnDefinitions="Auto,*,Auto,*" RowDefinitions="Auto,Auto,Auto" Margin="0,10,0,0">
|
||||
<TextBlock Text="完成次数" Margin="0,0,8,6" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding CompletedCount}" Foreground="{StaticResource Accent}" />
|
||||
<TextBlock Grid.Column="2" Text="流程计时" Margin="8,0,8,6" />
|
||||
<TextBlock Grid.Column="3" Text="{Binding FlowElapsedText}" />
|
||||
<TextBlock Grid.Row="1" Text="步骤计时" Margin="0,0,8,6" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding StepElapsedText}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="标准用时" Margin="8,0,8,6" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding StandardDurationText}" />
|
||||
<TextBlock Grid.Row="2" Text="平均用时" Margin="0,0,8,0" ToolTip.Tip="完成次数大于10时,显示最近10次完成流程的平均用时" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding AverageDurationText}" ToolTip.Tip="完成次数不超过10时为0;停止或重置的未完成流程不参与统计" />
|
||||
<Grid x:Name="RunStatisticsPanel" ColumnDefinitions="Auto,*,Auto,*" RowDefinitions="Auto,Auto" Margin="0,10,0,0">
|
||||
<TextBlock Text="流程计时" Margin="0,0,8,6" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding FlowElapsedText}" />
|
||||
<TextBlock Grid.Column="2" Text="步骤计时" Margin="8,0,8,6" />
|
||||
<TextBlock Grid.Column="3" Text="{Binding StepElapsedText}" />
|
||||
<TextBlock Grid.Row="1" Text="标准用时" Margin="0,0,8,0" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding StandardDurationText}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@ -101,25 +96,6 @@
|
||||
<Button Content="重置步骤" Margin="6,0,0,0" Command="{Binding ResetCommand}" />
|
||||
</WrapPanel>
|
||||
<Border Grid.Row="2" Margin="0,10,0,0" Classes="panel">
|
||||
<StackPanel>
|
||||
<TextBlock Text="违规 Top3" Classes="Title" />
|
||||
<ItemsControl ItemsSource="{Binding Violations}" Margin="0,8,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Foreground="{StaticResource Ng}" TextTrimming="CharacterEllipsis">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0:HH:mm:ss} {1}">
|
||||
<Binding Path="Time" />
|
||||
<Binding Path="Message" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="3" Margin="0,10,0,0" Classes="panel">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<StackPanel>
|
||||
<TextBlock Text="步骤" Classes="Title" />
|
||||
@ -135,7 +111,11 @@
|
||||
<TextBlock Text="已跳过/未通过" Foreground="#D97706" IsVisible="{Binding IsSkipped}" Margin="8,0,0,0" />
|
||||
<Rectangle x:Name="dot" Width="8" Height="8" Margin="8,0,0,0" VerticalAlignment="Center" Fill="{StaticResource Ok}" Classes.state4="{Binding IsMet}" IsVisible="False" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding ElapsedText, StringFormat=用时:{0}}" Foreground="{StaticResource FgDim}" FontSize="12" Margin="28,3,0,0" />
|
||||
<WrapPanel Margin="28,3,0,0">
|
||||
<TextBlock Text="{Binding ElapsedText, StringFormat=用时:{0}}" Foreground="{StaticResource FgDim}" FontSize="12" />
|
||||
<TextBlock Text="{Binding NormalCount, StringFormat=正常次数:{0}}" FontSize="12" Margin="12,0,0,0" />
|
||||
<TextBlock Text="{Binding AbnormalCount, StringFormat=异常次数:{0}}" FontSize="12" Margin="12,0,0,0" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
@ -144,7 +124,7 @@
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Ellipse Width="10" Height="10" Fill="{StaticResource Line}" Classes.state7="{Binding IsConnected}">
|
||||
</Ellipse>
|
||||
<TextBlock Text="{Binding ConnectionText}" Margin="6,0,0,0" Foreground="{StaticResource FgDim}" />
|
||||
|
||||
@ -25,7 +25,6 @@ public class SopPageViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly System.Net.Http.HttpClient VisionHttp = new() { Timeout = System.Threading.Timeout.InfiniteTimeSpan };
|
||||
private const int MaxLogLines = 300;
|
||||
private const int MaxTopViolations = 3;
|
||||
|
||||
/// <summary>配方目录(相对程序目录)</summary>
|
||||
private static string RecipeDirectory => DesktopPlatform.Recipes.RecipesDirectory;
|
||||
@ -127,7 +126,6 @@ public class SopPageViewModel : ViewModelBase
|
||||
// 帧 Mat 只在采集线程的事件存活期内有效(事件返回即被释放),必须当场克隆
|
||||
_camera.FrameArrived += OnCameraFrame;
|
||||
_engine.LogArrived += entry => _dispatcher.BeginInvoke(() => AppendLog(entry));
|
||||
_engine.ViolationRaised += violation => _dispatcher.BeginInvoke(() => AppendViolation(violation));
|
||||
_engine.StepSnapshotChanged += OnStepSnapshot;
|
||||
_engine.RoundStarted += OnRoundStarted;
|
||||
_engine.RoundFinished += OnRoundFinished;
|
||||
@ -175,9 +173,6 @@ public class SopPageViewModel : ViewModelBase
|
||||
/// <summary>步骤卡</summary>
|
||||
public ObservableCollection<StepCard> StepCards { get; } = [];
|
||||
|
||||
/// <summary>Top3 违规</summary>
|
||||
public ObservableCollection<ViolationItem> Violations { get; } = [];
|
||||
|
||||
/// <summary>日志</summary>
|
||||
public ObservableCollection<LogItem> Logs { get; } = [];
|
||||
public void ReportD3Service(string message, bool error = false)
|
||||
@ -850,8 +845,12 @@ public class SopPageViewModel : ViewModelBase
|
||||
Rois.Clear();
|
||||
|
||||
foreach (var step in config.Sop.Steps.OrderBy(s => s.Id))
|
||||
StepCards.Add(new StepCard { StepId = step.Id, Name = step.Name, Message = "—",
|
||||
SaveCompletionImage = step.SaveCompletionImage, CompletionImageDirectory = step.CompletionImageDirectory });
|
||||
{
|
||||
var card = new StepCard { StepId = step.Id, Name = step.Name, Message = "—",
|
||||
SaveCompletionImage = step.SaveCompletionImage, CompletionImageDirectory = step.CompletionImageDirectory };
|
||||
UpdateStepCounts(card, _engine.Statistics);
|
||||
StepCards.Add(card);
|
||||
}
|
||||
|
||||
foreach (var (name, def) in config.Sop.Regions)
|
||||
Rois.Add(new RoiItem { Name = name, X = def.X1, Y = def.Y1, W = def.X2 - def.X1, H = def.Y2 - def.Y1, ColorHex = def.Color });
|
||||
@ -914,6 +913,7 @@ public class SopPageViewModel : ViewModelBase
|
||||
AverageDurationText = FormatDuration(statistics.AverageDuration);
|
||||
StandardDurationText = FormatDuration(!string.IsNullOrWhiteSpace(recipe) && Recipes.Contains(recipe)
|
||||
? SopHelper.Engine.Training.SopStandardVideoDuration.Get(DesktopPlatform.Recipes.DirectoryFor(name)) : TimeSpan.Zero);
|
||||
foreach (var stepCard in StepCards) UpdateStepCounts(stepCard, _engine.Statistics);
|
||||
if (IsRunning && _engine.CurrentStep is { } step && StepCards.FirstOrDefault(c => c.StepId == step.Id) is { } card)
|
||||
card.ElapsedText = StepElapsedText;
|
||||
}
|
||||
@ -999,11 +999,19 @@ public class SopPageViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateStepCounts(StepCard card, SopRunStatistics statistics)
|
||||
{
|
||||
var counts = statistics.GetStepCounts(card.StepId);
|
||||
card.NormalCount = counts.NormalCount;
|
||||
card.AbnormalCount = counts.AbnormalCount;
|
||||
}
|
||||
|
||||
private void UpdateCard(StepSnapshot snapshot)
|
||||
{
|
||||
var card = StepCards.FirstOrDefault(c => c.StepId == snapshot.StepId);
|
||||
if (card is null) return;
|
||||
|
||||
UpdateStepCounts(card, _engine.Statistics);
|
||||
card.IsCurrent = snapshot.IsCurrent;
|
||||
card.IsMet = snapshot.IsMet;
|
||||
card.IsSkipped = snapshot.IsSkipped;
|
||||
@ -1052,20 +1060,6 @@ public class SopPageViewModel : ViewModelBase
|
||||
catch (Exception error) { Log("warn", $"步骤 {card.StepId} 结束图保存失败:{error.Message}"); }
|
||||
}
|
||||
|
||||
private void AppendViolation(ViolationEvent violation)
|
||||
{
|
||||
Violations.Insert(0, new ViolationItem
|
||||
{
|
||||
Time = violation.At,
|
||||
StepId = violation.StepId,
|
||||
Type = violation.Type,
|
||||
Message = violation.Message,
|
||||
});
|
||||
|
||||
while (Violations.Count > MaxTopViolations)
|
||||
Violations.RemoveAt(Violations.Count - 1);
|
||||
}
|
||||
|
||||
private void AppendLog(LogEntry entry)
|
||||
{
|
||||
Logs.Add(new LogItem { Time = entry.At, Level = entry.Level, Message = entry.Message });
|
||||
@ -1085,6 +1079,9 @@ public class SopPageViewModel : ViewModelBase
|
||||
/// </summary>
|
||||
public class StepCard : ViewModelBase
|
||||
{
|
||||
private long _normalCount, _abnormalCount;
|
||||
public long NormalCount { get => _normalCount; set => SetProperty(ref _normalCount, value); }
|
||||
public long AbnormalCount { get => _abnormalCount; set => SetProperty(ref _abnormalCount, value); }
|
||||
private string _elapsedText = "00:00:00";
|
||||
public string ElapsedText { get => _elapsedText; set => SetProperty(ref _elapsedText, value); }
|
||||
public bool SaveCompletionImage { get; init; } = true;
|
||||
@ -1141,24 +1138,6 @@ public class StepCard : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Top3 违规条目
|
||||
/// </summary>
|
||||
public class ViolationItem
|
||||
{
|
||||
/// <summary>时刻</summary>
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
/// <summary>步骤 Id</summary>
|
||||
public int StepId { get; set; }
|
||||
|
||||
/// <summary>类型</summary>
|
||||
public string Type { get; set; } = "";
|
||||
|
||||
/// <summary>文案</summary>
|
||||
public string Message { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 日志条目
|
||||
/// </summary>
|
||||
|
||||
@ -107,7 +107,7 @@ public partial class SopEngine
|
||||
/// <summary>每帧判定后的步骤状态快照(UI 步骤卡数据源)</summary>
|
||||
public event Action<StepSnapshot>? StepSnapshotChanged;
|
||||
|
||||
/// <summary>违规(Top3 横幅数据源)</summary>
|
||||
/// <summary>违规事件</summary>
|
||||
public event Action<ViolationEvent>? ViolationRaised;
|
||||
|
||||
/// <summary>日志</summary>
|
||||
@ -269,6 +269,7 @@ public partial class SopEngine
|
||||
Elapsed = Statistics.StepElapsed,
|
||||
};
|
||||
|
||||
if (result.IsMet || result.IsSkipped) Statistics.RecordStepResult(step.Id, !result.IsSkipped);
|
||||
StepSnapshotChanged?.Invoke(snapshot);
|
||||
|
||||
if (!result.IsMet && !result.IsSkipped) return;
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
namespace SopHelper.Engine.Sop;
|
||||
|
||||
public readonly record struct StepRunCounts(long NormalCount, long AbnormalCount);
|
||||
|
||||
/// <summary>Session statistics for one recipe; elapsed times exclude pauses.</summary>
|
||||
public sealed class SopRunStatistics(TimeProvider? timeProvider = null)
|
||||
{
|
||||
private readonly TimeProvider _clock = timeProvider ?? TimeProvider.System;
|
||||
private readonly object _gate = new();
|
||||
private readonly Queue<TimeSpan> _recent = new();
|
||||
private readonly Dictionary<int, StepRunCounts> _stepCounts = [];
|
||||
private TimeSpan _flow, _step;
|
||||
private long _since;
|
||||
private bool _active, _running;
|
||||
@ -14,6 +17,19 @@ public sealed class SopRunStatistics(TimeProvider? timeProvider = null)
|
||||
public TimeSpan FlowElapsed { get { lock (_gate) return _flow + RunningElapsed; } }
|
||||
public TimeSpan StepElapsed { get { lock (_gate) return _step + RunningElapsed; } }
|
||||
public TimeSpan AverageDuration { get { lock (_gate) return _completed > 10 ? TimeSpan.FromTicks((long)_recent.Average(t => t.Ticks)) : TimeSpan.Zero; } }
|
||||
public StepRunCounts GetStepCounts(int stepId)
|
||||
{
|
||||
lock (_gate) return _stepCounts.GetValueOrDefault(stepId);
|
||||
}
|
||||
internal void RecordStepResult(int stepId, bool normal)
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
var counts = _stepCounts.GetValueOrDefault(stepId);
|
||||
_stepCounts[stepId] = normal ? counts with { NormalCount = counts.NormalCount + 1 }
|
||||
: counts with { AbnormalCount = counts.AbnormalCount + 1 };
|
||||
}
|
||||
}
|
||||
private TimeSpan RunningElapsed => _running ? _clock.GetElapsedTime(_since) : TimeSpan.Zero;
|
||||
private void Accumulate()
|
||||
{
|
||||
|
||||
@ -87,6 +87,8 @@ internal static class Smoke
|
||||
var userCameraBefore=File.Exists(userCameraPath)?File.ReadAllBytes(userCameraPath):null;
|
||||
await Task.Delay(150);
|
||||
var app=(App)Application.Current!;var window=lifetime.MainWindow!;
|
||||
if(Environment.GetCommandLineArgs().Contains("--step-counts-only"))
|
||||
{ await CheckStepCounts(app,window);_exit=0;return; }
|
||||
if(Environment.GetCommandLineArgs().Contains("--startup-recipe-only"))
|
||||
{
|
||||
var model=app.Container.Resolve<SopPageViewModel>();
|
||||
@ -660,6 +662,67 @@ internal static class Smoke
|
||||
}
|
||||
finally{sop.IsRunning=false;sop.ApplyRecipeCommand.Execute();}
|
||||
}
|
||||
private static async Task CheckStepCounts(App app,Window window)
|
||||
{
|
||||
var model=app.Container.Resolve<SopPageViewModel>();
|
||||
var engine=app.Container.Resolve<SopHelper.Engine.Sop.SopEngine>();
|
||||
var store=new RecipeWorkspace(Environment.GetEnvironmentVariable("SOPHELPER_WORKSPACE_ROOT")!);
|
||||
const string name="步骤次数测试";
|
||||
var config=new SopHelper.Engine.Sop.SopConfig();config.Sop.Name=name;
|
||||
for(var id=1;id<=2;id++)config.Sop.Steps.Add(new(){Id=id,Name="步骤"+id,Description="零件已放好",SaveCompletionImage=false,
|
||||
Detection=new(){Method="time_elapsed",DurationMs=1,StableFrames=1},
|
||||
AiConfirmation=new(){ImageMode="full_frame",EvidenceMode=id==1?"single_frame":"sequence",CheckWindowMs=0}});
|
||||
Directory.CreateDirectory(store.DirectoryFor(name));SopHelper.Engine.Sop.SopConfigLoader.Save(config,store.ConfigPath(name));
|
||||
model.Recipes.Add(name+".yaml");model.SelectedRecipe=name+".yaml";model.ApplyRecipeCommand.Execute();
|
||||
engine.Config.Sop.Settings.AutoResetOnComplete=false;
|
||||
var decision=new UiVisionDecision();engine.VisionDecisionClient=decision;
|
||||
var receive=typeof(SopPageViewModel).GetMethod("OnResultFrame",System.Reflection.BindingFlags.NonPublic|System.Reflection.BindingFlags.Instance)!;
|
||||
async Task Emit()
|
||||
{
|
||||
using(var frame=new Mat(48,64,MatType.CV_8UC3,new Scalar(30,60,90)))
|
||||
receive.Invoke(model,[new SopHelper.Engine.Common.FrameResult{Size=(64,48)},frame]);
|
||||
await Task.Delay(20);
|
||||
}
|
||||
void Counts(long n1,long a1,long n2,long a2,string message)=>Check(
|
||||
model.StepCards[0].NormalCount==n1&&model.StepCards[0].AbnormalCount==a1
|
||||
&&model.StepCards[1].NormalCount==n2&&model.StepCards[1].AbnormalCount==a2,message);
|
||||
model.IsRunning=true;engine.Start();
|
||||
for(var i=0;i<10&&!decision.Called.Task.IsCompleted;i++)await Emit();
|
||||
Check(decision.Called.Task.IsCompleted,"A real engine step submits its decision");
|
||||
await Emit();await Emit();Counts(0,0,0,0,"Waiting and repeated frame snapshots do not increment step counts");
|
||||
decision.Result.SetResult(new(true,.99,"确认完成"));
|
||||
for(var i=0;i<10&&engine.CurrentStep?.Id==1;i++)await Emit();
|
||||
Counts(1,0,0,0,"A completed step increments only its normal count");
|
||||
await Emit();Counts(1,0,0,1,"An abnormally skipped step increments only its abnormal count");
|
||||
for(var i=0;i<3;i++)await Emit();Counts(1,0,0,1,"Completed rounds and repeated frames do not duplicate counts");
|
||||
engine.Reset();await Task.Delay(30);Counts(1,0,0,1,"Reset preserves per-step totals");
|
||||
decision=new UiVisionDecision();engine.VisionDecisionClient=decision;
|
||||
for(var i=0;i<10&&!decision.Called.Task.IsCompleted;i++)await Emit();
|
||||
engine.Stop();model.IsRunning=false;await Task.Delay(120);
|
||||
Counts(1,0,0,1,"Stopping an unfinished step does not count as an abnormal result");
|
||||
model.ApplyRecipeCommand.Execute();await Task.Delay(30);Counts(1,0,0,1,"Reapplying a recipe restores the counts on rebuilt cards");
|
||||
model.SelectedRecipe="demo.yaml";await Task.Delay(120);Counts(1,0,0,1,"Pending recipe selection does not change the active cards' totals");
|
||||
model.ApplyRecipeCommand.Execute();await Task.Delay(120);
|
||||
Check(model.StepCards.All(c=>c.NormalCount==0&&c.AbnormalCount==0),"Another recipe has independent step totals");
|
||||
model.SelectedRecipe=name+".yaml";model.ApplyRecipeCommand.Execute();await Task.Delay(30);Counts(1,0,0,1,"Returning to the recipe restores its own totals");
|
||||
decision=new UiVisionDecision();engine.VisionDecisionClient=decision;engine.Config.Sop.Settings.AutoResetOnComplete=false;
|
||||
model.IsRunning=true;engine.Start();
|
||||
for(var i=0;i<10&&!decision.Called.Task.IsCompleted;i++)await Emit();
|
||||
decision.Result.SetResult(new(true,.99,"确认完成"));
|
||||
for(var i=0;i<10&&engine.State!=SopHelper.Engine.Sop.EngineState.Completed;i++)await Emit();
|
||||
Counts(2,0,0,2,"Later rounds accumulate each final step result exactly once");
|
||||
var view=window.GetVisualDescendants().OfType<SopPage>().Single();
|
||||
var texts=view.GetVisualDescendants().OfType<TextBlock>().Select(t=>t.Text).ToArray();
|
||||
Check(!texts.Contains("违规 Top3")&&!texts.Contains("完成次数")&&!texts.Contains("平均用时"),"Removed summary and violation panels are absent");
|
||||
Check(texts.Count(t=>t?.StartsWith("正常次数:")==true)==2&&texts.Count(t=>t?.StartsWith("异常次数:")==true)==2
|
||||
&&texts.Contains("正常次数:2")&&texts.Contains("异常次数:2"),"Every step card renders its bound normal and abnormal counts");
|
||||
window.WindowState=WindowState.Normal;window.Width=1180;window.Height=820;await Task.Delay(80);window.UpdateLayout();
|
||||
var screenshots=Path.GetFullPath(Path.Combine("..","scratch","screenshots"));Directory.CreateDirectory(screenshots);
|
||||
using(var rendered=new RenderTargetBitmap(new PixelSize((int)window.Bounds.Width,(int)window.Bounds.Height)))
|
||||
{rendered.Render(window);rendered.Save(Path.Combine(screenshots,"step-result-counts.png"));}
|
||||
engine.Stop();model.IsRunning=false;
|
||||
}
|
||||
|
||||
private static async Task CheckRuntimeStatistics(App app,SopPageViewModel sop,Window window)
|
||||
{
|
||||
var engine=app.Container.Resolve<SopHelper.Engine.Sop.SopEngine>();
|
||||
@ -694,7 +757,7 @@ internal static class Smoke
|
||||
Check(sop.StepCards.All(c=>System.Text.RegularExpressions.Regex.IsMatch(c.ElapsedText,@"^\d{2,}:\d{2}:\d{2}$")),"Completed step cards display elapsed times to whole seconds");
|
||||
var panel=window.GetVisualDescendants().OfType<Grid>().Single(c=>c.Name=="RunStatisticsPanel");
|
||||
var texts=panel.GetVisualDescendants().OfType<TextBlock>().Select(t=>t.Text).ToArray();
|
||||
Check(texts.Contains("完成次数")&&texts.Contains("流程计时")&&texts.Contains("步骤计时")&&texts.Contains("标准用时")&&texts.Contains("平均用时")&&texts.Contains("11"),"Operator page renders all five statistics and their bound values");
|
||||
Check(texts.Contains("流程计时")&&texts.Contains("步骤计时")&&texts.Contains("标准用时")&&!texts.Contains("完成次数")&&!texts.Contains("平均用时"),"Operator page renders timing fields without the removed summary counts");
|
||||
Save(window,"runtime-statistics");
|
||||
engine.Reset();await Task.Delay(120);
|
||||
Check(sop.CompletedCount==11&&sop.StepCards.All(c=>c.ElapsedText=="00:00:00"||c.StepId==1),"Reset begins new step timing while preserving completed count and history");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user