using Avalonia; using StarterNG.Infrastructure; namespace StarterNG.Tests; public class SoftwareRenderTests { [Theory] [InlineData("--software-render")] [InlineData("--Software-Render")] public void The_switch_asks_for_it_in_any_case(string arg) { Assert.True(SoftwareRender.AskedIn(new[] { "--other", arg })); } [Fact] public void Without_the_switch_it_is_not_asked_for() { Assert.False(SoftwareRender.AskedIn(Array.Empty())); Assert.False(SoftwareRender.AskedIn(new[] { "--software" })); } [Fact] public void Windows_draws_on_the_processor_into_a_plain_window_surface() { var options = SoftwareRender.Win32Options; // No WinUI composition, DirectComposition or swap chain of the graphics card's. Assert.Equal(new[] { Win32RenderingMode.Software }, options.RenderingMode); Assert.Equal(new[] { Win32CompositionMode.RedirectionSurface }, options.CompositionMode); } [Fact] public void X11_draws_on_the_processor_when_asked() { Assert.Equal(new[] { X11RenderingMode.Software }, SoftwareRender.X11Options.RenderingMode); } [Theory] [InlineData(false)] [InlineData(true)] public void The_options_go_to_the_same_builder_with_or_without_the_switch(bool asked) { var builder = AppBuilder.Configure(); string[] args = asked ? new[] { SoftwareRender.Switch } : Array.Empty(); Assert.Same(builder, SoftwareRender.ApplyTo(builder, args)); } }