fix(D.2b): do NOT register Type 3 -> UiField (review fix for Task 6)

Task 6 registered Type 3 -> UiField globally, which broke acdream's Type-3 dat
elements: in these layouts Type 3 is sprite-bearing CHROME (the 8-piece bevel
corners, e.g. vitals 0x10000633 -> sprite 0x060074C3) and the transcript/input
CONTAINER panels — NOT editable fields. UiField draws no dat sprite, so the
vitals bevel corners would render empty; the regression was masked by weakening
VitalsTree_ChromeCornerHasExpectedSprite (UiDatElement+sprite -> UiField+exists).

Retail Type 3 IS UIElement_Field, but retail draws those chrome elements as inert
media-bearing Fields, which our UiDatElement reproduces pixel-for-pixel without a
spurious focus/edit affordance. The one true editable field — the chat input
0x10000016 — resolves to Type 12 and is controller-placed as a UiField (Variant B,
kept). So Type 3 stays on the generic fallback; register it as UiField only when a
window carries a factory-built editable Type-3 field (and UiField grows a
background-media draw + an opt-in editable flag then).

Restored the chrome-corner conformance test (asserts UiDatElement + sprite, an
early warning if Type 3 is ever wrongly routed to UiField). Kept the good Task-6
work: UiField rename + the Variant-B input wiring (stray Type-12 placeholder
removed). Full suite: 404 passed, 2 skipped, 0 failed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-16 17:53:56 +02:00
parent e059a3f6ef
commit ee2e0fafa0
3 changed files with 35 additions and 18 deletions

View file

@ -100,13 +100,21 @@ public class DatWidgetFactoryTests
Assert.IsType<UiScrollbar>(e);
}
// ── Test 5e: Type 3 → UiField ────────────────────────────────────────────
// ── Test 5e: Type 3 is NOT registered — chrome/containers stay generic ────
//
// Retail Type 3 = UIElement_Field, but acdream's Type-3 dat elements (vitals/chat
// bevel chrome + the transcript/input container panels) are inert sprite-bearing
// chrome, not editable fields. They stay on the UiDatElement fallback so their
// sprites render and they gain no spurious focus/edit affordance. The one true
// editable field (the chat input, 0x10000016) resolves to Type 12 and is
// controller-placed as a UiField. Register Type 3 → UiField only when a window
// carries a factory-built editable Type-3 field.
[Fact]
public void Type3_Field_MakesUiField()
public void Type3_NotRegistered_FallsBackToGeneric()
{
var e = DatWidgetFactory.Create(new ElementInfo { Type = 3, Width = 200, Height = 16 }, NoTex, null);
Assert.IsType<UiField>(e);
Assert.IsType<UiDatElement>(e);
}
// ── Test 5d: Type 6 → UiMenu ─────────────────────────────────────────────

View file

@ -76,20 +76,18 @@ public class LayoutConformanceTests
}
}
// ── Test 3: Chrome TL corner type ────────────────────────────────────────
// ── Test 3: Chrome TL corner sprite ───────────────────────────────────────
//
// NOTE: As of Task 6 (widget-generalization), Type-3 elements are built as
// UiField (UIElement_Field, reg :126190) rather than UiDatElement. The
// chrome corner (0x10000633) is a Type-3 dat element and is now a UiField.
// Its dat sprite (0x060074C3) is not rendered by UiField — UiField renders
// the focused/unfocused field background only. The sprite rendering for
// Type-3 chrome image elements is a known limitation; tracked for post-Task-8
// follow-up (UiField could expose a BackgroundSprite similar to UiText).
// NOTE: Type 3 is retail UIElement_Field, but acdream's Type-3 elements here are
// sprite-bearing CHROME (the 8-piece bevel corners), so they stay on the generic
// UiDatElement fallback (NOT registered as UiField in the factory — see
// DatWidgetFactory.Create). This test guards that the chrome corner keeps drawing
// its dat sprite; if a future change routes Type 3 → UiField, the corner sprite
// would vanish and this assertion fails — which is the intended early warning.
/// <summary>
/// The top-left chrome corner element (id <c>0x10000633</c>) is Type-3 in
/// the dat, built as a <see cref="UiField"/> since Task 6. Confirms the
/// element exists in the tree.
/// The top-left chrome corner element (id <c>0x10000633</c>) must be a
/// <see cref="UiDatElement"/> whose active media file id is <c>0x060074C3</c>.
/// </summary>
[Fact]
public void VitalsTree_ChromeCornerHasExpectedSprite()
@ -98,8 +96,9 @@ public class LayoutConformanceTests
var elem = layout.FindElement(0x10000633u);
Assert.NotNull(elem);
// Type-3 elements are now built as UiField (UIElement_Field, Task 6).
Assert.IsType<UiField>(elem);
var datElem = Assert.IsType<UiDatElement>(elem);
var (file, _) = datElem.ActiveMedia();
Assert.Equal(0x060074C3u, file);
}
// ── Test 4 (N4): Inheritance resolution — FontDid propagated from base ───