Forge
csharpdeeb25a2
1using CascadeIDE.Cockpit.Composition.HostSurface;
2using CascadeIDE.Models;
3using CascadeIDE.Services.Presentation;
4using Xunit;
5
6using CascadeIDE.Features.Agent.Environment;
7
8namespace CascadeIDE.Tests;
9
10public sealed class MainWindowHostSurfaceProjectionTests
11{
12 private static PresentationGrammarTokens DefaultGrammar() =>
13 PresentationGrammarTokens.FromSettings("()", " ", "+", "P", "F", "M");
14
15 private sealed class FakeHostSurfaceInput : IMainWindowHostSurfaceInput
16 {
17 public required PresentationParseResult PresentationParse { get; init; }
18 public required bool IsPfdRegionExpanded { get; init; }
19 public required bool IsMfdRegionExpanded { get; init; }
20 public required bool IsPfdHostWindowShellOpen { get; init; }
21 public required bool IsMfdHostWindowShellOpen { get; init; }
22 public required DisplaySettings DisplaySettings { get; init; }
23 public required string SafetyLevel { get; init; }
24 public PresentationTierKind EffectivePresentationTier { get; init; } = PresentationTierKind.Cockpit;
25 }
26
27 [Fact]
28 public void BuildShellInput_maps_host_members_to_shell_composition_record()
29 {
30 var parse = PresentationParser.Parse("(P+F+M)", DefaultGrammar());
31 Assert.True(parse.IsSuccess);
32 var display = new DisplaySettings();
33 IMainWindowHostSurfaceInput host = new FakeHostSurfaceInput
34 {
35 PresentationParse = parse,
36 IsPfdRegionExpanded = true,
37 IsMfdRegionExpanded = false,
38 IsPfdHostWindowShellOpen = true,
39 IsMfdHostWindowShellOpen = false,
40 DisplaySettings = display,
41 SafetyLevel = AgentSafetyLevel.Observe,
42 };
43
44 var input = MainWindowHostSurfaceProjection.BuildShellInput(host, expandedMfdWidthPixels: 400, collapsedMfdWidthPixels: 8);
45
46 Assert.Equal(parse, input.PresentationParse);
47 Assert.True(input.IntentSolutionExplorerVisible);
48 Assert.False(input.IntentChatPanelExpanded);
49 Assert.True(input.SuppressPfdColumnForPfdHostWindow);
50 Assert.False(input.SuppressMfdColumnForMfdHostWindow);
51 Assert.Equal(400, input.ExpandedMfdWidthPixels);
52 Assert.Equal(8, input.CollapsedMfdWidthPixels);
53 Assert.Same(display, input.DisplaySettings);
54 Assert.Equal(AgentSafetyLevel.Observe, input.SafetyLevel);
55 Assert.Equal(PresentationTierKind.Cockpit, input.EffectivePresentationTier);
56 }
57}
58
View only · write via MCP/CIDE