acdream/tests/AcDream.App.Tests/RuntimeOptionsRetailUiTests.cs
Erik ab3ab79380 feat(D.2b): run importer-built vitals window under ACDREAM_RETAIL_UI_IMPORTER (A/B)
Adds RuntimeOptions.RetailUiImporter (ACDREAM_RETAIL_UI_IMPORTER=1) — a new
opt-in flag that runs the LayoutImporter-built vitals window ALONGSIDE the
hand-authored vitals panel for pixel-for-pixel A/B comparison. The importer
window is placed at x=200, y=30 so both render simultaneously within the same
ACDREAM_RETAIL_UI=1 session. The hand-authored path is entirely untouched and
remains the default; the importer path is the eventual switch-over target.

Also adds two RuntimeOptionsRetailUiTests covering the new flag: value "1" →
true, unset/other → false.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 14:18:16 +02:00

53 lines
1.6 KiB
C#

using System.Collections.Generic;
using AcDream.App;
namespace AcDream.App.Tests;
public class RuntimeOptionsRetailUiTests
{
[Fact]
public void Parse_ReadsRetailUiAndAcDir()
{
var env = new Dictionary<string, string?>
{
["ACDREAM_RETAIL_UI"] = "1",
["ACDREAM_AC_DIR"] = @"C:\Turbine\Asheron's Call",
};
var opts = RuntimeOptions.Parse("dats", k => env.GetValueOrDefault(k));
Assert.True(opts.RetailUi);
Assert.Equal(@"C:\Turbine\Asheron's Call", opts.AcDir);
}
[Fact]
public void Parse_DefaultsRetailUiOffAndAcDirNull()
{
var opts = RuntimeOptions.Parse("dats", _ => null);
Assert.False(opts.RetailUi);
Assert.Null(opts.AcDir);
}
[Fact]
public void Parse_ReadsRetailUiImporter_WhenSetToOne()
{
var env = new Dictionary<string, string?>
{
["ACDREAM_RETAIL_UI_IMPORTER"] = "1",
};
var opts = RuntimeOptions.Parse("dats", k => env.GetValueOrDefault(k));
Assert.True(opts.RetailUiImporter);
}
[Fact]
public void Parse_DefaultsRetailUiImporterOff_WhenUnsetOrOtherValue()
{
// Unset → false.
Assert.False(RuntimeOptions.Parse("dats", _ => null).RetailUiImporter);
// Non-"1" values → false (mirrors RetailUi / other IsExactlyOne flags).
var envOther = new Dictionary<string, string?>
{
["ACDREAM_RETAIL_UI_IMPORTER"] = "true",
};
Assert.False(RuntimeOptions.Parse("dats", k => envOther.GetValueOrDefault(k)).RetailUiImporter);
}
}