零件标注录像增加暂停和继续功能
This commit is contained in:
parent
56fb5932a8
commit
f89c28575a
@ -47,7 +47,8 @@
|
||||
</Grid>
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Left" Content="{Binding RecordButtonText}" Command="{Binding RecordCommand}" BorderBrush="{StaticResource Accent}" MinWidth="130" />
|
||||
<TextBlock Text="AVI / MJPEG · 30 fps · 最长5分钟,到时自动停止并提示" Foreground="{StaticResource Dim}" Margin="12,0,0,6" />
|
||||
<Button DockPanel.Dock="Left" Content="{Binding PauseButtonText}" Command="{Binding PauseCommand}" MinWidth="110" Margin="8,0,0,0" />
|
||||
<TextBlock Text="AVI / MJPEG · 30 fps · 最长5分钟,到时自动停止并提示" Foreground="{StaticResource Dim}" Margin="12,0,0,6" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
<TextBlock Text="{Binding LastRecording}" TextTrimming="CharacterEllipsis" Foreground="{StaticResource Dim}" Margin="0,0,0,8" ToolTip.Tip="{Binding LastRecording}" />
|
||||
</StackPanel>
|
||||
|
||||
@ -36,7 +36,9 @@ internal static class Program
|
||||
using var camera = new FakeCamera();
|
||||
CameraInfo? selected = null;
|
||||
var model = new CameraViewModel(camera, root, timeProvider: clock, selectedCameraProvider: () => selected);
|
||||
var window = new CameraWindow(model); window.Show();
|
||||
var window = new CameraWindow(model); window.Show(); Dispatcher.UIThread.RunJobs(); window.UpdateLayout();
|
||||
var pauseButton = window.GetVisualDescendants().OfType<Button>().Single(b => ReferenceEquals(b.Command, model.PauseCommand));
|
||||
Check(!pauseButton.IsEffectivelyEnabled && pauseButton.Content?.ToString() == "暂停录制", "Part recording exposes a pause button disabled before recording");
|
||||
Check(!model.PreviewCommand.CanExecute() && model.SelectedCameraName.Contains("运行设置"), "Recording requires the camera selected in runtime settings");
|
||||
Check(!window.GetVisualDescendants().OfType<ComboBox>().Any() && !window.GetVisualDescendants().OfType<Button>().Any(b => b.Content?.ToString() == "刷新相机"), "Recording window has no camera selector or refresh button");
|
||||
selected = new CameraInfo { Kind = CameraKind.Hikvision, Index = 7, SerialNumber = "GLOBAL-CAMERA", Name = "运行设置中的相机" };
|
||||
@ -65,9 +67,19 @@ internal static class Program
|
||||
Check(model.IsRecording, "A second recording starts with a fresh timeout");
|
||||
clock.Advance(TimeSpan.FromSeconds(1)); camera.Emit(); Tick(model);
|
||||
Check(model.IsRecording && notices == 1, "Previous recording duration does not carry over");
|
||||
Check(pauseButton.IsEffectivelyEnabled, "Part recording enables the pause button while recording");
|
||||
pauseButton.Command!.Execute(pauseButton.CommandParameter); Dispatcher.UIThread.RunJobs();
|
||||
clock.Advance(TimeSpan.FromMinutes(6)); camera.Emit(); Tick(model);
|
||||
Check(model.IsRecording && model.IsPaused && model.IsPreviewing && notices == 1 && model.RecordingInfo.Contains("00:00:01"), "Part recording excludes paused time from duration and timeout while keeping preview active");
|
||||
Check(pauseButton.Content?.ToString() == "继续录制", "Part recording button offers resume when paused");
|
||||
pauseButton.Command.Execute(pauseButton.CommandParameter); Dispatcher.UIThread.RunJobs();
|
||||
Check(!model.IsPaused && pauseButton.Content?.ToString() == "暂停录制", "Part recording resumes through the same button");
|
||||
clock.Advance(TimeSpan.FromSeconds(1)); camera.Emit(); Tick(model);
|
||||
pauseButton.Command.Execute(pauseButton.CommandParameter);
|
||||
model.RecordCommand.Execute();
|
||||
Check(!model.IsRecording && notices == 1, "Manual stop saves without a timeout popup");
|
||||
CheckVideo(model.LastRecording, 1);
|
||||
Check(!model.IsPaused && !pauseButton.IsEffectivelyEnabled && pauseButton.Content?.ToString() == "暂停录制", "Stopping a paused part recording resets the pause button");
|
||||
CheckVideo(model.LastRecording, 2);
|
||||
clock.Advance(TimeSpan.FromMinutes(6)); Tick(model);
|
||||
Check(notices == 1, "Stopped recordings do not later trigger a timeout");
|
||||
camera.Emit(); model.RecordCommand.Execute();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user