Add test for checking exception

This commit is contained in:
David Zhao 2019-04-05 15:05:11 +09:00
parent b1d74e57e5
commit 5fa93f4a05
2 changed files with 18 additions and 5 deletions

View File

@ -186,7 +186,17 @@ namespace osu.Game.Tests.Visual.UserInterface
public void SetFacadeSizeTest()
{
AddStep("Add tracking containers", addFacadeContainers);
AddStep("Break shit", () => { logoFacade.Size = new Vector2(0, 0); });
AddStep("Break stuff", () => { logoFacade.Size = new Vector2(0, 0); });
}
[Test]
public void SetMultipleContainers()
{
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("Break stuff", () => newContainer.Tracking = true);
}
private void addFacadeContainers()

View File

@ -12,7 +12,7 @@ using osuTK;
namespace osu.Game.Graphics.Containers
{
/// <summary>
/// A container that handles tracking of an <see cref="OsuLogo"/> through different layout scenarios
/// A container that handles tracking of an <see cref="OsuLogo"/> through different layout scenarios.
/// </summary>
public class LogoTrackingContainer : Container
{
@ -38,8 +38,6 @@ namespace osu.Game.Graphics.Containers
}
}
private bool tracking;
protected OsuLogo Logo;
private float facadeScale;
@ -47,6 +45,7 @@ namespace osu.Game.Graphics.Containers
private Vector2? startPosition;
private double? startTime;
private double duration;
private bool tracking;
public LogoTrackingContainer()
{
@ -69,7 +68,11 @@ namespace osu.Game.Graphics.Containers
}
Logo = logo ?? throw new ArgumentNullException(nameof(logo));
Logo.IsTracking = Tracking;
if (Tracking)
{
Logo.IsTracking = true;
}
this.facadeScale = facadeScale;
this.duration = duration;