forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
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
6037d5d
commit 0721e58
Showing
20 changed files
with
2,063 additions
and
217 deletions.
There are no files selected for viewing
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
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
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
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
101 changes: 101 additions & 0 deletions
101
osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselDifficultyPanel.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,101 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. 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.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Utils; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Overlays; | ||
using osu.Game.Rulesets.Mania; | ||
using osu.Game.Rulesets.Osu; | ||
using osu.Game.Screens.SelectV2; | ||
using osu.Game.Tests.Resources; | ||
using osu.Game.Tests.Visual.UserInterface; | ||
using osuTK; | ||
|
||
namespace osu.Game.Tests.Visual.SongSelectV2 | ||
{ | ||
public partial class TestSceneBeatmapCarouselDifficultyPanel : ThemeComparisonTestScene | ||
{ | ||
[Resolved] | ||
private BeatmapManager beatmaps { get; set; } = null!; | ||
|
||
private BeatmapInfo beatmap = null!; | ||
|
||
public TestSceneBeatmapCarouselDifficultyPanel() | ||
: base(false) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void TestDisplay() | ||
{ | ||
AddStep("set beatmap", () => | ||
{ | ||
var beatmapSet = beatmaps.GetAllUsableBeatmapSets().FirstOrDefault(b => b.OnlineID == 241526) | ||
?? beatmaps.GetAllUsableBeatmapSets().FirstOrDefault(b => !b.Protected) | ||
?? TestResources.CreateTestBeatmapSetInfo(); | ||
|
||
beatmap = beatmapSet.Beatmaps.First(); | ||
CreateThemedContent(OverlayColourScheme.Aquamarine); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestRandomBeatmap() | ||
{ | ||
AddStep("random beatmap", () => | ||
{ | ||
beatmap = beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()) | ||
.First().Beatmaps.OrderBy(_ => RNG.Next()).First(); | ||
CreateThemedContent(OverlayColourScheme.Aquamarine); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestManiaRuleset() | ||
{ | ||
AddToggleStep("mania ruleset", v => Ruleset.Value = v ? new ManiaRuleset().RulesetInfo : new OsuRuleset().RulesetInfo); | ||
} | ||
|
||
protected override Drawable CreateContent() | ||
{ | ||
return new FillFlowContainer | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
Width = 0.5f, | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Direction = FillDirection.Vertical, | ||
Spacing = new Vector2(0f, 5f), | ||
Children = new Drawable[] | ||
{ | ||
new BeatmapDifficultyPanel | ||
{ | ||
Item = new CarouselItem(beatmap) | ||
}, | ||
new BeatmapDifficultyPanel | ||
{ | ||
Item = new CarouselItem(beatmap), | ||
KeyboardSelected = { Value = true } | ||
}, | ||
new BeatmapDifficultyPanel | ||
{ | ||
Item = new CarouselItem(beatmap), | ||
Selected = { Value = true } | ||
}, | ||
new BeatmapDifficultyPanel | ||
{ | ||
Item = new CarouselItem(beatmap), | ||
KeyboardSelected = { Value = true }, | ||
Selected = { Value = true } | ||
}, | ||
} | ||
}; | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselSetPanel.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,90 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. 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.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Utils; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Overlays; | ||
using osu.Game.Screens.SelectV2; | ||
using osu.Game.Tests.Resources; | ||
using osu.Game.Tests.Visual.UserInterface; | ||
using osuTK; | ||
|
||
namespace osu.Game.Tests.Visual.SongSelectV2 | ||
{ | ||
public partial class TestSceneBeatmapCarouselSetPanel : ThemeComparisonTestScene | ||
{ | ||
[Resolved] | ||
private BeatmapManager beatmaps { get; set; } = null!; | ||
|
||
private BeatmapSetInfo beatmapSet = null!; | ||
|
||
public TestSceneBeatmapCarouselSetPanel() | ||
: base(false) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void TestDisplay() | ||
{ | ||
AddStep("set beatmap", () => | ||
{ | ||
beatmapSet = beatmaps.GetAllUsableBeatmapSets().FirstOrDefault(b => b.OnlineID == 241526) | ||
?? beatmaps.GetAllUsableBeatmapSets().FirstOrDefault(b => !b.Protected) | ||
?? TestResources.CreateTestBeatmapSetInfo(); | ||
CreateThemedContent(OverlayColourScheme.Aquamarine); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestRandomBeatmap() | ||
{ | ||
AddStep("random beatmap", () => | ||
{ | ||
beatmapSet = beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()).First(); | ||
CreateThemedContent(OverlayColourScheme.Aquamarine); | ||
}); | ||
} | ||
|
||
protected override Drawable CreateContent() | ||
{ | ||
return new FillFlowContainer | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
Width = 0.5f, | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Direction = FillDirection.Vertical, | ||
Spacing = new Vector2(0f, 5f), | ||
Children = new Drawable[] | ||
{ | ||
new BeatmapSetPanel | ||
{ | ||
Item = new CarouselItem(beatmapSet) | ||
}, | ||
new BeatmapSetPanel | ||
{ | ||
Item = new CarouselItem(beatmapSet), | ||
KeyboardSelected = { Value = true } | ||
}, | ||
new BeatmapSetPanel | ||
{ | ||
Item = new CarouselItem(beatmapSet), | ||
Expanded = { Value = true } | ||
}, | ||
new BeatmapSetPanel | ||
{ | ||
Item = new CarouselItem(beatmapSet), | ||
KeyboardSelected = { Value = true }, | ||
Expanded = { Value = true } | ||
}, | ||
} | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.