| 1 | using CascadeIDE.Models; |
| 2 | using CascadeIDE.Services.Presentation; |
| 3 | using Xunit; |
| 4 | |
| 5 | namespace CascadeIDE.Tests; |
| 6 | |
| 7 | public sealed class PresentationTierResolverTests |
| 8 | { |
| 9 | private static PresentationGrammarTokens Grammar() => |
| 10 | PresentationGrammarTokens.FromSettings("()", " ", "+", "P", "F", "M"); |
| 11 | |
| 12 | private static DisplayPresentationSettings DefaultSettings() => new(); |
| 13 | |
| 14 | [Fact] |
| 15 | public void Auto_two_monitors_returns_compact() |
| 16 | { |
| 17 | var parse = PresentationParser.Parse("(P+F) (M)", Grammar()); |
| 18 | var monitors = new PresentationMonitorSnapshot(2, 1920, 1080, 3840); |
| 19 | Assert.Equal(PresentationTierKind.Compact, PresentationTierResolver.Resolve(DefaultSettings(), parse, monitors)); |
| 20 | } |
| 21 | |
| 22 | [Fact] |
| 23 | public void Auto_triple_topology_three_monitors_returns_cockpit() |
| 24 | { |
| 25 | var parse = PresentationParser.Parse("(P) (F) (M)", Grammar()); |
| 26 | var monitors = new PresentationMonitorSnapshot(3, 1920, 1080, 5760); |
| 27 | Assert.Equal(PresentationTierKind.Cockpit, PresentationTierResolver.Resolve(DefaultSettings(), parse, monitors)); |
| 28 | } |
| 29 | |
| 30 | [Fact] |
| 31 | public void Auto_ultrawide_single_screen_can_be_cockpit() |
| 32 | { |
| 33 | var settings = new DisplayPresentationSettings { UltrawideCockpitEnabled = true }; |
| 34 | var parse = PresentationParser.Parse("(F)", Grammar()); |
| 35 | var monitors = new PresentationMonitorSnapshot(1, 5120, 1440, 5120); |
| 36 | Assert.Equal(PresentationTierKind.Cockpit, PresentationTierResolver.Resolve(settings, parse, monitors)); |
| 37 | } |
| 38 | |
| 39 | [Fact] |
| 40 | public void Explicit_compact_overrides_three_monitors() |
| 41 | { |
| 42 | var settings = new DisplayPresentationSettings { Tier = "compact" }; |
| 43 | var parse = PresentationParser.Parse("(P) (F) (M)", Grammar()); |
| 44 | var monitors = new PresentationMonitorSnapshot(3, 1920, 1080, 5760); |
| 45 | Assert.Equal(PresentationTierKind.Compact, PresentationTierResolver.Resolve(settings, parse, monitors)); |
| 46 | } |
| 47 | } |
| 48 | |