1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 14:02:55 +08:00

Fix TestCasePlaySongSelect incorrectly using live app data

This commit is contained in:
Dean Herbert 2017-09-19 17:22:45 +09:00
parent f2a9e95d56
commit 51cdff1d9a

View File

@ -2,9 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.IO;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter; using osu.Game.Screens.Select.Filter;
@ -14,13 +16,20 @@ namespace osu.Game.Tests.Visual
{ {
internal class TestCasePlaySongSelect : OsuTestCase internal class TestCasePlaySongSelect : OsuTestCase
{ {
private readonly BeatmapManager manager; private BeatmapManager manager;
public override string Description => @"with fake data"; public override string Description => @"with fake data";
private readonly RulesetStore rulesets; private RulesetStore rulesets;
public TestCasePlaySongSelect() private DependencyContainer dependencies;
private FileStore files;
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
[BackgroundDependencyLoader]
private void load()
{ {
PlaySongSelect songSelect; PlaySongSelect songSelect;
@ -31,8 +40,9 @@ namespace osu.Game.Tests.Visual
var backingDatabase = storage.GetDatabase(@"client"); var backingDatabase = storage.GetDatabase(@"client");
backingDatabase.CreateTable<StoreVersion>(); backingDatabase.CreateTable<StoreVersion>();
rulesets = new RulesetStore(backingDatabase); dependencies.Cache(rulesets = new RulesetStore(backingDatabase));
manager = new BeatmapManager(storage, null, backingDatabase, rulesets, null); dependencies.Cache(files = new FileStore(backingDatabase, storage));
dependencies.Cache(manager = new BeatmapManager(storage, files, backingDatabase, rulesets, null));
for (int i = 0; i < 100; i += 10) for (int i = 0; i < 100; i += 10)
manager.Import(createTestBeatmapSet(i)); manager.Import(createTestBeatmapSet(i));