2021-08-01 17:12:43 +00:00
|
|
|
// 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.Linq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|
|
|
{
|
|
|
|
public partial class TestSceneOsuModMuted : OsuModTestScene
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Ensures that a final volume combo of 0 (i.e. "always muted" mode) constantly plays metronome and completely mutes track.
|
|
|
|
/// </summary>
|
2021-08-03 09:49:37 +00:00
|
|
|
[Test]
|
|
|
|
public void TestZeroFinalCombo() => CreateModTest(new ModTestData
|
2021-08-01 17:12:43 +00:00
|
|
|
{
|
|
|
|
Mod = new OsuModMuted
|
|
|
|
{
|
|
|
|
MuteComboCount = { Value = 0 },
|
|
|
|
},
|
2021-08-03 09:49:37 +00:00
|
|
|
PassCondition = () => Beatmap.Value.Track.AggregateVolume.Value == 0.0 &&
|
2022-05-20 08:12:35 +00:00
|
|
|
Player.ChildrenOfType<MetronomeBeat>().SingleOrDefault()?.AggregateVolume.Value == 1.0,
|
2021-08-01 17:12:43 +00:00
|
|
|
});
|
2021-08-03 09:50:54 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Ensures that copying from a normal mod with 0 final combo while originally inversed does not yield incorrect results.
|
|
|
|
/// </summary>
|
|
|
|
[Test]
|
|
|
|
public void TestModCopy()
|
|
|
|
{
|
2022-07-20 12:34:55 +00:00
|
|
|
OsuModMuted muted = null!;
|
2021-08-03 09:50:54 +00:00
|
|
|
|
|
|
|
AddStep("create inversed mod", () => muted = new OsuModMuted
|
|
|
|
{
|
|
|
|
MuteComboCount = { Value = 100 },
|
|
|
|
InverseMuting = { Value = true },
|
|
|
|
});
|
|
|
|
|
|
|
|
AddStep("copy from normal", () => muted.CopyFrom(new OsuModMuted
|
|
|
|
{
|
|
|
|
MuteComboCount = { Value = 0 },
|
|
|
|
InverseMuting = { Value = false },
|
|
|
|
}));
|
|
|
|
|
2022-11-24 16:15:11 +00:00
|
|
|
AddAssert("mute combo count copied", () => muted.MuteComboCount.Value, () => Is.EqualTo(0));
|
|
|
|
AddAssert("inverse muting copied", () => muted.InverseMuting.Value, () => Is.False);
|
2021-08-03 09:50:54 +00:00
|
|
|
}
|
2021-08-01 17:12:43 +00:00
|
|
|
}
|
|
|
|
}
|