Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rate adjustment settings for all time mods (DT/HT/NC/DC/WU/WD) #7121

Merged
merged 23 commits into from
Dec 13, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e375268
Merge remote-tracking branch 'upstream/master' into adjustable-double…
peppy Dec 9, 2019
0c7e5a2
Add bindable adjustments for DT/HT rate
peppy Dec 6, 2019
ba538cf
Merge branch 'apply-to-track' into adjustable-double-time
peppy Dec 9, 2019
9fa745a
Merge branch 'apply-to-track' into adjustable-rate-mods
peppy Dec 9, 2019
6b667da
Update bindable types in line with framework
peppy Dec 9, 2019
7fd52c2
Update mods and user adjust to use adjustments
peppy Dec 9, 2019
edc8220
Add time ramp settings
peppy Dec 9, 2019
12bdb1d
Pin DC/NC pitch
peppy Dec 9, 2019
9eed649
Merge branch 'customized-mods' into adjustable-rate-mods
peppy Dec 11, 2019
b77f950
Merge branch 'master' into adjustable-rate-mods
smoogipoo Dec 11, 2019
404d320
Refactor ModNightcore/ModDaycore
smoogipoo Dec 11, 2019
c34b6b5
Remove time ramp and rate adjust mod incompatibility
smoogipoo Dec 11, 2019
40f918d
Remove unused using
smoogipoo Dec 11, 2019
9961fa7
Merge branch 'master' into adjustable-rate-mods
peppy Dec 12, 2019
4c41992
Use protected constructors
peppy Dec 12, 2019
a0792f8
Re-jig mod select logic to reduce event fires
peppy Dec 12, 2019
c4bc574
Fix test logic and add regression test
peppy Dec 12, 2019
bd3fe23
Merge branch 'fix-mod-retention' into adjustable-rate-mods
peppy Dec 12, 2019
623ab1e
Update time ramp preview on setting change
peppy Dec 12, 2019
af15662
Fix WindUp applying too much change
peppy Dec 12, 2019
72ea871
Make constructor protected
smoogipoo Dec 12, 2019
59538bf
Merge branch 'global-available-mods' into adjustable-rate-mods
peppy Dec 13, 2019
bc397a4
Merge branch 'master' into adjustable-rate-mods
peppy Dec 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test logic and add regression test
  • Loading branch information
peppy committed Dec 12, 2019
commit c4bc57484fdee19279ac616d690891494d67e0a4
84 changes: 62 additions & 22 deletions osu.Game.Tests/Visual/UserInterface/TestSceneModSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,72 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;

namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneModSettings : OsuTestScene
{
private TestModSelectOverlay modSelect;

[BackgroundDependencyLoader]
private void load()
{
Add(modSelect = new TestModSelectOverlay
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
});
Mod testCustomisableMod = new TestModCustomisable1();

var testMod = new TestModCustomisable1();
[Test]
public void TestButtonShowsOnCustomisableMod()
{
createModSelect();

AddStep("open", modSelect.Show);
AddStep("open", () => modSelect.Show());
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
AddStep("select mod", () => modSelect.SelectMod(testMod));
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
AddStep("open Customisation", () => modSelect.CustomiseButton.Click());
AddStep("deselect mod", () => modSelect.SelectMod(testMod));
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableMod));
AddAssert("controls hidden", () => modSelect.ModSettingsContainer.Alpha == 0);
}

[Test]
public void TestButtonShowsOnModAlreadyAdded()
{
AddStep("set active mods", () => Mods.Value = new List<Mod> { testCustomisableMod });

createModSelect();

AddAssert("mods still active", () => Mods.Value.Count == 1);

AddStep("open", () => modSelect.Show());
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
}

private void createModSelect()
{
AddStep("create mod select", () =>
{
Ruleset.Value = new TestRulesetInfo();

Child = modSelect = new TestModSelectOverlay
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
};
});
}

private class TestModSelectOverlay : ModSelectOverlay
{
public new Container ModSettingsContainer => base.ModSettingsContainer;
Expand All @@ -50,24 +78,36 @@ private class TestModSelectOverlay : ModSelectOverlay
public void SelectMod(Mod mod) =>
ModSectionsContainer.Children.Single(s => s.ModType == mod.Type)
.ButtonsContainer.OfType<ModButton>().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType())).SelectNext(1);
}

protected override void LoadComplete()
{
base.LoadComplete();
public class TestRulesetInfo : RulesetInfo
{
public override Ruleset CreateInstance() => new TestCustomisableModRuleset();

foreach (var section in ModSectionsContainer)
public class TestCustomisableModRuleset : Ruleset
{
public override IEnumerable<Mod> GetModsFor(ModType type)
{
if (section.ModType == ModType.Conversion)
if (type == ModType.Conversion)
{
section.Mods = new Mod[]
return new Mod[]
{
new TestModCustomisable1(),
new TestModCustomisable2()
};
}
else
section.Mods = Array.Empty<Mod>();

return Array.Empty<Mod>();
}

public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => throw new NotImplementedException();

public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException();

public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new NotImplementedException();

public override string Description { get; }
public override string ShortName { get; }
}
}

Expand Down