fix: social gate round 3 - authored multiline word wrap + geometric

move-cursor border band

- Empty-state text (round 3): the literal-\n split was correct but each
  authored LINE rendered as one clipped run. Retail word-wraps each
  authored line within the element extent (its GlyphList draw - the
  same wrap RetailConfirmationDialogView already uses). Multiline
  authored text now wraps through UiText.WrapWords against the widget's
  LIVE width/font/color (cached per width+font+color, re-read per call).
  Single-line authored labels keep their one-run shape - re-wrapping
  every label is a client-wide change no gate asked for.
- Move cursor (round 3): "the frame won the hit-test" is not a border
  test - windows whose interior is not fully covered by children (the
  inventory panel's empty regions) resolve those pixels to the frame
  too. The border is now a geometric 8 px band along the window's outer
  edge, AND the frame must win the hit-test so border-adjacent content
  keeps its own cursor. Resize-edge claim still takes precedence;
  whole-surface dragging unchanged.

App suite 4,984/3 skips (new BuildText_MultilineAuthored wrap test).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-14 07:50:59 +02:00
parent 67fe754dd6
commit 4943484eb9
3 changed files with 113 additions and 20 deletions

View file

@ -691,6 +691,45 @@ public class DatWidgetFactoryTests
Assert.Equal(204f / 255f, text.LinesProvider()[0].Color.X, 5);
}
/// <summary>
/// 2026-08-13 social gate round 3: a MULTILINE authored string (literal
/// backslash-n escapes in the DAT) word-wraps each authored line to the
/// widget's live width — retail's GlyphList draw, the same wrap the
/// confirmation dialog view uses. The fellowship empty-state was
/// rendering its three authored lines as three clipped runs.
/// </summary>
[Fact]
public void BuildText_MultilineAuthored_WordWrapsToLiveWidth()
{
var info = new ElementInfo { Type = 12, Width = 100, Height = 80 };
var direct = new UiStateInfo { Id = UiStateInfo.DirectStateId };
direct.Properties.Values[0x17u] = new UiPropertyValue
{
Kind = UiPropertyKind.StringInfo,
StringInfoValue = new UiStringInfoValue(0, 1, 2, 0, 1, 0),
};
info.States[UiStateInfo.DirectStateId] = direct;
// No DatFont in this fixture — the fallback measure is 8 px/char, so
// Width=100 fits 12 characters per wrapped line.
var text = Assert.IsType<UiText>(DatWidgetFactory.Create(
info, NoTex, null,
stringResolve: _ => "one two three four five\\nsix"));
var lines = text.LinesProvider!();
Assert.True(lines.Count >= 3);
Assert.All(lines, line => Assert.True(line.Text.Length <= 12));
Assert.Equal(
"one two three four five six",
string.Join(" ", lines.Select(static line => line.Text)));
// The provider tracks the LIVE width — widening re-wraps.
text.Width = 400f;
lines = text.LinesProvider!();
Assert.Equal(2, lines.Count);
Assert.Equal("one two three four five", lines[0].Text);
Assert.Equal("six", lines[1].Text);
}
[Fact]
public void HorizontalScrollbar_PreservesNestedCombatMeterFillSprite()
{