mirror of
https://github.com/ppy/osu.git
synced 2026-05-17 03:52:35 +08:00
0aff50fbf5
This aims to bring some conformity to naming to make it easier to understand component structure for new components. Renames are pulled out of the song select v2 changes and are more relevant there due to many new classes being added. - `V2` suffix is dropped, with v2 components being moved to a relevant V2 namespace. - Related classes have a prefix of the area they are used. - Experimenting with using partial/nested classes in the song select v2 implementation. Not committing to this yet but want to see how it plays out. - Moved base carousel components to a generic namespace to avoid confusion with actual beatmap carousel implementation.
92 lines
2.9 KiB
C#
92 lines
2.9 KiB
C#
// 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 System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Utils;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Screens.Select;
|
|
using osu.Game.Screens.Select.Filter;
|
|
using osu.Game.Tests.Resources;
|
|
|
|
namespace osu.Game.Tests.Visual.SongSelectV2
|
|
{
|
|
/// <summary>
|
|
/// Covers common steps which can be used for manual testing.
|
|
/// </summary>
|
|
[TestFixture]
|
|
public partial class TestSceneBeatmapCarousel : BeatmapCarouselTestScene
|
|
{
|
|
[Test]
|
|
[Explicit]
|
|
public void TestBasics()
|
|
{
|
|
CreateCarousel();
|
|
RemoveAllBeatmaps();
|
|
|
|
AddBeatmaps(10, randomMetadata: true);
|
|
AddBeatmaps(10);
|
|
AddBeatmaps(1);
|
|
}
|
|
|
|
[Test]
|
|
[Explicit]
|
|
public void TestSorting()
|
|
{
|
|
SortBy(new FilterCriteria { Sort = SortMode.Artist });
|
|
SortBy(new FilterCriteria { Group = GroupMode.Difficulty, Sort = SortMode.Difficulty });
|
|
SortBy(new FilterCriteria { Group = GroupMode.Artist, Sort = SortMode.Artist });
|
|
}
|
|
|
|
[Test]
|
|
[Explicit]
|
|
public void TestRemovals()
|
|
{
|
|
RemoveFirstBeatmap();
|
|
RemoveAllBeatmaps();
|
|
}
|
|
|
|
[Test]
|
|
[Explicit]
|
|
public void TestAddRemoveRepeatedOps()
|
|
{
|
|
AddRepeatStep("add beatmaps", () => BeatmapSets.Add(TestResources.CreateTestBeatmapSetInfo(RNG.Next(1, 4))), 20);
|
|
AddRepeatStep("remove beatmaps", () => BeatmapSets.RemoveAt(RNG.Next(0, BeatmapSets.Count)), 20);
|
|
}
|
|
|
|
[Test]
|
|
[Explicit]
|
|
public void TestMasking()
|
|
{
|
|
AddStep("disable masking", () => Scroll.Masking = false);
|
|
AddStep("enable masking", () => Scroll.Masking = true);
|
|
}
|
|
|
|
[Test]
|
|
[Explicit]
|
|
public void TestPerformanceWithManyBeatmaps()
|
|
{
|
|
const int count = 200000;
|
|
|
|
List<BeatmapSetInfo> generated = new List<BeatmapSetInfo>();
|
|
|
|
AddStep($"populate {count} test beatmaps", () =>
|
|
{
|
|
generated.Clear();
|
|
Task.Run(() =>
|
|
{
|
|
for (int j = 0; j < count; j++)
|
|
generated.Add(CreateTestBeatmapSetInfo(3, true));
|
|
}).ConfigureAwait(true);
|
|
});
|
|
|
|
AddUntilStep("wait for beatmaps populated", () => generated.Count, () => Is.GreaterThan(count / 3));
|
|
AddUntilStep("this takes a while", () => generated.Count, () => Is.GreaterThan(count / 3 * 2));
|
|
AddUntilStep("maybe they are done now", () => generated.Count, () => Is.EqualTo(count));
|
|
|
|
AddStep("add all beatmaps", () => BeatmapSets.AddRange(generated));
|
|
}
|
|
}
|
|
}
|