feat(ui): #409 — client-wide retail tooltip system

Full re-derivation from named-retail decomp: UIElement::StartTooltipAtMouse
@0x00460D70 -> UIElementManager::StartTooltip @0x0045DE90/@0x00459700,
UIElement::MouseHover @0x00462520 (P0x4B TooltipOn gate + global
m_tooltipEnable), UIElementManager::CheckTooltip @0x0045B6E0 (dwell/
auto-hide timer, default 0.25s/10s), SwitchMouseOver/DeletingElement
(dismissal). Corrects the earlier GF-16 investigation: P0x47 is the
element-desc id WITHIN the popup LayoutDesc (P0x48), not a "behavior
enum"; P0x4A is read off the popup's own instantiated root, not the
trigger element.

- ElementInfo/UiElement gain six tooltip data fields (P0x47/48/49/4A/4B/50),
  read generically by ElementReader and copied through LayoutImporter,
  mirroring the existing AuthoredInvisible passthrough pattern.
- UiRoot's existing CheckTooltip-derived hover timer gains TooltipShow/
  TooltipHide events, a per-element P0x50 delay override, and dismissal
  wiring at every retail-confirmed teardown site.
- RetailTooltipPresenter (owned by RetailUiRuntime, mounted alongside
  RetailDialogFactory) builds the popup via the existing LayoutImporter
  dat-lock seam, auto-resizes by the measured-vs-authored text delta
  (word-wrapped via the existing UiText.WrapWords primitive), positions
  at the mouse clamped to the display, and stays topmost over dialogs via
  its own later per-tick BringToFront (register AD-106).
- Misc.TooltipEnable/Misc.TooltipDelay are client-local UserPreferences
  (retail's own 2013 Config tab authors no visible row for either) —
  SettingsStore gains a MiscSettings section, no new options-panel row.
- Live-DAT sweep: 434 elements author >=1 trigger property (243 with
  literal text this port shows; 191 rely on retail's dynamic
  InqProperty(0x49) override, deferred as register TS-85 alongside the
  unmodeled P0x3D wrap-width override).

Gates: Release build 0 errors; App suite (live-DAT env) 5410/5407 passed/
3 skipped (was 5379/3); Runtime 1735/0 unchanged; UI.Abstractions 926/0;
full solution 14,617/14,548 passed/69 skipped/0 failed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-16 20:03:24 +02:00
parent d3755eb231
commit a377b9bff7
16 changed files with 1386 additions and 9 deletions

View file

@ -631,4 +631,57 @@ public sealed class SettingsStoreTests : System.IDisposable
Assert.Equal(crafting, store.LoadNamedWindowLayout("crafting", "chat", default));
Assert.Null(store.LoadNamedWindowLayout("missing", "chat", default));
}
// -- #409: Misc section (Misc.TooltipEnable / Misc.TooltipDelay) --------
[Fact]
public void LoadMisc_returns_defaults_when_file_is_missing()
{
var store = new SettingsStore(_tempPath);
Assert.Equal(MiscSettings.Default, store.LoadMisc());
}
[Fact]
public void SaveMisc_then_LoadMisc_round_trips_all_fields()
{
var store = new SettingsStore(_tempPath);
var original = new MiscSettings(TooltipEnable: false, TooltipDelaySeconds: 1.5f);
store.SaveMisc(original);
var loaded = store.LoadMisc();
Assert.Equal(original, loaded);
}
[Fact]
public void LoadMisc_falls_back_per_field_when_keys_missing()
{
File.WriteAllText(_tempPath, """
{
"version": 3,
"misc": { "tooltipEnable": false }
}
""");
var store = new SettingsStore(_tempPath);
var loaded = store.LoadMisc();
Assert.False(loaded.TooltipEnable);
Assert.Equal(MiscSettings.Default.TooltipDelaySeconds, loaded.TooltipDelaySeconds);
}
[Fact]
public void SaveMisc_preserves_display_section_and_vice_versa()
{
var store = new SettingsStore(_tempPath);
store.SaveDisplay(DisplaySettings.Default with { Resolution = "2560x1440" });
store.SaveMisc(MiscSettings.Default with { TooltipDelaySeconds = 2f });
Assert.Equal("2560x1440", store.LoadDisplay().Resolution);
Assert.Equal(2f, store.LoadMisc().TooltipDelaySeconds);
store.SaveDisplay(DisplaySettings.Default with { ShowFps = true });
Assert.Equal(2f, store.LoadMisc().TooltipDelaySeconds);
Assert.True(store.LoadDisplay().ShowFps);
}
}