mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Merge branch 'master' into fix-exclusive-fullscreen-detection
This commit is contained in:
commit
646d4965b9
@ -0,0 +1,42 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public partial class TestSceneBeatmapEditorNavigation : OsuGameTestScene
|
||||
{
|
||||
/// <summary>
|
||||
/// When entering the editor, a new beatmap is created as part of the asynchronous load process.
|
||||
/// This test ensures that in the case of an early exit from the editor (ie. while it's still loading)
|
||||
/// doesn't leave a dangling beatmap behind.
|
||||
///
|
||||
/// This may not fail 100% due to timing, but has a pretty high chance of hitting a failure so works well enough
|
||||
/// as a test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCancelNavigationToEditor()
|
||||
{
|
||||
BeatmapSetInfo[] beatmapSets = null!;
|
||||
|
||||
AddStep("Fetch initial beatmaps", () => beatmapSets = allBeatmapSets());
|
||||
|
||||
AddStep("Set current beatmap to default", () => Game.Beatmap.SetDefault());
|
||||
|
||||
AddStep("Push editor loader", () => Game.ScreenStack.Push(new EditorLoader()));
|
||||
AddUntilStep("Wait for loader current", () => Game.ScreenStack.CurrentScreen is EditorLoader);
|
||||
AddStep("Close editor while loading", () => Game.ScreenStack.CurrentScreen.Exit());
|
||||
|
||||
AddUntilStep("Wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
AddAssert("Check no new beatmaps were made", () => allBeatmapSets().SequenceEqual(beatmapSets));
|
||||
|
||||
BeatmapSetInfo[] allBeatmapSets() => Game.Realm.Run(realm => realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
@ -31,6 +32,9 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private RankingsOverlay? rankingsOverlay { get; set; }
|
||||
|
||||
private UserCoverBackground cover = null!;
|
||||
private SupporterIcon supporterTag = null!;
|
||||
private UpdateableAvatar avatar = null!;
|
||||
@ -38,6 +42,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
private ExternalLinkButton openUserExternally = null!;
|
||||
private OsuSpriteText titleText = null!;
|
||||
private UpdateableFlag userFlag = null!;
|
||||
private OsuHoverContainer userCountryContainer = null!;
|
||||
private OsuSpriteText userCountryText = null!;
|
||||
private GroupBadgeFlow groupBadgeFlow = null!;
|
||||
private ToggleCoverButton coverToggle = null!;
|
||||
@ -156,13 +161,17 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
Size = new Vector2(28, 20),
|
||||
ShowPlaceholderOnUnknown = false,
|
||||
},
|
||||
userCountryText = new OsuSpriteText
|
||||
userCountryContainer = new OsuHoverContainer
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
|
||||
Margin = new MarginPadding { Left = 5 },
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
}
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding { Left = 5 },
|
||||
Child = userCountryText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -202,6 +211,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
||||
userFlag.CountryCode = user?.CountryCode ?? default;
|
||||
userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
|
||||
userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default);
|
||||
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
|
||||
titleText.Text = user?.Title ?? string.Empty;
|
||||
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");
|
||||
|
@ -210,7 +210,10 @@ namespace osu.Game.Screens.Edit
|
||||
// this is a bit haphazard, but guards against setting the lease Beatmap bindable if
|
||||
// the editor has already been exited.
|
||||
if (!ValidForPush)
|
||||
{
|
||||
beatmapManager.Delete(loadableBeatmap.BeatmapSetInfo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user