2017-01-27 17:24:49 +08:00
|
|
|
|
using System;
|
2017-01-27 18:19:52 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2017-01-27 19:11:22 +08:00
|
|
|
|
using osu.Framework.Logging;
|
2017-01-27 17:24:49 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Overlays.Pause;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-01-27 18:19:52 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.GameModes.Testing;
|
2017-01-27 19:11:22 +08:00
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
|
|
2017-01-27 17:24:49 +08:00
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
|
{
|
|
|
|
|
class TestCasePauseOverlay : TestCase
|
|
|
|
|
{
|
|
|
|
|
public override string Name => @"PauseOverlay";
|
|
|
|
|
|
|
|
|
|
public override string Description => @"Tests the pause overlay";
|
|
|
|
|
|
|
|
|
|
private PauseOverlay pauseOverlay;
|
2017-01-30 16:08:14 +08:00
|
|
|
|
private int retryCount;
|
2017-01-27 17:24:49 +08:00
|
|
|
|
|
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-01-27 18:19:52 +08:00
|
|
|
|
Add(new Box
|
|
|
|
|
{
|
|
|
|
|
ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke),
|
2017-01-30 16:08:14 +08:00
|
|
|
|
RelativeSizeAxes = Framework.Graphics.Axes.Both
|
2017-01-27 18:19:52 +08:00
|
|
|
|
});
|
2017-01-30 16:08:14 +08:00
|
|
|
|
|
2017-01-29 08:30:37 +08:00
|
|
|
|
Add(pauseOverlay = new PauseOverlay { Depth = -1 });
|
2017-01-30 16:08:14 +08:00
|
|
|
|
pauseOverlay.OnResume += (() => Logger.Log(@"Resume"));
|
|
|
|
|
pauseOverlay.OnRetry += (() => Logger.Log(@"Retry"));
|
|
|
|
|
pauseOverlay.OnQuit += (() => Logger.Log(@"Quit"));
|
2017-01-27 18:19:52 +08:00
|
|
|
|
|
2017-01-30 16:08:14 +08:00
|
|
|
|
Add(new FlowContainer
|
2017-01-27 19:12:20 +08:00
|
|
|
|
{
|
2017-01-30 16:08:14 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-01-27 19:11:22 +08:00
|
|
|
|
Origin = Anchor.TopLeft,
|
2017-01-30 16:08:14 +08:00
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Direction = FlowDirection.VerticalOnly,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Button
|
|
|
|
|
{
|
|
|
|
|
Text = @"Pause",
|
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
|
Width = 100,
|
|
|
|
|
Height = 50,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Action = (() => pauseOverlay.Show())
|
|
|
|
|
},
|
|
|
|
|
new Button
|
|
|
|
|
{
|
|
|
|
|
Text = @"Add Retry",
|
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
|
Width = 100,
|
|
|
|
|
Height = 50,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Action = (delegate {
|
|
|
|
|
retryCount++;
|
|
|
|
|
pauseOverlay.SetRetries(retryCount);
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-28 03:28:39 +08:00
|
|
|
|
});
|
2017-01-27 19:11:22 +08:00
|
|
|
|
}
|
2017-01-27 17:24:49 +08:00
|
|
|
|
}
|
2017-01-27 17:39:15 +08:00
|
|
|
|
}
|