mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 10:47:22 +09:00
Add tests and clean up inefficient code
This commit is contained in:
parent
5343f6922c
commit
db34fa99b1
@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
};
|
};
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DrumrollTest()
|
public void TestDrumroll()
|
||||||
{
|
{
|
||||||
AddStep("Drum roll", () => SetContents(_ =>
|
AddStep("Drum roll", () => SetContents(_ =>
|
||||||
{
|
{
|
||||||
@ -57,6 +57,14 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDrumrollKiai()
|
||||||
|
{
|
||||||
|
AddStep("Create beatmap", createBeatmap);
|
||||||
|
|
||||||
|
TestDrumroll();
|
||||||
|
}
|
||||||
|
|
||||||
private DrumRoll createDrumRollAtCurrentTime(bool strong = false)
|
private DrumRoll createDrumRollAtCurrentTime(bool strong = false)
|
||||||
{
|
{
|
||||||
var drumroll = new DrumRoll
|
var drumroll = new DrumRoll
|
||||||
@ -73,5 +81,20 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
|
|
||||||
return drumroll;
|
return drumroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createBeatmap()
|
||||||
|
{
|
||||||
|
var controlPointInfo = new ControlPointInfo();
|
||||||
|
|
||||||
|
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
||||||
|
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPointInfo
|
||||||
|
});
|
||||||
|
|
||||||
|
Beatmap.Value.Track.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
// 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 NUnit.Framework;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class TestSceneDrawableDrumRollKiai : TestSceneDrawableDrumRoll
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void SetUp() => Schedule(() =>
|
|
||||||
{
|
|
||||||
var controlPointInfo = new ControlPointInfo();
|
|
||||||
|
|
||||||
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
|
||||||
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
|
||||||
{
|
|
||||||
ControlPointInfo = controlPointInfo
|
|
||||||
});
|
|
||||||
|
|
||||||
// track needs to be playing for BeatSyncedContainer to work.
|
|
||||||
Beatmap.Value.Track.Start();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,17 +4,23 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Tests.Gameplay;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneDrawableHit : TaikoSkinnableTestScene
|
public class TestSceneDrawableHit : TaikoSkinnableTestScene
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
|
private GameplayState gameplayState = TestGameplayState.Create(new TaikoRuleset());
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHits()
|
public void TestHits()
|
||||||
{
|
{
|
||||||
@ -43,6 +49,38 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitKiai()
|
||||||
|
{
|
||||||
|
AddStep("Create beatmap", () => createBeatmap(true));
|
||||||
|
|
||||||
|
TestHits();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitAnimationSlow()
|
||||||
|
{
|
||||||
|
AddStep("Create beatmap", () => createBeatmap(false));
|
||||||
|
|
||||||
|
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
|
||||||
|
|
||||||
|
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 50);
|
||||||
|
|
||||||
|
TestHits();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHitAnimationFast()
|
||||||
|
{
|
||||||
|
AddStep("Create beatmap", () => createBeatmap(false));
|
||||||
|
|
||||||
|
AddStep("Reset combo", () => gameplayState.ScoreProcessor.Combo.Value = 0);
|
||||||
|
|
||||||
|
AddRepeatStep("Increase combo", () => gameplayState.ScoreProcessor.Combo.Value++, 150);
|
||||||
|
|
||||||
|
TestHits();
|
||||||
|
}
|
||||||
|
|
||||||
private Hit createHitAtCurrentTime(bool strong = false, bool rim = false)
|
private Hit createHitAtCurrentTime(bool strong = false, bool rim = false)
|
||||||
{
|
{
|
||||||
var hit = new Hit
|
var hit = new Hit
|
||||||
@ -56,5 +94,22 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createBeatmap(bool includeKiai)
|
||||||
|
{
|
||||||
|
var controlPointInfo = new ControlPointInfo();
|
||||||
|
|
||||||
|
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
|
||||||
|
if (includeKiai)
|
||||||
|
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
||||||
|
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPointInfo
|
||||||
|
});
|
||||||
|
|
||||||
|
Beatmap.Value.Track.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
// 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 NUnit.Framework;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class TestSceneDrawableHitKiai : TestSceneDrawableHit
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void SetUp() => Schedule(() =>
|
|
||||||
{
|
|
||||||
var controlPointInfo = new ControlPointInfo();
|
|
||||||
|
|
||||||
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 500 });
|
|
||||||
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
|
||||||
{
|
|
||||||
ControlPointInfo = controlPointInfo
|
|
||||||
});
|
|
||||||
|
|
||||||
// track needs to be playing for BeatSyncedContainer to work.
|
|
||||||
Beatmap.Value.Track.Start();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user