mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Write tests
This commit is contained in:
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -579,6 +580,34 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
checkVisibleItemCount(true, 15);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelectRecommendedDifficulty()
|
||||
{
|
||||
void setRecommendedAndExpect(double recommended, int expectedSet, int expectedDiff)
|
||||
{
|
||||
AddStep($"Recommend SR {recommended}", () => carousel.RecommendedStarDifficulty.Value = recommended);
|
||||
advanceSelection(direction: 1, diff: false);
|
||||
waitForSelection(expectedSet, expectedDiff);
|
||||
}
|
||||
|
||||
createCarousel();
|
||||
AddStep("Add beatmaps", () =>
|
||||
{
|
||||
for (int i = 1; i <= 7; i++)
|
||||
{
|
||||
var set = createTestBeatmapSet(i);
|
||||
carousel.UpdateBeatmapSet(set);
|
||||
}
|
||||
});
|
||||
waitForSelection(1, 1);
|
||||
setRecommendedAndExpect(1, 2, 1);
|
||||
setRecommendedAndExpect(3.9, 3, 1);
|
||||
setRecommendedAndExpect(4.1, 4, 2);
|
||||
setRecommendedAndExpect(5.6, 5, 2);
|
||||
setRecommendedAndExpect(5.7, 6, 3);
|
||||
setRecommendedAndExpect(10, 7, 3);
|
||||
}
|
||||
|
||||
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null, Func<FilterCriteria> initialCriteria = null)
|
||||
{
|
||||
createCarousel();
|
||||
@ -781,6 +810,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
public new List<DrawableCarouselItem> Items => base.Items;
|
||||
|
||||
public new Bindable<double> RecommendedStarDifficulty => base.RecommendedStarDifficulty;
|
||||
|
||||
public bool PendingFilterTask => PendingFilter != null;
|
||||
|
||||
protected override IEnumerable<BeatmapSetInfo> GetLoadableBeatmaps() => Enumerable.Empty<BeatmapSetInfo>();
|
||||
|
Reference in New Issue
Block a user