Files
RobustToolbox/Robust.UnitTesting/Client/UserInterface/Controls/CenterContainerTest.cs
T
Pieter-Jan BriersandGitHub cb5f2ffae1 Refactor UI system. (#843)
* Refactor UI system.

Deferred updating is used for styling & layout. This fixes the awful time complexity of containers.
Removed SetDefaults and Initialize. They were a bad idea alright.

* Fix build on .NET Framework.
2019-08-14 22:03:51 +02:00

35 lines
1.1 KiB
C#

using NUnit.Framework;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
using Robust.Shared.Interfaces.Resources;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
using Robust.Shared.Maths;
namespace Robust.UnitTesting.Client.UserInterface.Controls
{
[TestFixture]
[TestOf(typeof(CenterContainer))]
public class CenterContainerTest : RobustUnitTest
{
public override UnitTestProject Project => UnitTestProject.Client;
[Test]
public void Test()
{
var container = new CenterContainer {Size = (100, 100)};
var child = new Control {CustomMinimumSize = (50, 50)};
container.AddChild(child);
container.ForceRunLayoutUpdate();
Assert.That(container.CombinedMinimumSize, Is.EqualTo(new Vector2(50, 50)));
Assert.That(child.Position, Is.EqualTo(new Vector2(25, 25)));
Assert.That(child.Size, Is.EqualTo(new Vector2(50, 50)));
}
}
}