Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken test cases, remove some recursive lookup methods. #735

Merged
merged 2 commits into from May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
Expand Up @@ -142,7 +142,7 @@ private void ensureLoaded(GameHost host, int timeout = 10000)
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
@"Beatmaps did not import to the database in allocated time");

var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First(), true);
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());

Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
Expand Down
3 changes: 3 additions & 0 deletions osu.Game/Database/BeatmapDatabase.cs
Expand Up @@ -267,6 +267,9 @@ public BeatmapSetInfo GetBeatmapSet(int id)

public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
{
if (beatmapInfo.BeatmapSet == null)
beatmapInfo = GetChildren(beatmapInfo, true);

if (beatmapInfo.BeatmapSet == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");

Expand Down
8 changes: 3 additions & 5 deletions osu.Game/Database/Database.cs
Expand Up @@ -48,11 +48,9 @@ protected Database(Storage storage, SQLiteConnection connection)
return Connection.Table<T>();
}

public T GetWithChildren<T>(object id, bool recursive = false) where T : class
{
return Connection.GetWithChildren<T>(id, recursive);
}

/// <summary>
/// This is expensive. Use with caution.
/// </summary>
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null, bool recursive = true)
where T : class
{
Expand Down
6 changes: 6 additions & 0 deletions osu.Game/Overlays/ChatOverlay.cs
Expand Up @@ -110,12 +110,18 @@ protected override void PopIn()
{
MoveToY(0, transition_length, EasingTypes.OutQuint);
FadeIn(transition_length, EasingTypes.OutQuint);

inputTextBox.HoldFocus = true;
base.PopIn();
}

protected override void PopOut()
{
MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine);
FadeOut(transition_length, EasingTypes.InSine);

inputTextBox.HoldFocus = false;
base.PopOut();
}

[BackgroundDependencyLoader]
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Menu/MainMenu.cs
Expand Up @@ -79,7 +79,7 @@ private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmap
if (count > 0)
{
var beatmap = query.ElementAt(RNG.Next(0, count - 1));
beatmaps.GetChildren(beatmap, true);
beatmaps.GetChildren(beatmap);
Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]);
}
}
Expand Down