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()
|
|
|
|
{
|
2024-03-08 20:48:16 +00:00
|
|
|
var logo = new Logo();
|
|
|
|
logo.SetPadding(Level.Normal);
|
|
|
|
logo.SetAlignment(Vertical.Center);
|
|
|
|
logo.SetAlignment(Horizontal.Center);
|
2024-03-06 21:49:54 +00:00
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
logo.Padding.Top.Should().Be(Level.Normal);
|
|
|
|
logo.Padding.Left.Should().Be(Level.Normal);
|
|
|
|
logo.Padding.Bottom.Should().Be(Level.Normal);
|
|
|
|
logo.Padding.Right.Should().Be(Level.Normal);
|
|
|
|
logo.Alignment.Horizontal.Should().Be(Horizontal.Center);
|
|
|
|
logo.Alignment.Vertical.Should().Be(Vertical.Center);
|
2024-03-06 21:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void WhenSetPaddingsSaveAllChange()
|
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
component.SetPadding(Level.Normal);
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
[InlineData(Vertical.Bottom)]
|
|
|
|
[InlineData(Vertical.Center)]
|
|
|
|
[InlineData(Vertical.Top)]
|
|
|
|
public void WhenSetVerticalAlignSaveAllChange(Vertical alignment)
|
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
component.SetAlignment(alignment);
|
2024-03-06 21:49:54 +00:00
|
|
|
|
|
|
|
component.Alignment.Vertical.Should().Be(alignment);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Theory]
|
2024-03-08 20:48:16 +00:00
|
|
|
[InlineData(Horizontal.Left)]
|
|
|
|
[InlineData(Horizontal.Center)]
|
|
|
|
[InlineData(Horizontal.Right)]
|
|
|
|
public void WhenSetHorizontalAlignSaveAllChange(Horizontal alignment)
|
2024-03-06 21:49:54 +00:00
|
|
|
{
|
|
|
|
var component = new Logo();
|
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
component.SetAlignment(alignment);
|
2024-03-06 21:49:54 +00:00
|
|
|
|
2024-03-08 20:48:16 +00:00
|
|
|
component.Alignment.Horizontal.Should().Be(alignment);
|
2024-03-06 21:49:54 +00:00
|
|
|
}
|
|
|
|
}
|