mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Merge branch 'master' into fix-filtercontrol-order
This commit is contained in:
commit
033bd82953
@ -2,32 +2,35 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays.Music;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestScenePlaylistOverlay : OsuTestScene
|
||||
public class TestScenePlaylistOverlay : OsuManualInputManagerTestScene
|
||||
{
|
||||
private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>();
|
||||
|
||||
private PlaylistOverlay playlistOverlay;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
PlaylistOverlay overlay;
|
||||
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(300, 500),
|
||||
Child = overlay = new PlaylistOverlay
|
||||
Child = playlistOverlay = new PlaylistOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -53,7 +56,45 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
overlay.BeatmapSets.BindTo(beatmapSets);
|
||||
playlistOverlay.BeatmapSets.BindTo(beatmapSets);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestRearrangeItems()
|
||||
{
|
||||
AddUntilStep("wait for animations to complete", () => !playlistOverlay.Transforms.Any());
|
||||
|
||||
AddStep("hold 1st item handle", () =>
|
||||
{
|
||||
var handle = this.ChildrenOfType<PlaylistItem.PlaylistItemHandle>().First();
|
||||
InputManager.MoveMouseTo(handle.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddStep("drag to 5th", () =>
|
||||
{
|
||||
var item = this.ChildrenOfType<PlaylistItem>().ElementAt(4);
|
||||
InputManager.MoveMouseTo(item.ScreenSpaceDrawQuad.Centre);
|
||||
});
|
||||
|
||||
AddAssert("song 1 is 5th", () => beatmapSets[4].Metadata.Title == "Some Song 1");
|
||||
|
||||
AddStep("release handle", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFiltering()
|
||||
{
|
||||
AddStep("set filter to \"10\"", () =>
|
||||
{
|
||||
var filterControl = playlistOverlay.ChildrenOfType<FilterControl>().Single();
|
||||
filterControl.Search.Current.Value = "10";
|
||||
});
|
||||
|
||||
AddAssert("results filtered correctly",
|
||||
() => playlistOverlay.ChildrenOfType<PlaylistItem>()
|
||||
.Where(item => item.MatchingFilter)
|
||||
.All(item => item.FilterTerms.Any(term => term.Contains("10"))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Graphics.Containers
|
||||
/// <summary>
|
||||
/// Whether the drag handle should be shown.
|
||||
/// </summary>
|
||||
protected readonly Bindable<bool> ShowDragHandle = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> ShowDragHandle = new Bindable<bool>(true);
|
||||
|
||||
private Container handleContainer;
|
||||
private PlaylistItemHandle handle;
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Screens.Select
|
||||
public ImportFromStablePopup(Action importFromStable)
|
||||
{
|
||||
HeaderText = @"You have no beatmaps!";
|
||||
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps, skins and scores?\nThis will create a second copy of all files on disk.";
|
||||
BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps, skins, collections and scores?\nThis will create a second copy of all files on disk.";
|
||||
|
||||
Icon = FontAwesome.Solid.Plane;
|
||||
|
||||
|
@ -34,6 +34,7 @@ using System.Threading.Tasks;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -103,7 +104,7 @@ namespace osu.Game.Screens.Select
|
||||
private MusicController music { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
||||
private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores, CollectionManager collections)
|
||||
{
|
||||
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
||||
transferRulesetValue();
|
||||
@ -294,7 +295,12 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
dialogOverlay.Push(new ImportFromStablePopup(() =>
|
||||
{
|
||||
Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
Task.Run(beatmaps.ImportFromStableAsync)
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
Task.Run(scores.ImportFromStableAsync);
|
||||
Task.Run(collections.ImportFromStableAsync);
|
||||
}, TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
Task.Run(skins.ImportFromStableAsync);
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user