2017-02-07 12:59:30 +08:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-11-23 19:38:33 +08:00
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Desktop.VisualTests.Platform;
|
2017-03-28 20:03:34 +08:00
|
|
|
using osu.Framework.Testing;
|
2017-02-21 00:49:02 +08:00
|
|
|
using osu.Framework.MathUtils;
|
2017-07-26 15:28:32 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2017-07-27 19:50:26 +08:00
|
|
|
using osu.Game.Database;
|
2017-07-26 15:28:32 +08:00
|
|
|
using osu.Game.Rulesets;
|
2016-11-23 19:38:33 +08:00
|
|
|
using osu.Game.Screens.Select;
|
2017-03-05 12:07:47 +08:00
|
|
|
using osu.Game.Screens.Select.Filter;
|
2016-11-23 19:38:33 +08:00
|
|
|
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
{
|
2017-03-07 09:59:19 +08:00
|
|
|
internal class TestCasePlaySongSelect : TestCase
|
2016-11-23 19:38:33 +08:00
|
|
|
{
|
2017-07-27 15:56:41 +08:00
|
|
|
private readonly BeatmapManager manager;
|
2016-11-23 19:38:33 +08:00
|
|
|
|
2016-10-27 16:38:23 +08:00
|
|
|
public override string Description => @"with fake data";
|
2016-10-27 16:08:53 +08:00
|
|
|
|
2017-07-27 15:56:41 +08:00
|
|
|
private readonly RulesetStore rulesets;
|
2017-04-17 16:43:48 +08:00
|
|
|
|
2017-07-07 20:05:55 +08:00
|
|
|
public TestCasePlaySongSelect()
|
2016-11-23 19:38:33 +08:00
|
|
|
{
|
2017-07-08 17:17:47 +08:00
|
|
|
PlaySongSelect songSelect;
|
|
|
|
|
2017-07-27 15:56:41 +08:00
|
|
|
if (manager == null)
|
2016-10-27 16:38:38 +08:00
|
|
|
{
|
2017-07-08 17:17:47 +08:00
|
|
|
var storage = new TestStorage(@"TestCasePlaySongSelect");
|
2017-04-17 18:44:03 +08:00
|
|
|
|
|
|
|
var backingDatabase = storage.GetDatabase(@"client");
|
2017-07-27 19:50:26 +08:00
|
|
|
backingDatabase.CreateTable<StoreVersion>();
|
2017-04-17 18:44:03 +08:00
|
|
|
|
2017-07-27 15:56:41 +08:00
|
|
|
rulesets = new RulesetStore(backingDatabase);
|
|
|
|
manager = new BeatmapManager(storage, null, backingDatabase, rulesets);
|
2016-10-27 16:35:00 +08:00
|
|
|
|
2016-10-27 16:38:38 +08:00
|
|
|
for (int i = 0; i < 100; i += 10)
|
2017-07-27 15:56:41 +08:00
|
|
|
manager.Import(createTestBeatmapSet(i));
|
2016-10-27 16:38:38 +08:00
|
|
|
}
|
2017-02-18 23:23:13 +08:00
|
|
|
|
2017-02-18 23:45:46 +08:00
|
|
|
Add(songSelect = new PlaySongSelect());
|
2017-02-18 22:11:40 +08:00
|
|
|
|
2017-03-31 16:55:07 +08:00
|
|
|
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
|
|
|
|
AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
|
|
|
|
AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
|
|
|
|
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
|
2016-10-27 16:08:53 +08:00
|
|
|
}
|
2017-02-18 22:56:29 +08:00
|
|
|
|
2016-10-27 16:08:53 +08:00
|
|
|
private BeatmapSetInfo createTestBeatmapSet(int i)
|
|
|
|
{
|
|
|
|
return new BeatmapSetInfo
|
|
|
|
{
|
2017-01-09 21:05:01 +08:00
|
|
|
OnlineBeatmapSetID = 1234 + i,
|
2016-10-27 16:08:53 +08:00
|
|
|
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
|
|
|
|
Metadata = new BeatmapMetadata
|
|
|
|
{
|
2017-01-09 21:05:01 +08:00
|
|
|
OnlineBeatmapSetID = 1234 + i,
|
2017-02-18 22:11:40 +08:00
|
|
|
// Create random metadata, then we can check if sorting works based on these
|
2017-02-21 00:49:02 +08:00
|
|
|
Artist = "MONACA " + RNG.Next(0, 9),
|
|
|
|
Title = "Black Song " + RNG.Next(0, 9),
|
|
|
|
Author = "Some Guy " + RNG.Next(0, 9),
|
2016-10-27 16:08:53 +08:00
|
|
|
},
|
|
|
|
Beatmaps = new List<BeatmapInfo>(new[]
|
|
|
|
{
|
|
|
|
new BeatmapInfo
|
|
|
|
{
|
2017-01-09 21:05:01 +08:00
|
|
|
OnlineBeatmapID = 1234 + i,
|
2017-04-17 16:43:48 +08:00
|
|
|
Ruleset = rulesets.Query<RulesetInfo>().First(),
|
2016-10-27 16:08:53 +08:00
|
|
|
Path = "normal.osu",
|
|
|
|
Version = "Normal",
|
2017-03-16 22:18:02 +08:00
|
|
|
Difficulty = new BeatmapDifficulty
|
2016-10-27 16:08:53 +08:00
|
|
|
{
|
|
|
|
OverallDifficulty = 3.5f,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new BeatmapInfo
|
|
|
|
{
|
2017-01-09 21:05:01 +08:00
|
|
|
OnlineBeatmapID = 1235 + i,
|
2017-04-17 16:43:48 +08:00
|
|
|
Ruleset = rulesets.Query<RulesetInfo>().First(),
|
2016-10-27 16:08:53 +08:00
|
|
|
Path = "hard.osu",
|
|
|
|
Version = "Hard",
|
2017-03-16 22:18:02 +08:00
|
|
|
Difficulty = new BeatmapDifficulty
|
2016-10-27 16:08:53 +08:00
|
|
|
{
|
|
|
|
OverallDifficulty = 5,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new BeatmapInfo
|
|
|
|
{
|
2017-01-09 21:05:01 +08:00
|
|
|
OnlineBeatmapID = 1236 + i,
|
2017-04-17 16:43:48 +08:00
|
|
|
Ruleset = rulesets.Query<RulesetInfo>().First(),
|
2016-10-27 16:08:53 +08:00
|
|
|
Path = "insane.osu",
|
|
|
|
Version = "Insane",
|
2017-03-16 22:18:02 +08:00
|
|
|
Difficulty = new BeatmapDifficulty
|
2016-10-27 16:08:53 +08:00
|
|
|
{
|
|
|
|
OverallDifficulty = 7,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
};
|
2016-11-23 19:38:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|