2024-03-06 21:49:54 +00:00
|
|
|
using FluentAssertions;
|
|
|
|
using TUI.Components.Controls.Statics;
|
|
|
|
using TUI.Engine.Nodes.Attributes.Alignments;
|
|
|
|
using TUI.Engine.Theme;
|
|
|
|
|
|
|
|
namespace Widgets.Tests;
|
|
|
|
|
|
|
|
public class ComponentBaseTests
|
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
public void WhenUseChainingSaveAllChange()
|
|
|
|
{
|
|
|
|
var component = new Logo()
|
|
|
|
.Set(Level.Normal)
|
2024-03-08 08:24:47 +00:00
|
|
|
.Set(vertical: Vertical.Center, alignmentHorizontal: AlignmentHorizontal.Center);
|
2024-03-06 21:49:54 +00:00
|
|
|
|
|
|
|
component.Padding.Top.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Left.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Bottom.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Right.Should().Be(Level.Normal);
|
2024-03-08 08:24:47 +00:00
|
|
|
component.Alignment.AlignmentHorizontal.Should().Be(AlignmentHorizontal.Center);
|
2024-03-06 21:49:54 +00:00
|
|
|
component.Alignment.Vertical.Should().Be(Vertical.Center);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void WhenSetPaddingsSaveAllChange()
|
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
|
|
|
component.Set(Level.Normal);
|
|
|
|
|
|
|
|
component.Padding.Top.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Left.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Bottom.Should().Be(Level.Normal);
|
|
|
|
component.Padding.Right.Should().Be(Level.Normal);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
[InlineData(Vertical.Bottom)]
|
|
|
|
[InlineData(Vertical.Center)]
|
|
|
|
[InlineData(Vertical.Top)]
|
|
|
|
public void WhenSetVerticalAlignSaveAllChange(Vertical alignment)
|
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
|
|
|
component.Set(vertical: alignment);
|
|
|
|
|
|
|
|
component.Alignment.Vertical.Should().Be(alignment);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Theory]
|
2024-03-08 08:24:47 +00:00
|
|
|
[InlineData(AlignmentHorizontal.Left)]
|
|
|
|
[InlineData(AlignmentHorizontal.Center)]
|
|
|
|
[InlineData(AlignmentHorizontal.Right)]
|
|
|
|
public void WhenSetHorizontalAlignSaveAllChange(AlignmentHorizontal alignment)
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
2024-03-08 08:24:47 +00:00
|
|
|
component.Set(alignmentHorizontal: alignment);
|
2024-03-06 21:49:54 +00:00
|
|
|
|
2024-03-08 08:24:47 +00:00
|
|
|
component.Alignment.AlignmentHorizontal.Should().Be(alignment);
|
2024-03-06 21:49:54 +00:00
|
|
|
}
|
2024-03-08 08:24:47 +00:00
|
|
|
|
2024-03-06 21:49:54 +00:00
|
|
|
}
|