fix: complete retail parity stability pass
All checks were successful
CI / linux-portable (push) Successful in 3m41s
CI / windows-gate (push) Successful in 6m49s
CI / release (push) Successful in 3m22s

This commit is contained in:
Erik 2026-08-28 20:01:39 +02:00
parent d3df4cb20a
commit f7aa8e0eb7
131 changed files with 7765 additions and 1190 deletions

View file

@ -732,6 +732,65 @@ public class UiButtonTests
Assert.True(kid.Visible);
}
[Fact]
public void TrySetRetailState_AppliesInvisibleToButtonNamedAndDirectStates()
{
var info = ButtonInfo("Normal", "Ghosted");
info.StateMedia[""] = (99u, 1);
info.States[UiStateInfo.DirectStateId] = StateWithInvisible(
UiStateInfo.DirectStateId, "", invisible: true);
info.States[UiButtonStateMachine.Normal] = StateWithInvisible(
UiButtonStateMachine.Normal, "Normal", invisible: false);
info.States[UiButtonStateMachine.Ghosted] = StateWithInvisible(
UiButtonStateMachine.Ghosted, "Ghosted", invisible: true);
var button = CreateButton(info);
button.Visible = false;
Assert.True(button.TrySetRetailState(UiButtonStateMachine.Normal));
Assert.True(button.Visible);
Assert.True(button.TrySetRetailState(UiButtonStateMachine.Ghosted));
Assert.False(button.Visible);
button.Visible = true;
Assert.True(button.TrySetRetailState(UiStateInfo.DirectStateId));
Assert.False(button.Visible);
}
[Fact]
public void UiText_ReturningToDirectState_RestoresItsInvisibleProperty()
{
var info = new ElementInfo { Type = 12, Width = 20, Height = 20 };
info.States[UiStateInfo.DirectStateId] = StateWithInvisible(
UiStateInfo.DirectStateId, "", invisible: true);
info.States[UiButtonStateMachine.Normal] = StateWithInvisible(
UiButtonStateMachine.Normal, "Normal", invisible: false);
var text = new UiText();
text.ConfigureDatState(info);
text.Visible = true;
Assert.True(text.TrySetRetailState(UiStateInfo.DirectStateId));
Assert.False(text.Visible);
Assert.True(text.TrySetRetailState(UiButtonStateMachine.Normal));
Assert.True(text.Visible);
Assert.True(text.TrySetRetailState(UiStateInfo.DirectStateId));
Assert.False(text.Visible);
}
private static UiStateInfo StateWithInvisible(
uint id,
string name,
bool invisible)
{
var state = new UiStateInfo { Id = id, Name = name };
state.Properties.Values[0x3Bu] = new UiPropertyValue
{
Kind = UiPropertyKind.Bool,
BoolValue = invisible,
};
return state;
}
private static ElementInfo ButtonInfo(params string[] states)
{
var info = new ElementInfo { Type = 1, Width = 20, Height = 20 };