fix(ui): match spellbook frame and tab alignment
This commit is contained in:
parent
16eb4844c1
commit
1249ad03de
5 changed files with 116 additions and 7 deletions
|
|
@ -48,6 +48,9 @@ public sealed class SpellbookWindowControllerTests
|
|||
|
||||
Assert.Equal("Spellbook", Assert.Single(spellTab.LinesProvider()).Text);
|
||||
Assert.Equal("Components", Assert.Single(componentTab.LinesProvider()).Text);
|
||||
Assert.False(spellTab.OneLine);
|
||||
Assert.True(spellTab.Centered);
|
||||
Assert.Equal(VJustify.Center, spellTab.VerticalJustify);
|
||||
Assert.True(spellTab.DrawTextAfterChildren);
|
||||
Assert.True(componentTab.DrawTextAfterChildren);
|
||||
|
||||
|
|
|
|||
|
|
@ -227,4 +227,54 @@ public class UiTextTests
|
|||
Assert.Equal(yNoPad, yWithPad); // Center is padding-independent
|
||||
Assert.Equal((40f - 12f) * 0.5f, yNoPad);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(VJustify.Top, 0f)]
|
||||
[InlineData(VJustify.Center, 4.5f)]
|
||||
[InlineData(VJustify.Bottom, 9f)]
|
||||
public void ContentBaseY_FittingAuthoredText_UsesRetailVerticalJustification(
|
||||
VJustify justification,
|
||||
float expected)
|
||||
{
|
||||
float y = UiText.ContentBaseY(
|
||||
top: 0f,
|
||||
bottom: 25f,
|
||||
contentHeight: 16f,
|
||||
maxScroll: 0f,
|
||||
scrollY: 0f,
|
||||
justification,
|
||||
honorJustification: true);
|
||||
|
||||
Assert.Equal(expected, y);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContentBaseY_OverflowingAuthoredText_PreservesScrollPosition()
|
||||
{
|
||||
float y = UiText.ContentBaseY(
|
||||
top: 0f,
|
||||
bottom: 25f,
|
||||
contentHeight: 64f,
|
||||
maxScroll: 39f,
|
||||
scrollY: 12f,
|
||||
VJustify.Center,
|
||||
honorJustification: true);
|
||||
|
||||
Assert.Equal(-12f, y);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContentBaseY_SynthesizedText_RetainsBottomPinWhenContentFits()
|
||||
{
|
||||
float y = UiText.ContentBaseY(
|
||||
top: 0f,
|
||||
bottom: 25f,
|
||||
contentHeight: 16f,
|
||||
maxScroll: 0f,
|
||||
scrollY: 0f,
|
||||
VJustify.Center,
|
||||
honorJustification: false);
|
||||
|
||||
Assert.Equal(9f, y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue