fix(ui): restore retail vitals and window interactions
All checks were successful
CI / linux-portable (push) Successful in 3m16s
CI / windows-gate (push) Successful in 5m41s
CI / release (push) Successful in 2m5s

This commit is contained in:
Erik 2026-08-20 13:26:35 +02:00
parent 4d84456c21
commit 1bd2b30291
36 changed files with 1462 additions and 86 deletions

View file

@ -941,6 +941,85 @@ public sealed class RuntimeSettingsControllerTests
Assert.Equal(["target-quality"], events);
}
[Fact]
public void RequestUiLocked_PublishesAuthoritativeOptionBeforePresentation()
{
var events = new List<string>();
bool authoritativeLock = false;
var controller = new RuntimeSettingsController(
new FakeStorage(),
log: events.Add,
characterOptionValue: optionId =>
optionId == (uint)CharacterOptionId.LockUI && authoritativeLock);
var targets = new FakeRuntimeTargets(events);
targets.SingleOptionApplied = (optionId, value) =>
{
if (optionId == (uint)CharacterOptionId.LockUI)
authoritativeLock = value;
};
controller.BindRuntimeTargets(targets);
controller.RequestUiLocked(true);
Assert.Equal(
[
$"target-single-option:0x{(uint)CharacterOptionId.LockUI:X}:True",
"target-ui-lock:True",
], events);
Assert.Equal(
[((uint)CharacterOptionId.LockUI, true)],
targets.SingleOptionCalls);
Assert.Equal(1, targets.UiLockCalls);
events.Clear();
controller.RequestUiLocked(false);
Assert.Equal(
[
$"target-single-option:0x{(uint)CharacterOptionId.LockUI:X}:False",
"target-ui-lock:False",
], events);
Assert.Equal(
[
((uint)CharacterOptionId.LockUI, true),
((uint)CharacterOptionId.LockUI, false),
], targets.SingleOptionCalls);
Assert.Equal(2, targets.UiLockCalls);
}
[Fact]
public void RequestUiLocked_InactiveRouteDoesNotSplitPresentation_AndServerSeedDoesNotEcho()
{
var events = new List<string>();
bool authoritativeLock = false;
var controller = new RuntimeSettingsController(
new FakeStorage(),
log: events.Add,
characterOptionValue: optionId =>
optionId == (uint)CharacterOptionId.LockUI && authoritativeLock);
var targets = new FakeRuntimeTargets(events);
controller.BindRuntimeTargets(targets);
// The fake records the publish but deliberately does not mutate the
// canonical option, modeling an inactive/displaced live router.
controller.RequestUiLocked(true);
Assert.Equal(
[$"target-single-option:0x{(uint)CharacterOptionId.LockUI:X}:True"],
events);
Assert.Equal(0, targets.UiLockCalls);
// A later PlayerDescription has already replaced Runtime authority;
// its convergence call is presentation-only and must not echo 0x0005.
authoritativeLock = true;
events.Clear();
controller.SetUiLocked(true);
Assert.Equal(["target-ui-lock:True"], events);
Assert.Single(targets.SingleOptionCalls);
Assert.Equal(1, targets.UiLockCalls);
}
[Fact]
public void SetUiLocked_AppliesOnFirstCallThenNoOpsOnRepeatedSameValue()
{
@ -1121,10 +1200,13 @@ public sealed class RuntimeSettingsControllerTests
public List<(uint OptionId, bool Value)> SingleOptionCalls { get; } = [];
public Action<uint, bool>? SingleOptionApplied { get; set; }
public void SetSingleCharacterOption(uint optionId, bool value)
{
SingleOptionCalls.Add((optionId, value));
events.Add($"target-single-option:0x{optionId:X}:{value}");
SingleOptionApplied?.Invoke(optionId, value);
}
public List<(float DefaultOpacity, float ActiveOpacity)> ChatOpacityCalls { get; } = [];