fix(ui,runtime): OP4 review fixes — live re-seed, enable-gating, Combat panel re-point, universal timestamps
Both OP4 reviews converged on one headline bug (Character-tab rows never re-read live server truth after their pre-login constructor-word seed) plus overlapping MUST-FIXes. All ten converged/consolidated findings land here: MUST-FIX: - BoolOptionRow.SaveCurrentValue now re-reads its live binding (retail's GetValue()-into-SaveCurrentValue) on every OnShown — panel open, tab switch in, initial activation — instead of trusting the pre-login constructor word it was built with. Reset/tab-switch can now only restore values that were actually live at the last show. LockUI's host.Root.UiLocked one-shot mount seed now also converges on every PlayerDescription via the existing OnCharacterOptionsChanged hook. - Apply/Reset are wired to OptionPage.OnOptionChanged in production (Ghosted when nothing changed, Normal when dirty, run once at bind so both start disabled per retail's PostInit); Defaults stays ungated. - The Combat panel's three LEDs (Repeat Attacks/Auto Target/Keep in View) now read/write the same RuntimeCharacterOptionsState seam the Character tab uses instead of a disconnected client-local GameplaySettings copy — closes the "two writable copies" divergence. The three now-orphaned GameplaySettings fields and RuntimeSettingsController's mirror properties/SetCombatGameplay are deleted outright; the headless host's hardcoded AutoRepeatAttack/AutoTarget now read the live option bit. - RuntimeSettingsController.SetUiLocked's convergence guard now compares against the last value actually applied to the runtime target instead of the persisted GameplaySettings.LockUI snapshot, which could already match a server-derived request without ever having been pushed. SHOULD-FIX: - DisplayTimeStamps now prefixes every chat producer (ChatLog.Append is the one seam all of them funnel through), not just AddText's own callers — heard speech, emotes, Turbine channels, and combat text were previously missed. The prefix format escapes its colons and forces InvariantCulture instead of the culture-dependent TimeSeparator placeholder. - sky.frag now honors uFogParams.w (fog mode) like the mesh/terrain shaders, so Disable Distance Fog stops the sky dome's horizon band from blending toward fog color too. - Corrected the "byte-verified" overclaim on the timestamp format string doc comment (BN-sourced, wire doc U6) and the AP-194 anchor-column class-name typo; the RunAsDefaultMovement doc comments now cite retail's actual acclient.h enumerator name. - Added: DispatcherMovementInputSource's option x modifier truth table (incl. || AutoRunActive with the option off), the per-page Apply/Reset enable-gate tests, a real checkbox.OnClick/ToggleBehavior-driven click test, and hash-pins for the six header string keys. - Gate script step 8 corrected for the logout-flush false-failure (closing the panel before relogging is load-bearing); a new step documents the enable-gate sequence and the Combat-panel/Character-tab cross-check. Register: AP-196 (the Group-C default-source change + GameplaySettings retirement) and AP-197 (the ignored per-character timestamp format override) filed in this commit. Full Release suite: 13,044 passed / 4 skipped / 0 failed (was 13,008/4/0; net +36 tests from new coverage and legitimate assertion updates from the GameplaySettings retirement). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
85afaae5fd
commit
bc43fb1d1d
36 changed files with 923 additions and 220 deletions
|
|
@ -5,12 +5,12 @@ using AcDream.Runtime.Gameplay;
|
|||
namespace AcDream.App.Tests.Combat;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign OP slice OP4 (2026-08-11) — D7 Group-C re-point:
|
||||
/// <see cref="CharacterOptionCombatSettingsSource"/> reads
|
||||
/// AutoTarget/AutoRepeatAttack/ViewCombatTarget from the canonical
|
||||
/// <see cref="RuntimeCharacterOptionsState"/> instead of the client-local
|
||||
/// <c>GameplaySettings</c> record <see cref="GameplaySettingsState"/> used
|
||||
/// to be the only implementation of.
|
||||
/// Campaign OP slice OP4 (2026-08-11) — D7 Group-C re-point, widened at the
|
||||
/// OP4 review-fix round (2026-08-11, MUST-FIX 3): <see cref="CharacterOptionCombatSettingsSource"/>
|
||||
/// reads AutoTarget/AutoRepeatAttack/ViewCombatTarget from the canonical
|
||||
/// <see cref="RuntimeCharacterOptionsState"/> — the ONLY implementation of
|
||||
/// <c>ICombatGameplaySettingsSource</c> now, since the dead client-local
|
||||
/// <c>GameplaySettingsState</c> adapter was retired the same round.
|
||||
/// </summary>
|
||||
public sealed class CharacterOptionCombatSettingsSourceTests
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,19 @@ using System.Numerics;
|
|||
using AcDream.App.Combat;
|
||||
using AcDream.App.Interaction;
|
||||
using AcDream.Core.Combat;
|
||||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
|
||||
namespace AcDream.App.Tests.Combat;
|
||||
|
||||
/// <summary>
|
||||
/// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2): the dead
|
||||
/// <c>GameplaySettingsState</c> adapter over the client-local
|
||||
/// <c>GameplaySettings</c> record is retired — <see cref="ICombatGameplaySettingsSource"/>
|
||||
/// has exactly one implementation now, <see cref="CharacterOptionCombatSettingsSource"/>,
|
||||
/// reading the canonical server-authoritative <see cref="RuntimeCharacterOptionsState"/>.
|
||||
/// </summary>
|
||||
public sealed class CombatCameraTargetSourceTests
|
||||
{
|
||||
[Fact]
|
||||
|
|
@ -13,7 +22,9 @@ public sealed class CombatCameraTargetSourceTests
|
|||
{
|
||||
const uint target = 0x70000001u;
|
||||
Vector3 point = new(10f, 20f, 30f);
|
||||
var settings = new GameplaySettingsState();
|
||||
var options = new RuntimeCharacterOptionsState();
|
||||
options.SetOptionBit((uint)CharacterOptionId.ViewCombatTarget, false);
|
||||
var settings = new CharacterOptionCombatSettingsSource(options);
|
||||
var combat = new CombatState();
|
||||
var selection = new SelectionState();
|
||||
var world = new TargetQuery(point);
|
||||
|
|
@ -25,7 +36,7 @@ public sealed class CombatCameraTargetSourceTests
|
|||
|
||||
Assert.Null(source.GetTrackedTargetPoint());
|
||||
|
||||
settings.Value = settings.Value with { ViewCombatTarget = true };
|
||||
options.SetOptionBit((uint)CharacterOptionId.ViewCombatTarget, true);
|
||||
combat.SetCombatMode(CombatMode.Melee);
|
||||
selection.Select(target, SelectionChangeSource.World);
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,58 @@ public sealed class DispatcherMovementInputSourceTests
|
|||
Assert.False(source.AutoRunActive);
|
||||
}
|
||||
|
||||
// ── S6 (OP4 review-fix round blast, 2026-08-11): the option × modifier
|
||||
// truth table for Run — previously pinned only at option-unbound
|
||||
// (⇒ true) + walk-held. ──────────────────────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData(true, false, true)] // run-by-default, no walk modifier -> runs
|
||||
[InlineData(true, true, false)] // run-by-default, walk modifier held -> walks
|
||||
[InlineData(false, false, false)] // walk-by-default, no modifier -> walks
|
||||
[InlineData(false, true, true)] // walk-by-default, modifier held -> runs
|
||||
public void Capture_RunReflectsOptionXorWalkModifier(
|
||||
bool runAsDefault, bool walkModifierHeld, bool expectedRun)
|
||||
{
|
||||
var (dispatcher, _, _) = CreateDispatcher();
|
||||
var movement = new RuntimeLocalPlayerMovementState
|
||||
{
|
||||
RunAsDefaultMovementSource = () => runAsDefault,
|
||||
};
|
||||
var source = new DispatcherMovementInputSource(movement);
|
||||
source.Bind(dispatcher);
|
||||
dispatcher.TrySetAutomationActionHeld(InputAction.MovementForward, held: true);
|
||||
if (walkModifierHeld)
|
||||
dispatcher.TrySetAutomationActionHeld(InputAction.MovementWalkMode, held: true);
|
||||
|
||||
MovementInput captured = source.Capture();
|
||||
|
||||
Assert.Equal(expectedRun, captured.Run);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Capture_AutoRunActive_ForcesRun_EvenWhenOptionIsOff()
|
||||
{
|
||||
// The `|| AutoRunActive` clause predates OP4 but was unobservable
|
||||
// while the default was hardcoded true. Pinned as a
|
||||
// CURRENT-BEHAVIOR test (not a retail-correctness claim — see
|
||||
// mechanism review N6, which flags this as a possibly-divergent
|
||||
// "|| AutoRunActive" that retail's SetAutoRun does not force) so a
|
||||
// future change to this clause is deliberate, not accidental.
|
||||
var (dispatcher, _, _) = CreateDispatcher();
|
||||
var movement = new RuntimeLocalPlayerMovementState
|
||||
{
|
||||
RunAsDefaultMovementSource = () => false,
|
||||
};
|
||||
var source = new DispatcherMovementInputSource(movement);
|
||||
source.Bind(dispatcher);
|
||||
source.HandlePressedAction(InputAction.MovementRunLock); // arm autorun
|
||||
Assert.True(source.AutoRunActive);
|
||||
|
||||
MovementInput captured = source.Capture();
|
||||
|
||||
Assert.True(captured.Run);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BindingIsIdempotentOnlyForTheSameDispatcher()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ public sealed class RuntimeSettingsControllerTests
|
|||
VSync = false,
|
||||
Quality = QualityPreset.Ultra,
|
||||
},
|
||||
GameplayValue = GameplaySettings.Default with
|
||||
{
|
||||
AutoTarget = true,
|
||||
AutoRepeatAttack = true,
|
||||
ViewCombatTarget = true,
|
||||
},
|
||||
};
|
||||
var resolved = new QualitySettings(7, 18, 8, 16, true, 9);
|
||||
int resolveCount = 0;
|
||||
|
|
@ -57,9 +51,6 @@ public sealed class RuntimeSettingsControllerTests
|
|||
Assert.Same(storage.DefaultCharacterValue, controller.Startup.Character);
|
||||
Assert.Equal(resolved, controller.Startup.Quality);
|
||||
Assert.Equal(resolved, controller.ResolvedQuality);
|
||||
Assert.True(controller.AutoTarget);
|
||||
Assert.True(controller.AutoRepeatAttack);
|
||||
Assert.True(controller.ViewCombatTarget);
|
||||
Assert.Equal("default", controller.ActiveToonKey);
|
||||
}
|
||||
|
||||
|
|
@ -549,7 +540,7 @@ public sealed class RuntimeSettingsControllerTests
|
|||
ParticleRange = ParticleRange.Retail,
|
||||
});
|
||||
viewModel.SetAudio(viewModel.AudioDraft with { Sfx = 0.33f });
|
||||
viewModel.SetGameplay(viewModel.GameplayDraft with { AutoTarget = true });
|
||||
viewModel.SetGameplay(viewModel.GameplayDraft with { ShowTooltips = false });
|
||||
|
||||
Assert.True(controller.HasDraftPreview);
|
||||
Assert.Equal(91f, controller.DisplayPreview.FieldOfView);
|
||||
|
|
@ -565,7 +556,7 @@ public sealed class RuntimeSettingsControllerTests
|
|||
Assert.Equal(91f, controller.DisplayPreview.FieldOfView);
|
||||
Assert.True(controller.Gameplay.LockUI);
|
||||
Assert.True(controller.Gameplay.AcceptLootPermits);
|
||||
Assert.True(viewModel.GameplayDraft.AutoTarget);
|
||||
Assert.False(viewModel.GameplayDraft.ShowTooltips);
|
||||
Assert.True(viewModel.GameplayDraft.LockUI);
|
||||
Assert.True(viewModel.GameplayDraft.AcceptLootPermits);
|
||||
Assert.Contains("target-ui-lock:True", events);
|
||||
|
|
@ -590,12 +581,9 @@ public sealed class RuntimeSettingsControllerTests
|
|||
CoordinatesOnRadar = false,
|
||||
});
|
||||
|
||||
controller.SetCombatGameplay(controller.Gameplay with { AutoTarget = false });
|
||||
controller.SetUiLocked(true);
|
||||
controller.SetAcceptLootPermits(true);
|
||||
|
||||
Assert.False(controller.Gameplay.AutoTarget);
|
||||
Assert.False(viewModel.GameplayDraft.AutoTarget);
|
||||
Assert.False(viewModel.GameplayDraft.ShowTooltips);
|
||||
Assert.False(viewModel.GameplayDraft.CoordinatesOnRadar);
|
||||
Assert.True(viewModel.GameplayDraft.LockUI);
|
||||
|
|
@ -609,14 +597,12 @@ public sealed class RuntimeSettingsControllerTests
|
|||
Assert.Equal(
|
||||
controller.Gameplay.CoordinatesOnRadar,
|
||||
viewModel.GameplayDraft.CoordinatesOnRadar);
|
||||
Assert.False(viewModel.GameplayDraft.AutoTarget);
|
||||
Assert.True(viewModel.GameplayDraft.LockUI);
|
||||
Assert.True(viewModel.GameplayDraft.AcceptLootPermits);
|
||||
|
||||
viewModel.SetGameplay(viewModel.GameplayDraft with { ShowHelm = false });
|
||||
viewModel.Save();
|
||||
|
||||
Assert.False(storage.GameplayValue.AutoTarget);
|
||||
Assert.True(storage.GameplayValue.LockUI);
|
||||
Assert.True(storage.GameplayValue.AcceptLootPermits);
|
||||
Assert.False(storage.GameplayValue.ShowHelm);
|
||||
|
|
@ -638,26 +624,19 @@ public sealed class RuntimeSettingsControllerTests
|
|||
static _ => { });
|
||||
|
||||
controller.SetUiLocked(true);
|
||||
controller.SetCombatGameplay(controller.Gameplay with { AutoTarget = false });
|
||||
Assert.Throws<IOException>(() => controller.SetAcceptLootPermits(true));
|
||||
|
||||
Assert.True(viewModel.GameplayDraft.LockUI);
|
||||
Assert.False(viewModel.GameplayDraft.AutoTarget);
|
||||
Assert.True(viewModel.GameplayDraft.AcceptLootPermits);
|
||||
|
||||
viewModel.Cancel();
|
||||
|
||||
Assert.Equal(GameplaySettings.Default.LockUI, viewModel.GameplayDraft.LockUI);
|
||||
Assert.Equal(
|
||||
GameplaySettings.Default.AutoTarget,
|
||||
viewModel.GameplayDraft.AutoTarget);
|
||||
Assert.Equal(
|
||||
GameplaySettings.Default.AcceptLootPermits,
|
||||
viewModel.GameplayDraft.AcceptLootPermits);
|
||||
Assert.Contains(logs, line =>
|
||||
line.Contains("radar lock save failed", StringComparison.Ordinal));
|
||||
Assert.Contains(logs, line =>
|
||||
line.Contains("combat option save failed", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -928,6 +907,42 @@ public sealed class RuntimeSettingsControllerTests
|
|||
Assert.Equal(["target-quality"], events);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetUiLocked_AppliesEvenWhenGameplayLockUIAlreadyMatches_IfNeverActuallyApplied()
|
||||
{
|
||||
// MUST-FIX 4 (OP4 review-fix round, 2026-08-11, blast M3): the
|
||||
// guard used to compare the requested value against
|
||||
// `Gameplay.LockUI` — valid only while `ToggleUiLock` derived
|
||||
// `locked` AS `!Gameplay.LockUI`. OP4 re-pointed `ToggleUiLock` to
|
||||
// read the SERVER bit (RuntimeCharacterOptionsState) instead, a
|
||||
// DIFFERENT store that can already equal a value this controller
|
||||
// never actually pushed to `_runtimeTargets`. A pre-existing save
|
||||
// seeds Gameplay.LockUI = true; the runtime target has never seen
|
||||
// `true` — the FIRST SetUiLocked(true) call must still apply.
|
||||
var events = new List<string>();
|
||||
var storage = new FakeStorage(events)
|
||||
{
|
||||
GameplayValue = GameplaySettings.Default with { LockUI = true },
|
||||
};
|
||||
var controller = new RuntimeSettingsController(
|
||||
storage,
|
||||
static preset => QualitySettings.From(preset),
|
||||
static _ => { });
|
||||
Assert.True(controller.Gameplay.LockUI); // already true, but never applied
|
||||
var targets = new FakeRuntimeTargets(events);
|
||||
controller.BindRuntimeTargets(targets);
|
||||
|
||||
controller.SetUiLocked(true);
|
||||
|
||||
Assert.Equal(1, targets.UiLockCalls);
|
||||
|
||||
// A second call with the SAME value now correctly no-ops — this
|
||||
// time it really was applied.
|
||||
controller.SetUiLocked(true);
|
||||
|
||||
Assert.Equal(1, targets.UiLockCalls);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UiLockTargetFailureCanRetryTheSameRequestedValue()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -142,6 +142,25 @@ public sealed class CharacterOptionsPageControllerTests
|
|||
DatStringResolver.ComputeHash("ID_PlayerOption_HearPKDeaths"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("ID_CharacterOption_UIBehavior_Section", 0x06489B6Eu)]
|
||||
[InlineData("ID_CharacterOption_UIDisplay_Section", 0x0A9BC99Eu)]
|
||||
[InlineData("ID_CharacterOption_Grouping_Section", 0x0CBAAFAEu)]
|
||||
[InlineData("ID_CharacterOption_OtherPlayers_Section", 0x0872DFFEu)]
|
||||
[InlineData("ID_CharacterOption_CharacterBehavior_Section", 0x08674D5Eu)]
|
||||
[InlineData("ID_CharacterOption_Chat_Section", 0x0987FE8Eu)]
|
||||
public void HeaderKey_RetailNameHash_MatchesByteVerifiedStringId(
|
||||
string headerKey, uint expectedHash)
|
||||
{
|
||||
// SF-2 (OP4 review-fix round, 2026-08-11): structure doc §7's six
|
||||
// byte-verified header string ids — previously verified only by
|
||||
// hand in the mechanism review, not pinned by a test. A typo in a
|
||||
// HeaderKey literal would otherwise produce a silently blank
|
||||
// header that only the user's eye catches.
|
||||
Assert.Equal(expectedHash, DatStringResolver.ComputeHash(headerKey));
|
||||
Assert.Contains(headerKey, CharacterOptionsPageController.Groups.Select(g => g.HeaderKey));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(RetailEnumNameCases))]
|
||||
public void RetailName_MatchesVerbatimAcclientEnumSpelling(
|
||||
|
|
@ -479,6 +498,147 @@ public sealed class CharacterOptionsPageControllerTests
|
|||
Assert.False(controller.CharacterPage.Changed);
|
||||
}
|
||||
|
||||
// ── MUST-FIX 1 (OP4 review-fix round, 2026-08-11): the panel re-seeds
|
||||
// from the live binding on OnShown instead of the pre-login
|
||||
// constructor-default word it was constructed with. ─────────────────
|
||||
|
||||
[Fact]
|
||||
public void OnShown_ReSeedsRow_FromLiveBindingValue_ChangedBehindItsBack()
|
||||
{
|
||||
// Simulates a fresh PlayerDescription landing (or simply "the
|
||||
// character's real server value differs from the word this row
|
||||
// was constructed with") without ever calling SetCurrentValue.
|
||||
(OptionsPanelController controller, FakeBindings bindings, _) = BindReal();
|
||||
CharacterOptionId id = AllRows().First().Id;
|
||||
var row = Assert.IsType<BoolOptionRow>(controller.CharacterPage.Rows[0]);
|
||||
bool initial = row.Current;
|
||||
|
||||
bindings.Values[id] = !initial;
|
||||
bindings.Sets.Clear();
|
||||
|
||||
controller.CharacterPage.OnShown();
|
||||
|
||||
Assert.Equal(!initial, row.Current);
|
||||
Assert.Equal(!initial, row.Saved);
|
||||
Assert.False(controller.CharacterPage.Changed);
|
||||
// The re-read must never round-trip through SetOption — that would
|
||||
// send the re-seeded value back out over the wire (retail's own
|
||||
// GetValue()-into-SaveCurrentValue never calls SetPlayerOption).
|
||||
Assert.Empty(bindings.Sets);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OnShown_AllFiftyRows_ConvergeToTheLiveBindingSnapshot()
|
||||
{
|
||||
// The pre-login case: bind against a constructor-default word (the
|
||||
// fake's dictionary starts empty -> every row seeds false), THEN
|
||||
// the "server" state is populated (a PlayerDescription landing),
|
||||
// THEN the page is shown — every one of the 50 rows must converge,
|
||||
// matching retail's own InitOptions()+PostInit() / first tab-
|
||||
// activation schedule (SaveCurrentValue re-reads GetValue() live).
|
||||
var fakeBindings = new FakeBindings();
|
||||
var random = new Random(20260811);
|
||||
foreach (CharacterOptionsPageController.RowSpec spec in AllRows())
|
||||
fakeBindings.Values[spec.Id] = random.Next(2) == 0;
|
||||
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
OptionsPanelController controller = OptionsPanelController.Bind(
|
||||
layout,
|
||||
new OptionsPanelController.Callbacks(
|
||||
Toggle: () => { },
|
||||
RequestExitToCharacterSelection: () => { },
|
||||
ExitGame: () => { },
|
||||
UseMouseTurningSettings: () => { },
|
||||
DisplaySystemMessage: _ => { }))!;
|
||||
bool bound = CharacterOptionsPageController.Bind(
|
||||
layout,
|
||||
controller.CharacterPage,
|
||||
MakeTemplateResolver(),
|
||||
(_, _) => null,
|
||||
fakeBindings.ToBindings());
|
||||
Assert.True(bound);
|
||||
|
||||
controller.CharacterPage.OnShown();
|
||||
|
||||
int i = 0;
|
||||
foreach (CharacterOptionsPageController.RowSpec spec in AllRows())
|
||||
{
|
||||
var row = (BoolOptionRow)controller.CharacterPage.Rows[i++];
|
||||
Assert.Equal(fakeBindings.Values[spec.Id], row.Current);
|
||||
Assert.Equal(fakeBindings.Values[spec.Id], row.Saved);
|
||||
}
|
||||
Assert.False(controller.CharacterPage.Changed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Reset_AfterReseed_RestoresTheLiveValue_NotTheStaleConstructionDefault()
|
||||
{
|
||||
// The historical bug MF-1 closes: before the fix, Reset/tab-switch
|
||||
// could only ever restore whatever the row was seeded with AT BIND
|
||||
// TIME (the pre-login constructor word) — visually-idempotent
|
||||
// "toggle then cancel" could silently mutate the server bit in the
|
||||
// wrong direction. After the fix, OnShown re-seeds _saved from the
|
||||
// live bit first, so Reset can only revert to what was ACTUALLY
|
||||
// live at the last show.
|
||||
(OptionsPanelController controller, FakeBindings bindings, _) = BindReal();
|
||||
CharacterOptionId id = AllRows().First().Id;
|
||||
var row = Assert.IsType<BoolOptionRow>(controller.CharacterPage.Rows[0]);
|
||||
|
||||
bindings.Values[id] = true;
|
||||
controller.CharacterPage.OnShown(); // re-seed: current == saved == true
|
||||
bindings.Sets.Clear();
|
||||
|
||||
row.SetCurrentValue(false); // user toggles it off, never clicks Apply
|
||||
controller.CharacterPage.Reset();
|
||||
|
||||
Assert.True(row.Current);
|
||||
Assert.Contains(bindings.Sets, s => s.Id == id && s.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ClickingTheRealCheckboxWidget_PublishesSetOption_ViaMouseDownUpClick()
|
||||
{
|
||||
// SF-2/S6 (OP4 review-fix round, 2026-08-11): every other test in
|
||||
// this suite drives BoolOptionRow.SetCurrentValue directly, which
|
||||
// would stay green even if the toggle template's checkbox
|
||||
// (0x10000219) ever lost its authored DAT property 0x0B
|
||||
// (UiButton.ToggleBehavior) — the mechanism the whole LED click
|
||||
// interaction rests on (mechanism review §1.5). This drives the
|
||||
// REAL MouseDown/MouseUp/Click sequence: MouseUp flips
|
||||
// UiButton.Selected FIRST (ToggleBehavior), then Click invokes
|
||||
// checkbox.OnClick, which reads the NEW Selected value.
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
OptionsPanelController controller = OptionsPanelController.Bind(
|
||||
layout,
|
||||
new OptionsPanelController.Callbacks(
|
||||
Toggle: () => { },
|
||||
RequestExitToCharacterSelection: () => { },
|
||||
ExitGame: () => { },
|
||||
UseMouseTurningSettings: () => { },
|
||||
DisplaySystemMessage: _ => { }))!;
|
||||
var fakeBindings = new FakeBindings();
|
||||
bool bound = CharacterOptionsPageController.Bind(
|
||||
layout, controller.CharacterPage, MakeTemplateResolver(), (_, _) => null,
|
||||
fakeBindings.ToBindings());
|
||||
Assert.True(bound);
|
||||
|
||||
var listBox = Assert.IsType<UiTemplateListBox>(
|
||||
layout.FindElement(CharacterOptionsPageController.ListBoxElementId));
|
||||
var checkbox = Assert.IsType<UiButton>(
|
||||
UiElement.FindDescendant(listBox, 0x10000219u));
|
||||
CharacterOptionId id = AllRows().First().Id;
|
||||
Assert.False(checkbox.Selected);
|
||||
|
||||
checkbox.OnEvent(new UiEvent(0, checkbox, UiEventType.MouseDown, Data1: 0, Data2: 0));
|
||||
checkbox.OnEvent(new UiEvent(0, checkbox, UiEventType.MouseUp, Data1: 0, Data2: 0));
|
||||
checkbox.OnEvent(new UiEvent(0, checkbox, UiEventType.Click));
|
||||
|
||||
Assert.True(checkbox.Selected);
|
||||
var set = Assert.Single(fakeBindings.Sets);
|
||||
Assert.Equal(id, set.Id);
|
||||
Assert.True(set.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScrollbarLinkage_ModelPointsAtTheListBoxScroll()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ using AcDream.App.Combat;
|
|||
using AcDream.App.UI;
|
||||
using AcDream.App.UI.Layout;
|
||||
using AcDream.Core.Combat;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
using AcDream.UI.Abstractions.Panels.Settings;
|
||||
using AcDream.Core.Net.Messages;
|
||||
|
||||
namespace AcDream.App.Tests.UI.Layout;
|
||||
|
||||
|
|
@ -11,6 +10,21 @@ public sealed class CombatUiControllerTests
|
|||
{
|
||||
private static (uint, int, int) NoTex(uint _) => (0u, 0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2): the three
|
||||
/// combat LEDs now read/write through the SAME server-bit seam the
|
||||
/// Character tab's rows use — this fake is the test-local stand-in for
|
||||
/// the production RuntimeCharacterOptionsState-backed binding.
|
||||
/// </summary>
|
||||
private sealed class FakeOptionBindings
|
||||
{
|
||||
public Dictionary<CharacterOptionId, bool> Values { get; } = new();
|
||||
|
||||
public CombatUiController.Bindings ToBindings() => new(
|
||||
CurrentValue: id => Values.TryGetValue(id, out bool v) && v,
|
||||
SetOption: (id, value) => Values[id] = value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CombatMode_ShowsPhysicalAndMagicPages_AndSelectsMediumByDefault()
|
||||
{
|
||||
|
|
@ -19,9 +33,9 @@ public sealed class CombatUiControllerTests
|
|||
using var attacks = CreateAttacks(combat, () => now, []);
|
||||
var (layout, basic, spellcasting, power, high, medium, low) = BuildLayout();
|
||||
var visibility = new List<bool>();
|
||||
GameplaySettings gameplay = GameplaySettings.Default;
|
||||
var options = new FakeOptionBindings();
|
||||
using var controller = CombatUiController.Bind(
|
||||
layout, combat, attacks, () => gameplay, value => gameplay = value,
|
||||
layout, combat, attacks, options.ToBindings(),
|
||||
Labels, visibility.Add)!;
|
||||
|
||||
controller.SyncVisibility();
|
||||
|
|
@ -45,9 +59,9 @@ public sealed class CombatUiControllerTests
|
|||
var combat = new CombatState();
|
||||
using var attacks = CreateAttacks(combat, () => now, sent);
|
||||
var (layout, basic, advanced, power, high, _, _) = BuildLayout();
|
||||
GameplaySettings gameplay = GameplaySettings.Default;
|
||||
var options = new FakeOptionBindings();
|
||||
using var controller = CombatUiController.Bind(
|
||||
layout, combat, attacks, () => gameplay, value => gameplay = value,
|
||||
layout, combat, attacks, options.ToBindings(),
|
||||
Labels, _ => { })!;
|
||||
combat.SetCombatMode(CombatMode.Melee);
|
||||
|
||||
|
|
@ -69,9 +83,10 @@ public sealed class CombatUiControllerTests
|
|||
var combat = new CombatState();
|
||||
using var attacks = CreateAttacks(combat, () => 0d, []);
|
||||
var (layout, _, _, _, _, _, _) = BuildLayout();
|
||||
GameplaySettings gameplay = GameplaySettings.Default;
|
||||
var options = new FakeOptionBindings();
|
||||
options.Values[CharacterOptionId.AutoTarget] = true;
|
||||
using var controller = CombatUiController.Bind(
|
||||
layout, combat, attacks, () => gameplay, value => gameplay = value,
|
||||
layout, combat, attacks, options.ToBindings(),
|
||||
Labels, _ => { })!;
|
||||
var autoTarget = Assert.IsType<UiButton>(layout.FindElement(CombatUiController.AutoTargetId));
|
||||
|
||||
|
|
@ -79,7 +94,7 @@ public sealed class CombatUiControllerTests
|
|||
autoTarget.OnEvent(new UiEvent(0, autoTarget, UiEventType.MouseUp, Data1: 3, Data2: 3));
|
||||
autoTarget.OnEvent(new UiEvent(0, autoTarget, UiEventType.Click, Data1: 3, Data2: 3));
|
||||
|
||||
Assert.False(gameplay.AutoTarget);
|
||||
Assert.False(options.Values[CharacterOptionId.AutoTarget]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -88,9 +103,9 @@ public sealed class CombatUiControllerTests
|
|||
var combat = new CombatState();
|
||||
using var attacks = CreateAttacks(combat, () => 0d, []);
|
||||
var (layout, _, _, power, _, _, _) = BuildLayout();
|
||||
GameplaySettings gameplay = GameplaySettings.Default;
|
||||
var options = new FakeOptionBindings();
|
||||
using var controller = CombatUiController.Bind(
|
||||
layout, combat, attacks, () => gameplay, value => gameplay = value,
|
||||
layout, combat, attacks, options.ToBindings(),
|
||||
Labels, _ => { })!;
|
||||
|
||||
var speed = Assert.IsType<UiText>(layout.FindElement(CombatUiController.SpeedLabelId));
|
||||
|
|
@ -108,9 +123,9 @@ public sealed class CombatUiControllerTests
|
|||
ImportedLayout layout = LayoutImporter.Build(info, NoTex, datFont: null);
|
||||
var combat = new CombatState();
|
||||
using var attacks = CreateAttacks(combat, () => 0d, []);
|
||||
GameplaySettings gameplay = GameplaySettings.Default;
|
||||
var options = new FakeOptionBindings();
|
||||
using var controller = CombatUiController.Bind(
|
||||
layout, combat, attacks, () => gameplay, value => gameplay = value,
|
||||
layout, combat, attacks, options.ToBindings(),
|
||||
Labels, _ => { })!;
|
||||
|
||||
ApplyAnchors(layout.Root);
|
||||
|
|
|
|||
|
|
@ -158,6 +158,113 @@ public sealed class OptionsPanelControllerTests
|
|||
Assert.Equal(0, flushCount);
|
||||
}
|
||||
|
||||
// ── MUST-FIX 2 (OP4 review-fix round, 2026-08-11): Apply/Reset gating ──────
|
||||
|
||||
private static (UiButton Apply, UiButton Reset, UiButton Defaults) GetCharacterPageButtons(
|
||||
OptionsPanelController controller)
|
||||
{
|
||||
UiElement pageRoot = UiElement.FindDescendant(controller.Root, 0x10000211u)!; // Character page slot
|
||||
var apply = Assert.IsType<UiButton>(UiElement.FindDescendant(pageRoot, 0x100001FCu));
|
||||
var reset = Assert.IsType<UiButton>(UiElement.FindDescendant(pageRoot, 0x100001FDu));
|
||||
var defaults = Assert.IsType<UiButton>(UiElement.FindDescendant(pageRoot, 0x100001FEu));
|
||||
return (apply, reset, defaults);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterPage_ApplyAndReset_StartDisabled_OnFreshBind()
|
||||
{
|
||||
// Retail's PostInit calls InitOptions() then OnOptionChanged(0), so
|
||||
// the pair starts Ghosted before any row has ever been touched.
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
var calls = new List<string>();
|
||||
OptionsPanelController controller =
|
||||
OptionsPanelController.Bind(layout, MakeCallbacks(calls))!;
|
||||
|
||||
(UiButton apply, UiButton reset, _) = GetCharacterPageButtons(controller);
|
||||
|
||||
Assert.False(apply.Enabled);
|
||||
Assert.False(reset.Enabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterPage_OneLedClick_EnablesApplyAndReset()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
var calls = new List<string>();
|
||||
OptionsPanelController controller =
|
||||
OptionsPanelController.Bind(layout, MakeCallbacks(calls))!;
|
||||
var row = new BoolOptionRow(initial: false, defaultValue: false);
|
||||
controller.CharacterPage.Register(row);
|
||||
(UiButton apply, UiButton reset, _) = GetCharacterPageButtons(controller);
|
||||
|
||||
row.SetCurrentValue(true);
|
||||
|
||||
Assert.True(apply.Enabled);
|
||||
Assert.True(reset.Enabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterPage_Apply_DisablesApplyAndResetAgain()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
var calls = new List<string>();
|
||||
OptionsPanelController controller =
|
||||
OptionsPanelController.Bind(layout, MakeCallbacks(calls))!;
|
||||
var row = new BoolOptionRow(initial: false, defaultValue: false);
|
||||
controller.CharacterPage.Register(row);
|
||||
(UiButton apply, UiButton reset, _) = GetCharacterPageButtons(controller);
|
||||
row.SetCurrentValue(true);
|
||||
|
||||
controller.CharacterPage.Apply();
|
||||
|
||||
Assert.False(apply.Enabled);
|
||||
Assert.False(reset.Enabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterPage_Defaults_LeavesApplyAndResetEnabled_WhenSomethingActuallyChanged()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
var calls = new List<string>();
|
||||
OptionsPanelController controller =
|
||||
OptionsPanelController.Bind(layout, MakeCallbacks(calls))!;
|
||||
var row = new BoolOptionRow(initial: false, defaultValue: true);
|
||||
controller.CharacterPage.Register(row);
|
||||
(UiButton apply, UiButton reset, _) = GetCharacterPageButtons(controller);
|
||||
|
||||
controller.CharacterPage.Defaults();
|
||||
|
||||
Assert.True(row.Current);
|
||||
Assert.True(controller.CharacterPage.Changed);
|
||||
Assert.True(apply.Enabled);
|
||||
Assert.True(reset.Enabled);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterPage_Defaults_IsNeverGated()
|
||||
{
|
||||
// Retail's Defaults override never fetches its own child id at all
|
||||
// — it must never grey itself out, before OR after a real change.
|
||||
ImportedLayout layout = FixtureLoader.LoadOptionsPanelHost();
|
||||
var calls = new List<string>();
|
||||
OptionsPanelController controller =
|
||||
OptionsPanelController.Bind(layout, MakeCallbacks(calls))!;
|
||||
var row = new BoolOptionRow(initial: false, defaultValue: false);
|
||||
controller.CharacterPage.Register(row);
|
||||
(_, _, UiButton defaults) = GetCharacterPageButtons(controller);
|
||||
|
||||
Assert.True(defaults.Enabled);
|
||||
|
||||
row.SetCurrentValue(true);
|
||||
Assert.True(defaults.Enabled);
|
||||
|
||||
controller.CharacterPage.Apply();
|
||||
Assert.True(defaults.Enabled);
|
||||
|
||||
controller.CharacterPage.Defaults();
|
||||
Assert.True(defaults.Enabled);
|
||||
}
|
||||
|
||||
// ── Close button ─────────────────────────────────────────────────────────
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.Core.Combat;
|
||||
using Xunit;
|
||||
|
|
@ -336,4 +338,83 @@ public sealed class ChatLogTests
|
|||
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).", logTextType: 0x06u);
|
||||
Assert.Equal(0x06u, log.Snapshot()[0].LogTextType);
|
||||
}
|
||||
|
||||
// ── SF-1/S1 (OP4 review-fix round, 2026-08-11): DisplayTimestampsSource
|
||||
// prefixes EVERY producer through the shared Append seam, not just
|
||||
// RuntimeCommunicationState.AddText's own subset of callers. ────────
|
||||
|
||||
[Fact]
|
||||
public void DisplayTimestampsSource_Unbound_NoPrefix()
|
||||
{
|
||||
var log = new ChatLog();
|
||||
log.OnLocalSpeech("Alice", "hi", 0xAAu, isRanged: false, logTextType: 0x02u);
|
||||
Assert.Equal("hi", log.Snapshot()[0].Text);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public void DisplayTimestampsSource_GatesThePrefix(bool timestampsOn)
|
||||
{
|
||||
var log = new ChatLog { DisplayTimestampsSource = () => timestampsOn };
|
||||
log.OnLocalSpeech("Alice", "hi", 0xAAu, isRanged: false, logTextType: 0x02u);
|
||||
|
||||
string text = log.Snapshot()[0].Text;
|
||||
if (timestampsOn)
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} hi$", text);
|
||||
else
|
||||
Assert.Equal("hi", text);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
// Every public ingestion method — proving the prefix applies at the
|
||||
// ONE shared Append seam, not per-caller.
|
||||
[InlineData("OnEmote")]
|
||||
[InlineData("OnSoulEmote")]
|
||||
[InlineData("OnChannelBroadcast")]
|
||||
[InlineData("OnTellReceived")]
|
||||
[InlineData("OnSystemMessage")]
|
||||
[InlineData("OnPopup")]
|
||||
[InlineData("OnCombatLine")]
|
||||
[InlineData("OnSelfSent")]
|
||||
[InlineData("OnPlayerKilled")]
|
||||
public void DisplayTimestampsSource_AppliesToEveryProducer(string method)
|
||||
{
|
||||
var log = new ChatLog { DisplayTimestampsSource = () => true };
|
||||
|
||||
switch (method)
|
||||
{
|
||||
case "OnEmote": log.OnEmote("Caith", "waves", 0xCAFEu); break;
|
||||
case "OnSoulEmote": log.OnSoulEmote("Bob", "dances", 0xBEEFu); break;
|
||||
case "OnChannelBroadcast": log.OnChannelBroadcast(42u, "Alice", "motd"); break;
|
||||
case "OnTellReceived": log.OnTellReceived("Alice", "psst", 0xAAu, logTextType: 0x03u); break;
|
||||
case "OnSystemMessage": log.OnSystemMessage("fizzled", chatType: 5); break;
|
||||
case "OnPopup": log.OnPopup("modal"); break;
|
||||
case "OnCombatLine": log.OnCombatLine("hit", logTextType: 0x06u); break;
|
||||
case "OnSelfSent": log.OnSelfSent(ChatKind.Tell, "hey", logTextType: 0x04u, targetOrChannel: "Alice"); break;
|
||||
case "OnPlayerKilled": log.OnPlayerKilled("died", 0x1u, 0x2u); break;
|
||||
}
|
||||
|
||||
string text = log.Snapshot()[0].Text;
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} .+$", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DisplayTimestampsSource_UsesLiteralColons_RegardlessOfCurrentCulture()
|
||||
{
|
||||
CultureInfo original = Thread.CurrentThread.CurrentCulture;
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fi-FI");
|
||||
var log = new ChatLog { DisplayTimestampsSource = () => true };
|
||||
|
||||
log.OnSystemMessage("fizzled", chatType: 0);
|
||||
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} fizzled$", log.Snapshot()[0].Text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = original;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.Core.Social;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
|
|
@ -276,10 +278,56 @@ public sealed class RuntimeCommunicationStateTests
|
|||
Assert.NotEqual("Your spell fizzled.", text);
|
||||
// Retail ctor default format "%#H:%M:%S " (non-zero-padded 24h
|
||||
// hour, zero-padded minute:second, trailing space before the
|
||||
// text) — .NET "H:mm:ss " is the exact equivalent.
|
||||
// text) — .NET "H\:mm\:ss " (colons ESCAPED, not the
|
||||
// culture-dependent TimeSeparator placeholder) is the exact
|
||||
// equivalent (SF-1/S4, OP4 review-fix round, 2026-08-11).
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} Your spell fizzled\.$", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddText_TimestampsTrue_UsesLiteralColons_RegardlessOfCurrentCulture()
|
||||
{
|
||||
// SF-1/S4 (OP4 review-fix round, 2026-08-11): an unescaped "H:mm:ss"
|
||||
// format string renders ':' as CurrentCulture.DateTimeFormat.
|
||||
// TimeSeparator, which is NOT ':' on cultures like fi-FI ("."). The
|
||||
// fix escapes the colons and forces InvariantCulture — prove the
|
||||
// output stays colon-separated even under a culture that would
|
||||
// otherwise substitute a different separator.
|
||||
CultureInfo original = Thread.CurrentThread.CurrentCulture;
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fi-FI");
|
||||
using var state = new RuntimeCommunicationState { DisplayTimestampsSource = () => true };
|
||||
|
||||
state.AddText("Your spell fizzled.", RetailLogTextType.Default);
|
||||
|
||||
string text = state.Chat.Snapshot()[0].Text;
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} Your spell fizzled\.$", text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = original;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DisplayTimestampsSource_ForwardsToChat_TimestampingEveryProducer_NotJustAddText()
|
||||
{
|
||||
// S1 (OP4 review-fix round, 2026-08-11, blast lens): AddText's own
|
||||
// callers (ServerMessage/WeenieError) were a strict SUBSET of
|
||||
// every chat producer — heard speech, emotes, Turbine channels,
|
||||
// and combat text all bypassed it by calling ChatLog's own OnXxx
|
||||
// methods directly. Setting DisplayTimestampsSource on this class
|
||||
// must timestamp lines that never go through AddText at all.
|
||||
using var state = new RuntimeCommunicationState { DisplayTimestampsSource = () => true };
|
||||
|
||||
state.Chat.OnLocalSpeech("Alice", "hi", 0xAAu, isRanged: false, logTextType: 0x02u);
|
||||
|
||||
string text = state.Chat.Snapshot()[0].Text;
|
||||
Assert.EndsWith("hi", text);
|
||||
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} hi$", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddText_TimestampsTrue_NeverAppliedToClientLocalSpewBox()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ public sealed class GameplaySettingsTests
|
|||
// starting point, not retail-bitmask. A change to any of these
|
||||
// should be a deliberate decision, not a drive-by.
|
||||
var d = GameplaySettings.Default;
|
||||
Assert.True(d.AutoTarget);
|
||||
Assert.True(d.AutoRepeatAttack);
|
||||
Assert.True(d.ToggleRun);
|
||||
Assert.False(d.AdvancedCombatUI);
|
||||
Assert.True(d.ShowTooltips);
|
||||
|
|
@ -36,8 +34,8 @@ public sealed class GameplaySettingsTests
|
|||
public void Equality_is_value_based()
|
||||
{
|
||||
var a = GameplaySettings.Default;
|
||||
var b = GameplaySettings.Default with { AutoTarget = false };
|
||||
var c = GameplaySettings.Default with { AutoTarget = false };
|
||||
var b = GameplaySettings.Default with { ToggleRun = false };
|
||||
var c = GameplaySettings.Default with { ToggleRun = false };
|
||||
Assert.NotEqual(a, b);
|
||||
Assert.Equal(b, c);
|
||||
}
|
||||
|
|
@ -48,7 +46,7 @@ public sealed class GameplaySettingsTests
|
|||
var d = GameplaySettings.Default with { LockUI = true };
|
||||
Assert.True(d.LockUI);
|
||||
// Other fields untouched.
|
||||
Assert.Equal(GameplaySettings.Default.AutoTarget, d.AutoTarget);
|
||||
Assert.Equal(GameplaySettings.Default.ToggleRun, d.ToggleRun);
|
||||
Assert.Equal(GameplaySettings.Default.ShowHelm, d.ShowHelm);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,8 +395,15 @@ public sealed class SettingsPanelTests
|
|||
.Select(c => (string)c.Args[0]!).ToList();
|
||||
// Spot check the major retail-named toggles. Don't assert exact
|
||||
// count — adding new toggles shouldn't break this test.
|
||||
Assert.Contains("Auto-target on attack", checks);
|
||||
Assert.Contains("Auto-repeat attacks", checks);
|
||||
//
|
||||
// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2):
|
||||
// "Auto-target on attack" / "Auto-repeat attacks" were retired
|
||||
// from this panel — those two options (plus "Keep combat target
|
||||
// in view") now read/write the canonical server bit through
|
||||
// CombatUiController, not the client-local GameplaySettings
|
||||
// record this dat-free panel edits.
|
||||
Assert.DoesNotContain("Auto-target on attack", checks);
|
||||
Assert.DoesNotContain("Auto-repeat attacks", checks);
|
||||
Assert.Contains("Run mode is toggle (vs hold)", checks);
|
||||
Assert.Contains("Show item tooltips", checks);
|
||||
Assert.Contains("Show helm on character", checks);
|
||||
|
|
@ -415,7 +422,7 @@ public sealed class SettingsPanelTests
|
|||
|
||||
var checks = r.Calls.Where(c => c.Method == "Checkbox")
|
||||
.Select(c => (string)c.Args[0]!).ToList();
|
||||
Assert.DoesNotContain("Auto-target on attack", checks);
|
||||
Assert.DoesNotContain("Run mode is toggle (vs hold)", checks);
|
||||
Assert.DoesNotContain("Lock UI (disable panel drag/resize)", checks);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ public sealed class SettingsStoreTests : System.IDisposable
|
|||
var store = new SettingsStore(_tempPath);
|
||||
var original = GameplaySettings.Default with
|
||||
{
|
||||
AutoTarget = false,
|
||||
AdvancedCombatUI = true,
|
||||
ShowHelm = false,
|
||||
LockUI = true,
|
||||
|
|
@ -249,7 +248,7 @@ public sealed class SettingsStoreTests : System.IDisposable
|
|||
var loaded = store.LoadGameplay();
|
||||
|
||||
Assert.True(loaded.LockUI);
|
||||
Assert.Equal(GameplaySettings.Default.AutoTarget, loaded.AutoTarget);
|
||||
Assert.Equal(GameplaySettings.Default.ToggleRun, loaded.ToggleRun);
|
||||
Assert.Equal(GameplaySettings.Default.ShowHelm, loaded.ShowHelm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ public sealed class SettingsVMTests
|
|||
[Fact]
|
||||
public void GameplayDraft_initial_value_matches_persisted()
|
||||
{
|
||||
var custom = GameplaySettings.Default with { AutoTarget = false, LockUI = true };
|
||||
var custom = GameplaySettings.Default with { LockUI = true };
|
||||
var (vm, _, _, _, _, _, _, _, _, _) = Build(persistedGameplay: custom);
|
||||
Assert.Equal(custom, vm.GameplayDraft);
|
||||
Assert.False(vm.HasUnsavedChanges);
|
||||
|
|
@ -438,7 +438,7 @@ public sealed class SettingsVMTests
|
|||
public void ApplyExternalGameplayChange_updates_both_snapshots_and_preserves_other_drafts()
|
||||
{
|
||||
var (vm, _, _, _, _, _, _, _, _, _) = Build();
|
||||
bool persistedAutoTarget = !GameplaySettings.Default.AutoTarget;
|
||||
bool persistedLockUI = !GameplaySettings.Default.LockUI;
|
||||
|
||||
vm.SetGameplay(vm.GameplayDraft with
|
||||
{
|
||||
|
|
@ -448,10 +448,10 @@ public sealed class SettingsVMTests
|
|||
|
||||
vm.ApplyExternalGameplayChange(gameplay => gameplay with
|
||||
{
|
||||
AutoTarget = persistedAutoTarget,
|
||||
LockUI = persistedLockUI,
|
||||
});
|
||||
|
||||
Assert.Equal(persistedAutoTarget, vm.GameplayDraft.AutoTarget);
|
||||
Assert.Equal(persistedLockUI, vm.GameplayDraft.LockUI);
|
||||
Assert.Equal(
|
||||
!GameplaySettings.Default.ShowTooltips,
|
||||
vm.GameplayDraft.ShowTooltips);
|
||||
|
|
@ -462,7 +462,7 @@ public sealed class SettingsVMTests
|
|||
|
||||
vm.Cancel();
|
||||
|
||||
Assert.Equal(persistedAutoTarget, vm.GameplayDraft.AutoTarget);
|
||||
Assert.Equal(persistedLockUI, vm.GameplayDraft.LockUI);
|
||||
Assert.Equal(
|
||||
GameplaySettings.Default.ShowTooltips,
|
||||
vm.GameplayDraft.ShowTooltips);
|
||||
|
|
@ -478,7 +478,7 @@ public sealed class SettingsVMTests
|
|||
var (vm, _, _, _, _, _, _, savedGameplayHistory, _, _) = Build();
|
||||
vm.SetGameplay(vm.GameplayDraft with
|
||||
{
|
||||
AutoTarget = false,
|
||||
LockUI = true,
|
||||
ShowTooltips = false,
|
||||
UseMouseTurning = true,
|
||||
});
|
||||
|
|
@ -486,7 +486,7 @@ public sealed class SettingsVMTests
|
|||
vm.Save();
|
||||
|
||||
Assert.Single(savedGameplayHistory);
|
||||
Assert.False(savedGameplayHistory[0].AutoTarget);
|
||||
Assert.True(savedGameplayHistory[0].LockUI);
|
||||
Assert.False(savedGameplayHistory[0].ShowTooltips);
|
||||
Assert.True(savedGameplayHistory[0].UseMouseTurning);
|
||||
Assert.False(vm.HasUnsavedChanges);
|
||||
|
|
@ -509,7 +509,7 @@ public sealed class SettingsVMTests
|
|||
[Fact]
|
||||
public void ResetAllToDefaults_resets_gameplay_to_default()
|
||||
{
|
||||
var custom = GameplaySettings.Default with { AutoTarget = false, LockUI = true };
|
||||
var custom = GameplaySettings.Default with { LockUI = true };
|
||||
var (vm, _, _, _, _, _, _, _, _, _) = Build(persistedGameplay: custom);
|
||||
Assert.NotEqual(GameplaySettings.Default, vm.GameplayDraft);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue