mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge branch 'master' into disable-scroll-speed-on-osu
This commit is contained in:
commit
60c424837b
@ -65,7 +65,7 @@ namespace osu.Game.Tests.Database
|
||||
private class TestLegacyBeatmapImporter : LegacyBeatmapImporter
|
||||
{
|
||||
public TestLegacyBeatmapImporter()
|
||||
: base(null)
|
||||
: base(null!)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,14 @@ using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
@ -55,6 +57,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
var secondImport = importBeatmap(3);
|
||||
confirmBeatmapInSongSelect(secondImport);
|
||||
presentAndConfirm(secondImport);
|
||||
|
||||
// Test presenting same beatmap more than once
|
||||
@ -74,6 +77,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
presentAndConfirm(firstImport);
|
||||
|
||||
var secondImport = importBeatmap(3, new ManiaRuleset().RulesetInfo);
|
||||
confirmBeatmapInSongSelect(secondImport);
|
||||
presentAndConfirm(secondImport);
|
||||
|
||||
presentSecondDifficultyAndConfirm(firstImport, 1);
|
||||
@ -134,13 +138,22 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
return () => imported;
|
||||
}
|
||||
|
||||
private void confirmBeatmapInSongSelect(Func<BeatmapSetInfo> getImport)
|
||||
{
|
||||
AddUntilStep("beatmap in song select", () =>
|
||||
{
|
||||
var songSelect = (Screens.Select.SongSelect)Game.ScreenStack.CurrentScreen;
|
||||
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().BeatmapSets.Any(b => b.MatchesOnlineID(getImport()));
|
||||
});
|
||||
}
|
||||
|
||||
private void presentAndConfirm(Func<BeatmapSetInfo> getImport)
|
||||
{
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
|
||||
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.MatchesOnlineID(getImport()));
|
||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
|
||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID, () => Is.EqualTo(getImport().OnlineID));
|
||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset));
|
||||
}
|
||||
|
||||
private void presentSecondDifficultyAndConfirm(Func<BeatmapSetInfo> getImport, int importedID)
|
||||
@ -148,9 +161,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
Predicate<BeatmapInfo> pred = b => b.OnlineID == importedID * 2048;
|
||||
AddStep("present difficulty", () => Game.PresentBeatmap(getImport(), pred));
|
||||
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
|
||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID == importedID * 2048);
|
||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
|
||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 2048));
|
||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.IO;
|
||||
@ -22,22 +22,42 @@ namespace osu.Game.Database
|
||||
{
|
||||
// make sure the directory exists
|
||||
if (!storage.ExistsDirectory(string.Empty))
|
||||
yield break;
|
||||
return Array.Empty<string>();
|
||||
|
||||
List<string> paths = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (string directory in storage.GetDirectories(string.Empty))
|
||||
{
|
||||
var directoryStorage = storage.GetStorageForDirectory(directory);
|
||||
|
||||
try
|
||||
{
|
||||
if (!directoryStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any())
|
||||
{
|
||||
// if a directory doesn't contain files, attempt looking for beatmaps inside of that directory.
|
||||
// this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615.
|
||||
foreach (string subDirectory in GetStableImportPaths(directoryStorage))
|
||||
yield return subDirectory;
|
||||
paths.Add(subDirectory);
|
||||
}
|
||||
else
|
||||
yield return storage.GetFullPath(directory);
|
||||
paths.Add(storage.GetFullPath(directory));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch any errors when enumerating files
|
||||
Logger.Log($"Error when enumerating files in {directoryStorage.GetFullPath(string.Empty)}: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch any errors when enumerating directories
|
||||
Logger.Log($"Error when enumerating directories in {storage.GetFullPath(string.Empty)}: {e}");
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
|
||||
|
@ -270,7 +270,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
IsSeeking &= Transforms.Any();
|
||||
|
||||
if (track.Value?.IsRunning != true)
|
||||
if (!IsRunning)
|
||||
{
|
||||
// seeking in the editor can happen while the track isn't running.
|
||||
// in this case we always want to expose ourselves as seeking (to avoid sample playback).
|
||||
|
Loading…
Reference in New Issue
Block a user