-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92854d6
commit faecef9
Showing
4 changed files
with
121 additions
and
7 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
osu.Game.Rulesets.Karaoke.Tests/Ranking/TestKaraokeScoreInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using osu.Game.Rulesets.Karaoke.Mods; | ||
using osu.Game.Rulesets.Karaoke.Tests.Beatmaps; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Scoring; | ||
using osu.Game.Users; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Ranking | ||
{ | ||
public class TestKaraokeScoreInfo : ScoreInfo | ||
{ | ||
public TestKaraokeScoreInfo() | ||
{ | ||
var ruleset = new KaraokeRuleset().RulesetInfo; | ||
|
||
User = new User | ||
{ | ||
Id = 11111, | ||
Username = "andy840119", | ||
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", | ||
}; | ||
|
||
Beatmap = new TestKaraokeBeatmap(ruleset).BeatmapInfo; | ||
Ruleset = ruleset; | ||
RulesetID = ruleset.ID ?? 0; | ||
Mods = new Mod[] { new KaraokeModFlashlight(), new KaraokeModSnow() }; | ||
|
||
TotalScore = 2845370; | ||
Accuracy = 0.95; | ||
MaxCombo = 999; | ||
Rank = ScoreRank.S; | ||
Date = DateTimeOffset.Now; | ||
|
||
Statistics[HitResult.Miss] = 1; | ||
Statistics[HitResult.Meh] = 50; | ||
Statistics[HitResult.Good] = 100; | ||
Statistics[HitResult.Great] = 300; | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
osu.Game.Rulesets.Karaoke.Tests/Ranking/TestSceneHitEventTimingDistributionGraph.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Extensions.Color4Extensions; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Screens.Ranking.Statistics; | ||
using osu.Game.Tests.Visual; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Ranking | ||
{ | ||
public class TestSceneHitEventTimingDistributionGraph : OsuTestScene | ||
{ | ||
[Test] | ||
public void TestManyDistributedEvents() | ||
{ | ||
createTest(CreateDistributedHitEvents()); | ||
} | ||
|
||
[Test] | ||
public void TestZeroTimeOffset() | ||
{ | ||
createTest(Enumerable.Range(0, 100).Select(_ => new HitEvent(0, HitResult.Perfect, new Note(), new Note(), null)).ToList()); | ||
} | ||
|
||
[Test] | ||
public void TestNoEvents() | ||
{ | ||
createTest(new List<HitEvent>()); | ||
} | ||
|
||
private void createTest(List<HitEvent> events) => AddStep("create test", () => | ||
{ | ||
Children = new Drawable[] | ||
{ | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Colour = Color4Extensions.FromHex("#333") | ||
}, | ||
new HitEventTimingDistributionGraph(events) | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
Size = new Vector2(600, 130) | ||
} | ||
}; | ||
}); | ||
|
||
public static List<HitEvent> CreateDistributedHitEvents() | ||
{ | ||
var hitEvents = new List<HitEvent>(); | ||
|
||
for (int i = 0; i < 50; i++) | ||
{ | ||
int count = (int)(Math.Pow(25 - Math.Abs(i - 25), 2)); | ||
|
||
for (int j = 0; j < count; j++) | ||
hitEvents.Add(new HitEvent(i - 25, HitResult.Perfect, new Note(), new Note(), null)); | ||
} | ||
|
||
return hitEvents; | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
osu.Game.Rulesets.Karaoke.Tests/Ranking/TestSceneResultsScreen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
|
@@ -7,7 +7,6 @@ | |
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Scoring; | ||
using osu.Game.Screens.Ranking.Statistics; | ||
using osu.Game.Tests; | ||
using osu.Game.Tests.Visual; | ||
using System.Collections.Generic; | ||
|
||
|
@@ -18,10 +17,9 @@ public class TestSceneStatisticsPanel : OsuTestScene | |
[Test] | ||
public void TestScoreWithStatistics() | ||
{ | ||
var score = new TestScoreInfo(new KaraokeRuleset().RulesetInfo) | ||
var score = new TestKaraokeScoreInfo() | ||
{ | ||
//TODO : add hit event. | ||
HitEvents = new List<HitEvent>() | ||
HitEvents = TestSceneHitEventTimingDistributionGraph.CreateDistributedHitEvents() | ||
}; | ||
|
||
loadPanel(score); | ||
|
@@ -30,7 +28,7 @@ public void TestScoreWithStatistics() | |
[Test] | ||
public void TestScoreWithoutStatistics() | ||
{ | ||
loadPanel(new TestScoreInfo(new KaraokeRuleset().RulesetInfo)); | ||
loadPanel(new TestKaraokeScoreInfo()); | ||
} | ||
|
||
[Test] | ||
|