mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:52:55 +08:00
add tests
This commit is contained in:
parent
7864899249
commit
6c1ae3bc8a
@ -165,6 +165,21 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensure <see cref="UserDimContainer"/> is able to disable user-defined display settings.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void DisableUserDisplaySettingsTest()
|
||||||
|
{
|
||||||
|
performFullSetup();
|
||||||
|
AddStep("Enable user dim", () => player.DimmableStoryboard.EnableUserDim.Value = true);
|
||||||
|
AddStep("Set user dim to max", () => player.DimmableStoryboard.)
|
||||||
|
waitForDim();
|
||||||
|
AddStep("Turn on IgnoreUserSettings", () => player.DimmableStoryboard.IgnoreUserSettings.Value = true);
|
||||||
|
waitForDim();
|
||||||
|
AddAssert("Check the background is undimmed", () => player.IsBackgroundUndimmed());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensure <see cref="UserDimContainer"/> is properly accepting user-defined visual changes for a storyboard.
|
/// Ensure <see cref="UserDimContainer"/> is properly accepting user-defined visual changes for a storyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -352,6 +367,8 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
|
|
||||||
public new DimmableStoryboard DimmableStoryboard => base.DimmableStoryboard;
|
public new DimmableStoryboard DimmableStoryboard => base.DimmableStoryboard;
|
||||||
|
|
||||||
|
public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).Colour == Color4.White;
|
||||||
|
|
||||||
// Whether or not the player should be allowed to load.
|
// Whether or not the player should be allowed to load.
|
||||||
public bool BlockLoad;
|
public bool BlockLoad;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -22,7 +23,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>(true);
|
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>(true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not user-configured settings relating to visibility of elements should be ignored
|
/// Whether or not user-configured settings relating to brightness of elements should be ignored
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
|
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
|
||||||
|
|
||||||
@ -36,14 +37,14 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ContentDisplayed { get; private set; }
|
public bool ContentDisplayed { get; private set; }
|
||||||
|
|
||||||
|
public double DimLevel => EnableUserDim.Value && !IgnoreUserSettings.Value ? UserDimLevel.Value : 0;
|
||||||
|
|
||||||
protected Bindable<double> UserDimLevel { get; private set; }
|
protected Bindable<double> UserDimLevel { get; private set; }
|
||||||
|
|
||||||
protected Bindable<bool> ShowStoryboard { get; private set; }
|
protected Bindable<bool> ShowStoryboard { get; private set; }
|
||||||
|
|
||||||
protected Bindable<bool> ShowVideo { get; private set; }
|
protected Bindable<bool> ShowVideo { get; private set; }
|
||||||
|
|
||||||
protected double DimLevel => EnableUserDim.Value ? UserDimLevel.Value : 0;
|
|
||||||
|
|
||||||
protected override Container<Drawable> Content => dimContent;
|
protected override Container<Drawable> Content => dimContent;
|
||||||
|
|
||||||
private Container dimContent { get; }
|
private Container dimContent { get; }
|
||||||
@ -90,7 +91,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
ContentDisplayed = ShowDimContent;
|
ContentDisplayed = ShowDimContent;
|
||||||
|
|
||||||
dimContent.FadeTo(ContentDisplayed ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
dimContent.FadeTo(ContentDisplayed ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
dimContent.FadeColour(OsuColour.Gray(1 - (float)DimLevel), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
dimContent.FadeColour(IgnoreUserSettings.Value ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user