Consolidated fix round for the two OP3 dual-lens reviews
(docs/research/2026-08-11-op3-review-{mechanism,blast}.md), both
APPROVE-WITH-FIXES.
MUST-FIX:
- The six "Use Mouse Turning Settings" chat lines were typed
RetailLogTextType.ClientLocal (0x1A); retail types them 0x07 (Magic).
BYTE-VERIFIED against the PDB-paired binary at all six
gmConfigUI::SetMouseTurningDefaults call sites (0x0049E972/E9E2/EA52/
EAA4/EAF6/EB48): every site pushes `6a 07` (type=7) immediately before
the text-pointer push and the AddTextToScroll call. Added a dedicated
OptionsRuntimeBindings.DisplayMouseTurningMacroLine seam routed at
Magic (scrolling chat transcript, light blue, timestamped) instead of
the 4-slot SpewBox ClientLocal uses; the mid-air refusal and UA/RA
keep ClientLocal (both independently confirmed correct).
- Filed AD-77: the client-wide floating-only gmPanelUI host divergence
(retail also exposes a docked 0x21000017 host) the plan §5 delegated
to this review, scoped to every main panel, not just Options.
SHOULD-FIX:
- gmGameplayOptionsUI is not an OptionPage in retail (acclient.h:55857,
UIElement_Field). OptionsPanelController now constructs the Gameplay
slot's OptionPage with AfterApply deliberately null, so entering/
leaving that tab never publishes SaveCharacterOptionsRuntimeCmd.
Corrected OptionPageModel's doc comment and rewrote the two tests
that pinned the wrong (Gameplay-flushes) shape.
- Added the OptionPage.OnOptionChanged seam (PlayerOptionPage::
OnOptionChanged @0x004F27D0) — fires as the last step of Apply/
Reset/Defaults, plus once per live LED edit via a new
IOptionRow.AttachPageNotify hook (BoolOptionRow wires it into
SetCurrentValue only, matching retail's Apply(1)-only
HandleDialogAndNotices path). OP4-6 will bind Apply/Reset enable
state to this.
- Exit to Character Selection's mid-air refusal is now tri-state
(Func<bool?> IsGrounded): retail's UseTime only reaches the airborne
test inside `else if (smartbox->player)`, so outside player mode (or
with no live controller) the button is a SILENT no-op, not a
refusal. Fixed the inverted comment at both call sites.
- Options panel geometry now matches its nine gmPanelUI siblings
sharing RetailPanelUiController's one main-panel rectangle
(ResizeX=false, bottom-edge-only resize, no invented Min/MaxWidth/
Height) instead of being the only all-four-edge/horizontal-resize
outlier whose width silently reverted whenever a sibling was shown.
- Added the three missing test pins: Options/Character mutual
exclusion through a REAL RetailPanelUiController registration,
RetailDialogFactory.MakeConfirmation's omitted-queueKey overload
sharing DefaultQueueKey, and UiTabPanel.ActivePageChanged never
firing on a dormant (non-activated) host.
- TS-74's What/Where now names the five store-only CameraTurning
preferences explicitly instead of only mentioning them in Risk.
- Test script gains the toolbar-button ghosted->enabled+highlight
check, UseMouseTurning-survives-relogin and the five prefs-survive-
relaunch steps, a UA/RA legibility eye-item, and the corrected
bottom-edge-only geometry description for step 5.
One-liners fixed in files already touched: symmetric close-button
resolve-failure logging in OptionsPanelController.Bind (blast NOTE 8).
Full Release suite: 12,947 passed / 4 skipped / 0 failed (baseline
12,935/4/0 post-OP7 — 12 net new tests; the two OptionPageModelTests
"wrong-shape" tests were renamed/rewritten in place, not removed).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
229 lines
10 KiB
C#
229 lines
10 KiB
C#
using System.IO;
|
|
using System.Text.Json;
|
|
using AcDream.App.UI;
|
|
using AcDream.App.UI.Layout;
|
|
|
|
namespace AcDream.App.Tests.UI.Layout;
|
|
|
|
/// <summary>
|
|
/// Built-widget behavior pins for the pre-existing, already-shipped Type-8/Type-5
|
|
/// elements the OP2 double-REJECT findings named
|
|
/// (`docs/research/2026-08-11-op2-review-blast.md` §1.1/§1.2,
|
|
/// `docs/research/2026-08-11-op2-review-mechanism.md` §2.1/§2.2). These fixtures are
|
|
/// NOT Options-panel data — they are the character sheet, spellbook, vendor, and
|
|
/// combat panels' own committed fixtures — and every assertion here is a regression
|
|
/// guard for the OP2 rework's dormancy model: a Type-8/Type-5 element that reaches
|
|
/// <see cref="DatWidgetFactory"/> without a controller opting it into the new
|
|
/// mechanism must render and hit-test EXACTLY like the pre-OP2
|
|
/// <see cref="UiDatElement"/> fallback.
|
|
///
|
|
/// <para>
|
|
/// Before this rework, these five Type-8 elements and every pre-existing Type-5
|
|
/// element silently re-classed to a bare-<see cref="UiElement"/>-derived
|
|
/// <c>UiTabControl</c>/<c>UiTemplateListBox</c> in production while every fixture-
|
|
/// driven test still exercised the OLD stale-fixture shape (empty TabTable/
|
|
/// TemplateList) — a structural false negative the blast-radius review named as the
|
|
/// root enabler. These tests build through the REAL (regenerated) fixtures, so a
|
|
/// future regression that reintroduces eager wiring, media loss, or a ClickThrough
|
|
/// flip WILL fail here.
|
|
/// </para>
|
|
/// </summary>
|
|
public class OP2ReworkBlastRadiusConformanceTests
|
|
{
|
|
// ── Type 8 — vendor's media-bearing, tab-table-less backdrop ────────────
|
|
|
|
/// <summary>
|
|
/// Vendor `0x1000008D` (800x20) authors a DirectState fill and NO tab table —
|
|
/// `RetailUiRuntime.cs` documents it by name as the vendor panel's own backdrop
|
|
/// fill. Blast-review MUST-FIX 1(a): the OP2-as-landed unconditional-but-bare
|
|
/// mapping stopped this drawing entirely.
|
|
/// </summary>
|
|
[Fact]
|
|
public void Vendor_BackdropElement_DrawsItsAuthoredMedia_AndStaysClickThrough()
|
|
{
|
|
var layout = FixtureLoader.LoadVendor();
|
|
var backdrop = Assert.IsType<UiTabPanel>(layout.FindElement(0x1000008Du));
|
|
|
|
Assert.Empty(backdrop.Tabs); // no authored 0x2E on this element
|
|
Assert.False(backdrop.BehaviorActive); // nobody activates it — dormant
|
|
Assert.True(backdrop.ClickThrough); // UiDatElement's generic-decoration default
|
|
(uint file, int _) = backdrop.ActiveMedia();
|
|
Assert.NotEqual(0u, file); // the authored fill still draws
|
|
}
|
|
|
|
/// <summary>
|
|
/// Vendor `0x100000B8` (the ACTUAL tab host, distinct from the `0x1000008D`
|
|
/// backdrop above) authors a 3-entry tab table that `VendorUiController`
|
|
/// already switches end-to-end. Same claim as the character/spellbook roots
|
|
/// below: dormant on import, controller owns activation.
|
|
/// </summary>
|
|
[Fact]
|
|
public void Vendor_TabHost_StaysDormant_ControllerOwnsSwitching()
|
|
{
|
|
var layout = FixtureLoader.LoadVendor();
|
|
var host = Assert.IsType<UiTabPanel>(layout.FindElement(0x100000B8u));
|
|
|
|
Assert.Equal(3, host.Tabs.Count); // the authored table IS present…
|
|
Assert.False(host.BehaviorActive); // …but nobody has activated it
|
|
Assert.Equal(0u, host.ActivePageElementId);
|
|
Assert.True(host.ClickThrough);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Blast review SHOULD-FIX 3 / NOTE 2 (2026-08-11 fix round): AD-73's
|
|
/// dormancy contract is that a Type-8 host with an authored tab table
|
|
/// performs NO switching until a controller calls
|
|
/// <see cref="UiTabPanel.ActivateTabBehavior"/> — but nothing had pinned
|
|
/// <see cref="UiTabPanel.ActivePageChanged"/> ITSELF against a dormant
|
|
/// host (as opposed to <c>BehaviorActive</c>/<c>ActivePageElementId</c>,
|
|
/// which the test above already covers). <c>SwitchTo</c> is public and
|
|
/// its own doc invites a future direct call, so this guards the CURRENT
|
|
/// dormant-by-default contract, not <c>SwitchTo</c> itself.
|
|
/// </summary>
|
|
[Fact]
|
|
public void Vendor_TabHost_DormantHost_NeverRaisesActivePageChanged()
|
|
{
|
|
var layout = FixtureLoader.LoadVendor();
|
|
var host = Assert.IsType<UiTabPanel>(layout.FindElement(0x100000B8u));
|
|
int raised = 0;
|
|
host.ActivePageChanged += (_, _) => raised++;
|
|
|
|
Assert.False(host.BehaviorActive);
|
|
Assert.Equal(0, raised);
|
|
}
|
|
|
|
// ── Type 8 — panel roots with their own controller-owned switching ──────
|
|
|
|
/// <summary>
|
|
/// Character sheet root `0x10000227` authors a 3-entry tab table but
|
|
/// `CharacterStatController` already owns tab switching for this panel
|
|
/// end-to-end. Blast-review MUST-FIX 1(b)/(c): the OP2-as-landed mapping made
|
|
/// this element claim every unclaimed click in its bounds
|
|
/// (<c>ClickThrough</c> false→ silently) and stop propagating
|
|
/// <see cref="IUiDatStateful"/> state into its children.
|
|
/// </summary>
|
|
[Fact]
|
|
public void CharacterRoot_StaysClickThrough_AndPropagatesState_WithoutActivation()
|
|
{
|
|
var layout = FixtureLoader.LoadCharacter();
|
|
var root = Assert.IsType<UiTabPanel>(layout.Root);
|
|
Assert.Equal(0x10000227u, root.DatElementId);
|
|
|
|
Assert.NotEmpty(root.Tabs); // the authored table IS present…
|
|
Assert.False(root.BehaviorActive); // …but nobody has activated it
|
|
Assert.Equal(0u, root.ActivePageElementId);
|
|
Assert.True(root.ClickThrough);
|
|
Assert.IsAssignableFrom<IUiDatStateful>(root);
|
|
}
|
|
|
|
/// <summary>Spellbook root `0x100002A8` — same shape/claim as the character
|
|
/// sheet, owned end-to-end by <c>SpellbookWindowController</c>.</summary>
|
|
[Fact]
|
|
public void SpellbookRoot_StaysClickThrough_AndPropagatesState_WithoutActivation()
|
|
{
|
|
var layout = FixtureLoader.LoadSpellbook();
|
|
var root = Assert.IsType<UiTabPanel>(layout.Root);
|
|
Assert.Equal(0x100002A8u, root.DatElementId);
|
|
|
|
Assert.NotEmpty(root.Tabs);
|
|
Assert.False(root.BehaviorActive);
|
|
Assert.Equal(0u, root.ActivePageElementId);
|
|
Assert.True(root.ClickThrough);
|
|
Assert.IsAssignableFrom<IUiDatStateful>(root);
|
|
}
|
|
|
|
// ── Type 8 — combat, which has NO controller re-binder at all ───────────
|
|
|
|
/// <summary>
|
|
/// Combat `0x100000A2` authors an 8-entry tab table and — unlike character/
|
|
/// spellbook/vendor — has NO controller that re-binds it after import. Blast-
|
|
/// review MUST-FIX 1(d): the OP2-as-landed <c>OnChildrenAttached</c> ran at
|
|
/// import time regardless, so this element would have taken over its 8 stance
|
|
/// pages outright with nothing to override it. Every child must remain exactly
|
|
/// as imported: all Visible (retail's plain default), no page hidden, no click
|
|
/// bound.
|
|
/// </summary>
|
|
[Fact]
|
|
public void Combat_TabHost_PerformsNoImportTimeTakeover()
|
|
{
|
|
var layout = FixtureLoader.LoadCombat();
|
|
var host = Assert.IsType<UiTabPanel>(layout.FindElement(0x100000A2u));
|
|
|
|
Assert.Equal(8, host.Tabs.Count); // the authored table IS present…
|
|
Assert.False(host.BehaviorActive); // …but nothing ever activates it
|
|
Assert.Equal(0u, host.ActivePageElementId);
|
|
Assert.Equal(16, host.Children.Count); // no children lost/consumed
|
|
Assert.All(host.Children, child => Assert.True(child.Visible));
|
|
}
|
|
|
|
// ── Type 5 — a representative pre-existing ListBox with an authored template ──
|
|
|
|
/// <summary>
|
|
/// Effects list `0x10000123` (`EffectsUiController.ListId`) authors a 1-row
|
|
/// template array. Blast-review MUST-FIX 2: the OP2-as-landed unconditional
|
|
/// mapping lost the authored media, defaulted <c>ClickThrough=false</c>, and
|
|
/// unconditionally injected a hit-testable viewport as child 0 — before
|
|
/// <c>EffectsUiController.Bind</c> ever runs. This pins the dormant baseline
|
|
/// directly; <c>EffectsUiControllerTests</c> pins the controller's own
|
|
/// subsequent <see cref="UiElement.AddChild"/> behavior.
|
|
/// </summary>
|
|
[Fact]
|
|
public void EffectsList_StaysDormant_ClickThrough_NoInjectedViewport()
|
|
{
|
|
var layout = FixtureLoader.LoadPositiveEffects();
|
|
var host = Assert.IsType<UiTemplateListBox>(
|
|
layout.FindElement(EffectsUiController.ListId));
|
|
|
|
Assert.NotEmpty(host.Templates); // the authored 0x64 array IS present…
|
|
Assert.Empty(host.Children); // …but no viewport was injected
|
|
Assert.Equal(0, host.ContentHeight);
|
|
Assert.True(host.ClickThrough);
|
|
}
|
|
|
|
/// <summary>
|
|
/// AD-73 addendum (OP2 re-review closure, 2026-08-11):
|
|
/// <see cref="UiTemplateListBox.ConsumesDatChildren"/> is <c>true</c> where the
|
|
/// pre-rework generic fallback's was not. That delta drops nothing ONLY while no
|
|
/// authored Type-5 element carries children — a premise the re-review verified by
|
|
/// hand across all 32 fixtures. This test turns that manual sweep into a build
|
|
/// gate: if a future DAT regeneration surfaces a Type-5 element WITH authored
|
|
/// children, this fails loudly instead of the children silently vanishing.
|
|
/// </summary>
|
|
[Fact]
|
|
public void EveryAuthoredType5Element_HasZeroChildren_AcrossAllFixtures()
|
|
{
|
|
string fixturesDir = Path.Combine(
|
|
AppContext.BaseDirectory, "UI", "Layout", "fixtures");
|
|
string[] fixtures = Directory.GetFiles(fixturesDir, "*.json");
|
|
Assert.NotEmpty(fixtures);
|
|
|
|
var opts = new JsonSerializerOptions { IncludeFields = true };
|
|
int type5Seen = 0;
|
|
foreach (string file in fixtures)
|
|
{
|
|
var root = JsonSerializer.Deserialize<ElementInfo>(
|
|
File.ReadAllText(file), opts);
|
|
Assert.NotNull(root);
|
|
Walk(root!, file);
|
|
}
|
|
|
|
// The premise is only meaningful if the sweep actually saw Type-5
|
|
// elements (16 across the current fixture set).
|
|
Assert.True(type5Seen >= 10, $"sweep saw only {type5Seen} Type-5 elements");
|
|
|
|
void Walk(ElementInfo node, string file)
|
|
{
|
|
if (node.Type == 5u)
|
|
{
|
|
type5Seen++;
|
|
Assert.True(
|
|
node.Children.Count == 0,
|
|
$"{Path.GetFileName(file)}: Type-5 element 0x{node.Id:X8} authors "
|
|
+ $"{node.Children.Count} children — UiTemplateListBox.ConsumesDatChildren "
|
|
+ "would drop them; see AD-73's addendum.");
|
|
}
|
|
foreach (ElementInfo child in node.Children)
|
|
Walk(child, file);
|
|
}
|
|
}
|
|
}
|