acdream/tests/AcDream.App.Tests/UI/Layout/CombatLayoutConformanceTests.cs
Erik 927fa7881a fix(combat): restore retail combat bar controls
Resolve authored StringInfo labels from local.dat, port gmCombatUI's runtime option captions and checkbox widgets, and bind horizontal scrollbar media by retail structural roles so the green power jewel is a thumb instead of a tiled track. Persist the three combat options and make Auto Target govern target acquisition.

Co-Authored-By: Codex <codex@openai.com>
2026-07-11 20:26:52 +02:00

43 lines
1.6 KiB
C#

using AcDream.App.UI;
using AcDream.App.UI.Layout;
namespace AcDream.App.Tests.UI.Layout;
public sealed class CombatLayoutConformanceTests
{
[Theory]
[InlineData("ID_CombatPanelOption_AutoRepeatAttack", 0x0718F89Bu)]
[InlineData("ID_CombatPanelOption_AutoTarget", 0x0FB7B944u)]
[InlineData("ID_CombatPanelOption_ViewCombatTarget", 0x0936C254u)]
public void RetailStringHash_MatchesNamedDecompGolden(string value, uint expected)
=> Assert.Equal(expected, DatStringResolver.ComputeHash(value));
[Fact]
public void RetailFixture_UsesAuthoredScrollbarRolesAndCheckboxWidgets()
{
ElementInfo info = FixtureLoader.LoadCombatInfos();
ImportedLayout layout = LayoutImporter.Build(
info,
_ => (0u, 0, 0),
datFont: null,
stringResolve: _ => "localized");
var power = Assert.IsType<UiScrollbar>(
layout.FindElement(CombatUiController.PowerControlId));
Assert.Equal(0x060074CAu, power.TrackSprite);
Assert.Equal(0x06001923u, power.ThumbSprite);
Assert.Equal(0x06001200u, power.ScalarFillSprite);
var repeat = Assert.IsType<UiButton>(
layout.FindElement(CombatUiController.RepeatAttacksId));
Assert.Equal(13f, repeat.FaceWidth);
Assert.Equal(13f, repeat.FaceHeight);
Assert.Equal(17f, repeat.LabelOffsetX);
Assert.True(repeat.ToggleBehavior);
var high = Assert.IsType<UiButton>(
layout.FindElement(CombatUiController.HighButtonId));
Assert.Equal("localized", high.Label);
Assert.IsType<UiText>(layout.FindElement(CombatUiController.SpeedLabelId));
}
}