mirror of
https://github.com/ppy/osu
synced 2025-01-23 22:33:05 +00:00
Add test
This commit is contained in:
parent
944835da23
commit
6149482b5d
@ -0,0 +1,70 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestCaseFooterButtonMods : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(FooterButtonMods)
|
||||
};
|
||||
|
||||
private readonly TestFooterButtonMods footerButtonMods;
|
||||
|
||||
public TestCaseFooterButtonMods()
|
||||
{
|
||||
Add(footerButtonMods = new TestFooterButtonMods());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIncrementMultiplier()
|
||||
{
|
||||
AddStep(@"Add Hidden", () => changeMods(new Mod[] { new OsuModHidden() }));
|
||||
AddAssert(@"Check Hidden multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"1.06x"));
|
||||
AddStep(@"Add HardRock", () => changeMods(new Mod[] { new OsuModHidden() }));
|
||||
AddAssert(@"Check HardRock multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"1.06x"));
|
||||
AddStep(@"Add DoubleTime", () => changeMods(new Mod[] { new OsuModDoubleTime() }));
|
||||
AddAssert(@"Check DoubleTime multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"1.12x"));
|
||||
AddStep(@"Add multiple Mods", () => changeMods(new Mod[] { new OsuModDoubleTime(), new OsuModHidden(), new OsuModHidden() }));
|
||||
AddAssert(@"Check multiple mod multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"1.26x"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecrementMultiplier()
|
||||
{
|
||||
AddStep(@"Add Easy", () => changeMods(new Mod[] { new OsuModEasy() }));
|
||||
AddAssert(@"Check Easy multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"0.50x"));
|
||||
AddStep(@"Add NoFail", () => changeMods(new Mod[] { new OsuModNoFail() }));
|
||||
AddAssert(@"Check NoFail multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"0.50x"));
|
||||
AddStep(@"Add Multiple Mods", () => changeMods(new Mod[] { new OsuModEasy(), new OsuModNoFail() }));
|
||||
AddAssert(@"Check multiple mod multiplier", () => footerButtonMods.MultiplierText.Text.Equals(@"0.25x"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClearMultiplier()
|
||||
{
|
||||
AddStep(@"Add mods", () => changeMods(new Mod[] { new OsuModDoubleTime(), new OsuModFlashlight() }));
|
||||
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
|
||||
AddAssert(@"Check empty multiplier", () => footerButtonMods.MultiplierText.Text.Equals(string.Empty));
|
||||
}
|
||||
|
||||
private void changeMods(IReadOnlyList<Mod> mods)
|
||||
{
|
||||
footerButtonMods.Current.Value = mods;
|
||||
}
|
||||
|
||||
private class TestFooterButtonMods : FooterButtonMods
|
||||
{
|
||||
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user