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

@ -1,8 +1,10 @@
using System.Linq;
using System.Numerics;
using AcDream.App.UI;
using AcDream.App.UI.Layout;
using AcDream.Core.Net.Messages;
using AcDream.Core.World;
using AcDream.Runtime.Gameplay;
namespace AcDream.App.Tests.UI.Layout;
@ -124,7 +126,18 @@ public sealed class MapHousePanelControllerTests
/// UiButton hotspots above — a fresh instance per call, matching
/// production's real resolver.</summary>
private static UiElement? FakeHouseRowTemplate(uint layoutId, uint elementId)
=> new UiText { Width = 280f, Height = 28f };
=> new UiText
{
Width = 280f,
Height = 28f,
DefaultColor = new Vector4(0.1f, 0.1f, 0.1f, 1f),
FontColorPalette =
[
new Vector4(1f, 1f, 1f, 1f),
new Vector4(0f, 1f, 0f, 1f),
new Vector4(1f, 0f, 0f, 1f),
],
};
private static MapHousePanelController.Callbacks MakeCallbacks(
List<string>? calls = null,
@ -132,7 +145,8 @@ public sealed class MapHousePanelControllerTests
Func<uint>? playerCellId = null,
Func<CreateObject.ServerPosition?>? housePosition = null,
Func<IReadOnlyList<string>>? houseLines = null,
Func<uint, uint, ElementInfo?>? templateInfoResolver = null)
Func<uint, uint, ElementInfo?>? templateInfoResolver = null,
Func<IReadOnlyList<HousePanelLine>>? housePanelLines = null)
{
calls ??= new List<string>();
return new MapHousePanelController.Callbacks(
@ -147,7 +161,8 @@ public sealed class MapHousePanelControllerTests
House: new HousePageController.Bindings(
Lines: houseLines ?? (static () => Array.Empty<string>()),
OnShown: () => calls.Add("house-shown"),
TemplateResolver: FakeHouseRowTemplate));
TemplateResolver: FakeHouseRowTemplate,
PanelLines: housePanelLines));
}
[Fact]
@ -377,4 +392,35 @@ public sealed class MapHousePanelControllerTests
"You may buy another house immediately.",
Assert.Single(row.LinesProvider()).Text);
}
[Fact]
public void Tick_UsesRetailHousePanelColorAsAuthoredPaletteIndex()
{
ElementInfo rootInfo = FixtureLoader.LoadMapHouseHostInfos();
ImportedLayout layout = FixtureLoader.LoadMapHouseHost();
HousePanelLine[] lines =
[
new("paid", HousePanelTextColor.RentPaid),
new("unpaid", HousePanelTextColor.RentNotPaid),
];
MapHousePanelController? controller = MapHousePanelController.Bind(
rootInfo,
layout,
MakeCallbacks(housePanelLines: () => lines));
Assert.NotNull(controller);
controller!.Tick(0.016);
var listBox = Assert.IsType<UiTemplateListBox>(
UiElement.FindDescendant(controller.Root, HousePageController.TextBoxId));
UiScrollablePanel viewport = Assert.IsType<UiScrollablePanel>(
listBox.ViewportForTest);
Assert.Equal(2, viewport.Children.Count);
Assert.Equal(
new Vector4(0f, 1f, 0f, 1f),
Assert.Single(Assert.IsType<UiText>(viewport.Children[0]).LinesProvider()).Color);
Assert.Equal(
new Vector4(1f, 0f, 0f, 1f),
Assert.Single(Assert.IsType<UiText>(viewport.Children[1]).LinesProvider()).Color);
}
}