mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Revert "Group all skinnable test scenes to one TestSceneSkinnableHUDComponents
"
This reverts commit d1272d5e13
.
This commit is contained in:
parent
02d18c7a49
commit
cd8e3f3a04
35
osu.Game.Tests/Visual/Gameplay/TestSceneComboCounter.cs
Normal file
35
osu.Game.Tests/Visual/Gameplay/TestSceneComboCounter.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// 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.Framework.Allocation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneComboCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create combo counters", () => SetContents(() => new SkinnableDrawable(new HUDSkinComponent(HUDSkinComponents.ComboCounter))));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestComboCounterIncrementing()
|
||||||
|
{
|
||||||
|
AddRepeatStep("increase combo", () => scoreProcessor.Combo.Value++, 10);
|
||||||
|
|
||||||
|
AddStep("reset combo", () => scoreProcessor.Combo.Value = 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
// 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.Framework.Allocation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableAccuracyCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Set initial accuracy", () => scoreProcessor.Accuracy.Value = 1);
|
||||||
|
AddStep("Create accuracy counters", () => SetContents(() => new SkinnableDrawable(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter))));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangingAccuracy()
|
||||||
|
{
|
||||||
|
AddStep(@"Reset all", () => scoreProcessor.Accuracy.Value = 1);
|
||||||
|
|
||||||
|
AddStep(@"Miss :(", () => scoreProcessor.Accuracy.Value -= 0.023);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,76 +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.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
|
||||||
{
|
|
||||||
public class TestSceneSkinnableHUDComponents : SkinnableTestScene
|
|
||||||
{
|
|
||||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
|
||||||
|
|
||||||
[Cached(typeof(HealthProcessor))]
|
|
||||||
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
SetContents(() => new SkinnableTargetContainer(SkinnableTarget.MainHUDComponents)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestScoreCounter()
|
|
||||||
{
|
|
||||||
AddStep(@"reset total score", () => scoreProcessor.TotalScore.Value = 0);
|
|
||||||
AddStep(@"increment total score", () => scoreProcessor.TotalScore.Value += 300);
|
|
||||||
AddStep(@"set large score", () => scoreProcessor.TotalScore.Value = 1_000_000_000);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestComboCounter()
|
|
||||||
{
|
|
||||||
AddStep(@"reset combo", () => scoreProcessor.Combo.Value = 0);
|
|
||||||
AddRepeatStep(@"increase combo", () => scoreProcessor.Combo.Value++, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestAccuracyCounter()
|
|
||||||
{
|
|
||||||
AddStep(@"reset accuracy", () => scoreProcessor.Accuracy.Value = 1);
|
|
||||||
AddStep(@"decrease accuracy", () => scoreProcessor.Accuracy.Value -= 0.023);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestHealthDisplay()
|
|
||||||
{
|
|
||||||
AddStep(@"reset health", () => healthProcessor.Health.Value = 1);
|
|
||||||
AddRepeatStep(@"decrease hp", () => healthProcessor.Health.Value -= 0.08f, 10);
|
|
||||||
AddRepeatStep(@"decrease hp without flash", () => healthProcessor.Health.Value += 0.1f, 3);
|
|
||||||
AddRepeatStep(@"increase hp with flash", () =>
|
|
||||||
{
|
|
||||||
healthProcessor.Health.Value += 0.1f;
|
|
||||||
healthProcessor.ApplyResult(new JudgementResult(new HitCircle(), new OsuJudgement())
|
|
||||||
{
|
|
||||||
Type = HitResult.Perfect
|
|
||||||
});
|
|
||||||
}, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,57 @@
|
|||||||
|
// 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.Framework.Allocation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableHealthDisplay : SkinnableTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Cached(typeof(HealthProcessor))]
|
||||||
|
private HealthProcessor healthProcessor = new DrainingHealthProcessor(0);
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create health displays", () => SetContents(() => new SkinnableDrawable(new HUDSkinComponent(HUDSkinComponents.HealthDisplay))));
|
||||||
|
AddStep(@"Reset all", delegate
|
||||||
|
{
|
||||||
|
healthProcessor.Health.Value = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHealthDisplayIncrementing()
|
||||||
|
{
|
||||||
|
AddRepeatStep(@"decrease hp", delegate
|
||||||
|
{
|
||||||
|
healthProcessor.Health.Value -= 0.08f;
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddRepeatStep(@"increase hp without flash", delegate
|
||||||
|
{
|
||||||
|
healthProcessor.Health.Value += 0.1f;
|
||||||
|
}, 3);
|
||||||
|
|
||||||
|
AddRepeatStep(@"increase hp with flash", delegate
|
||||||
|
{
|
||||||
|
healthProcessor.Health.Value += 0.1f;
|
||||||
|
healthProcessor.ApplyResult(new JudgementResult(new HitCircle(), new OsuJudgement())
|
||||||
|
{
|
||||||
|
Type = HitResult.Perfect
|
||||||
|
});
|
||||||
|
}, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
// 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.Framework.Allocation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableScoreCounter : SkinnableTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||||
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
|
{
|
||||||
|
AddStep("Create score counters", () => SetContents(() => new SkinnableDrawable(new HUDSkinComponent(HUDSkinComponents.ScoreCounter))));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestScoreCounterIncrementing()
|
||||||
|
{
|
||||||
|
AddStep(@"Reset all", () => scoreProcessor.TotalScore.Value = 0);
|
||||||
|
|
||||||
|
AddStep(@"Hit! :D", () => scoreProcessor.TotalScore.Value += 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestVeryLargeScore()
|
||||||
|
{
|
||||||
|
AddStep("set large score", () => scoreProcessor.TotalScore.Value = 1_000_000_000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user