fix(ui): preserve cropped chat and button faces

This commit is contained in:
Erik 2026-07-10 18:11:14 +02:00
parent d825572e31
commit accacecafe
7 changed files with 168 additions and 8 deletions

View file

@ -129,4 +129,50 @@ public sealed class UiLayoutPolicyTests
Assert.Equal(400f, element.Width);
Assert.Equal(200f, element.Height);
}
[Fact]
public void ResetAnchorCapture_RebasesImportedPolicyAfterControllerResize()
{
var parent = new UiPanel { Width = 490, Height = 17 };
var child = new UiPanel
{
Left = 0,
Top = 0,
Width = 46,
Height = 17,
LayoutPolicy = new UiLayoutPolicy(
1, 1, 2, 1,
UiPixelRect.FromPositionAndSize(0, 0, 46, 17),
UiPixelRect.FromPositionAndSize(0, 0, 490, 17)),
};
parent.AddChild(child);
child.Width = 72;
child.ResetAnchorCapture();
child.ApplyAnchor(parent.Width, parent.Height);
Assert.Equal(72f, child.Width);
}
[Fact]
public void RebaseChildLayoutBaselines_CroppedChatRegionThenGrowsWithFrame()
{
var root = new UiPanel { Width = 490, Height = 100 };
var transcriptPanel = new UiPanel
{
Width = 490,
Height = 83,
LayoutPolicy = new UiLayoutPolicy(
1, 1, 1, 1,
UiPixelRect.FromPositionAndSize(0, 0, 490, 83),
UiPixelRect.FromPositionAndSize(0, 0, 800, 100)),
};
root.AddChild(transcriptPanel);
root.RebaseChildLayoutBaselines();
root.Width = 615;
transcriptPanel.ApplyAnchor(root.Width, root.Height);
Assert.Equal(615f, transcriptPanel.Width);
}
}