修复测试用例错误

This commit is contained in:
zhengxuan.zhang
2026-05-18 15:32:00 +08:00
parent e5cfbf9dd5
commit dcc15f62d1
10 changed files with 88 additions and 174 deletions
@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using Xunit;
using XP.Common.Logging.Interfaces;
using XplorePlane.Models;
@@ -34,7 +33,6 @@ namespace XplorePlane.Tests.Services
private readonly string _tempConfigDir;
private readonly string _tempConfigPath;
private readonly DebugPanelConfigService _realConfigService;
private readonly Dispatcher _dispatcher;
public DebugPanelIntegrationTests()
{
@@ -65,8 +63,6 @@ namespace XplorePlane.Tests.Services
var configPathField = typeof(DebugPanelConfigService)
.GetField("_configPath", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
configPathField?.SetValue(_realConfigService, _tempConfigPath);
_dispatcher = Dispatcher.CurrentDispatcher;
}
public void Dispose()
@@ -501,21 +497,5 @@ namespace XplorePlane.Tests.Services
_mockAppStateService.Object,
_mockLoggerService.Object,
_realConfigService);
/// <summary>
/// 处理 Dispatcher 队列中的所有待处理消息
/// Process all pending messages in the Dispatcher queue
/// </summary>
private void DoEvents()
{
var frame = new DispatcherFrame();
_dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(
delegate (object f)
{
((DispatcherFrame)f).Continue = false;
return null;
}), frame);
Dispatcher.PushFrame(frame);
}
}
}
@@ -72,7 +72,7 @@ namespace XplorePlane.Tests.Services
// Feature: live-image-display, Property 6: 采集队列有界不变量
// Validates: Requirements 2.2
[Property(MaxTest = 100)]
[Property(MaxTest = 20)]
public Property AcquireQueueCount_NeverExceedsCapacity()
{
var gen =
@@ -103,7 +103,7 @@ namespace XplorePlane.Tests.Services
// Feature: live-image-display, Property 7: 处理队列有界不变量
// Validates: Requirements 2.4
[Property(MaxTest = 100)]
[Property(MaxTest = 20)]
public Property ProcessQueueCount_NeverExceedsCapacity()
{
var gen =
@@ -140,7 +140,7 @@ namespace XplorePlane.Tests.Services
//
// We use a large process queue capacity to avoid overflow dropping frames,
// and count frames via ProcessFrameDequeued events.
[Property(MaxTest = 100)]
[Property(MaxTest = 20)]
public Property ProcessQueueEntries_EqualsCeilMDivN()
{
var gen =
@@ -225,7 +225,7 @@ namespace XplorePlane.Tests.Services
{
pipelineCalls.Add(source);
})
.ReturnsAsync(detectorImage);
.ReturnsAsync(new PipelineExecutionResult(detectorImage, null));
service.ExecuteAsync(program, null, CancellationToken.None)
.GetAwaiter().GetResult();
@@ -299,7 +299,7 @@ namespace XplorePlane.Tests.Services
It.IsAny<CancellationToken>()))
.Callback<IEnumerable<PipelineNodeViewModel>, BitmapSource, IProgress<PipelineProgress>, CancellationToken>(
(_, _, _, _) => Interlocked.Increment(ref pipelineCallCount))
.ReturnsAsync(detectorImage);
.ReturnsAsync(new PipelineExecutionResult(detectorImage, null));
service.ExecuteAsync(program, null, CancellationToken.None)
.GetAwaiter().GetResult();