1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Add back exception tests with better descriptions

This commit is contained in:
David Zhao 2019-04-05 15:30:09 +09:00
parent e06fe7950b
commit 37ffe47e4b

View File

@ -182,6 +182,49 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("Logo is tracking", () => trackingContainer.IsLogoTracking);
}
[Test]
public void SetFacadeSizeTest()
{
bool failed = false;
AddStep("Add tracking containers", addFacadeContainers);
AddStep("Try setting facade size", () =>
{
try
{
logoFacade.Size = new Vector2(0, 0);
}
catch (Exception e)
{
if (e is InvalidOperationException)
failed = true;
}
});
AddAssert("Exception thrown", () => failed);
}
[Test]
public void SetMultipleContainers()
{
bool failed = false;
LogoTrackingContainer newContainer = new LogoTrackingContainer();
AddStep("Add tracking containers", addFacadeContainers);
AddStep("Move facade to random position", startTrackingRandom);
AddStep("Add logo to new container", () => newContainer.SetLogo(logo));
AddStep("Try tracking new container", () =>
{
try
{
newContainer.Tracking = true;
}
catch (Exception e)
{
if (e is InvalidOperationException)
failed = true;
}
});
AddAssert("Exception thrown", () => failed);
}
private void addFacadeContainers()
{
AddRange(new Drawable[]