mirror of
https://github.com/osukey/osukey.git
synced 2025-06-23 12:18:03 +09:00
Add visual test for background dimming
This commit is contained in:
parent
6da9f94ae3
commit
ad9dae975d
1
.idea/.idea.osu/.idea/.name
generated
1
.idea/.idea.osu/.idea/.name
generated
@ -1 +0,0 @@
|
|||||||
osu
|
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework.Internal;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -13,22 +13,25 @@ using osu.Game.Screens.Play;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
|
[TestFixture]
|
||||||
public class TestCaseBackgroundScreenBeatmap : TestCasePlayer
|
public class TestCaseBackgroundScreenBeatmap : TestCasePlayer
|
||||||
{
|
{
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuConfigManager manager)
|
|
||||||
{
|
|
||||||
LoadScreen(new DimAccessiblePlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void EnableUserDimTest()
|
public void EnableUserDimTest()
|
||||||
{
|
{
|
||||||
AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).EnableScreenDim());
|
AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).EnableScreenDim());
|
||||||
|
AddWaitStep(5, "Wait for dim");
|
||||||
AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState());
|
AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DisableUserDimTest()
|
||||||
|
{
|
||||||
|
AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DisableScreenDim());
|
||||||
|
AddWaitStep(5, "Wait for dim");
|
||||||
|
AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertUndimmed());
|
||||||
|
}
|
||||||
|
|
||||||
protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer();
|
protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer();
|
||||||
|
|
||||||
private class DimAccessiblePlayer : Player
|
private class DimAccessiblePlayer : Player
|
||||||
@ -49,17 +52,23 @@ namespace osu.Game.Tests.Visual
|
|||||||
return ((FadeAccessibleBackground)Background).AssertDimState();
|
return ((FadeAccessibleBackground)Background).AssertDimState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AssertUndimmed()
|
||||||
|
{
|
||||||
|
return ((FadeAccessibleBackground)Background).AssertUndimmed();
|
||||||
|
}
|
||||||
|
|
||||||
private class FadeAccessibleBackground : BackgroundScreenBeatmap
|
private class FadeAccessibleBackground : BackgroundScreenBeatmap
|
||||||
{
|
{
|
||||||
public bool AssertDimState()
|
public bool AssertDimState()
|
||||||
{
|
{
|
||||||
return FadeContainer.Colour == OsuColour.Gray(BackgroundOpacity);
|
return FadeContainer.Colour == OsuColour.Gray(BackgroundOpacity);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class SetupAttribute : Attribute
|
public bool AssertUndimmed()
|
||||||
{
|
{
|
||||||
|
return FadeContainer.Colour == OsuColour.Gray(1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user