1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Reset db on dispose

This commit is contained in:
Drew DeVault 2016-11-25 05:12:01 -05:00
parent 2013f93a96
commit c85454d034

View File

@ -12,7 +12,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
class TestCasePlaySongSelect : TestCase class TestCasePlaySongSelect : TestCase
{ {
private BeatmapDatabase db; private BeatmapDatabase db, oldDb;
private TestStorage storage; private TestStorage storage;
public override string Name => @"Song Select"; public override string Name => @"Song Select";
@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests
public override void Reset() public override void Reset()
{ {
base.Reset(); base.Reset();
oldDb = Dependencies.Get<BeatmapDatabase>();
if (db == null) if (db == null)
{ {
storage = new TestStorage(@"TestCasePlaySongSelect"); storage = new TestStorage(@"TestCasePlaySongSelect");
@ -35,9 +35,14 @@ namespace osu.Desktop.VisualTests.Tests
db.Import(sets); db.Import(sets);
} }
Add(new PlaySongSelect()); Add(new PlaySongSelect());
} }
protected override void Dispose(bool isDisposing)
{
Dependencies.Cache(oldDb, true);
base.Dispose(isDisposing);
}
private BeatmapSetInfo createTestBeatmapSet(int i) private BeatmapSetInfo createTestBeatmapSet(int i)
{ {