mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 02:03:04 +08:00
Merge pull request #28900 from smoogipoo/fix-more-tests
Fix more test failures
This commit is contained in:
commit
d9297438ba
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -67,7 +67,7 @@ jobs:
|
|||||||
- { prettyname: macOS, fullname: macos-latest }
|
- { prettyname: macOS, fullname: macos-latest }
|
||||||
- { prettyname: Linux, fullname: ubuntu-latest }
|
- { prettyname: Linux, fullname: ubuntu-latest }
|
||||||
threadingMode: ['SingleThread', 'MultiThreaded']
|
threadingMode: ['SingleThread', 'MultiThreaded']
|
||||||
timeout-minutes: 60
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("sample playback disabled", () => sampleDisabler.SamplePlaybackDisabled.Value);
|
AddUntilStep("sample playback disabled", () => sampleDisabler.SamplePlaybackDisabled.Value);
|
||||||
|
|
||||||
// because we are in frame stable context, it's quite likely that not all samples are "played" at this point.
|
// because we are in frame stable context, it's quite likely that not all samples are "played" at this point.
|
||||||
// the important thing is that at least one started, and that sample has since stopped.
|
// the important thing is that at least one started, and that sample has since stopped.
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -319,16 +320,17 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => playlist.ChildrenOfType<DrawableLinkCompiler>().Any() && playlist.ChildrenOfType<BeatmapCardThumbnail>().First().DrawWidth > 0);
|
AddUntilStep("wait for load", () => playlist.ChildrenOfType<DrawableLinkCompiler>().Any() && playlist.ChildrenOfType<BeatmapCardThumbnail>().First().DrawWidth > 0);
|
||||||
AddStep("move mouse to first item title", () =>
|
|
||||||
{
|
AddStep("move mouse to first item title", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<LinkFlowContainer>().First().ChildrenOfType<SpriteText>().First()));
|
||||||
var drawQuad = playlist.ChildrenOfType<LinkFlowContainer>().First().ScreenSpaceDrawQuad;
|
|
||||||
var location = (drawQuad.TopLeft + drawQuad.BottomLeft) / 2 + new Vector2(drawQuad.Width * 0.2f, 0);
|
|
||||||
InputManager.MoveMouseTo(location);
|
|
||||||
});
|
|
||||||
AddAssert("first item title not hovered", () => playlist.ChildrenOfType<DrawableLinkCompiler>().First().IsHovered, () => Is.False);
|
AddAssert("first item title not hovered", () => playlist.ChildrenOfType<DrawableLinkCompiler>().First().IsHovered, () => Is.False);
|
||||||
AddStep("click left mouse", () => InputManager.Click(MouseButton.Left));
|
|
||||||
|
AddStep("click title", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(playlist.ChildrenOfType<LinkFlowContainer>().First().ChildrenOfType<SpriteText>().First());
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
AddUntilStep("first item selected", () => playlist.ChildrenOfType<DrawableRoomPlaylistItem>().First().IsSelectedItem, () => Is.True);
|
AddUntilStep("first item selected", () => playlist.ChildrenOfType<DrawableRoomPlaylistItem>().First().IsSelectedItem, () => Is.True);
|
||||||
// implies being clickable.
|
|
||||||
AddUntilStep("first item title hovered", () => playlist.ChildrenOfType<DrawableLinkCompiler>().First().IsHovered, () => Is.True);
|
AddUntilStep("first item title hovered", () => playlist.ChildrenOfType<DrawableLinkCompiler>().First().IsHovered, () => Is.True);
|
||||||
|
|
||||||
AddStep("move mouse to second item results button", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<GrayButton>().ElementAt(5)));
|
AddStep("move mouse to second item results button", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<GrayButton>().ElementAt(5)));
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -204,12 +208,16 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
AddStep("Set current beatmap to default", () => Game.Beatmap.SetDefault());
|
AddStep("Set current beatmap to default", () => Game.Beatmap.SetDefault());
|
||||||
|
|
||||||
AddStep("Push editor loader", () => Game.ScreenStack.Push(new EditorLoader()));
|
DelayedLoadEditorLoader loader = null!;
|
||||||
|
AddStep("Push editor loader", () => Game.ScreenStack.Push(loader = new DelayedLoadEditorLoader()));
|
||||||
AddUntilStep("Wait for loader current", () => Game.ScreenStack.CurrentScreen is EditorLoader);
|
AddUntilStep("Wait for loader current", () => Game.ScreenStack.CurrentScreen is EditorLoader);
|
||||||
|
AddUntilStep("wait for editor load start", () => loader.Editor != null);
|
||||||
AddStep("Close editor while loading", () => Game.ScreenStack.CurrentScreen.Exit());
|
AddStep("Close editor while loading", () => Game.ScreenStack.CurrentScreen.Exit());
|
||||||
|
AddStep("allow editor load", () => loader.AllowLoad.Set());
|
||||||
|
AddUntilStep("wait for editor ready", () => loader.Editor!.LoadState >= LoadState.Ready);
|
||||||
|
|
||||||
AddUntilStep("Wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
AddUntilStep("Wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||||
AddAssert("Check no new beatmaps were made", () => allBeatmapSets().SequenceEqual(beatmapSets));
|
AddAssert("Check no new beatmaps were made", allBeatmapSets, () => Is.EquivalentTo(beatmapSets));
|
||||||
|
|
||||||
BeatmapSetInfo[] allBeatmapSets() => Game.Realm.Run(realm => realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray());
|
BeatmapSetInfo[] allBeatmapSets() => Game.Realm.Run(realm => realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray());
|
||||||
}
|
}
|
||||||
@ -356,5 +364,33 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
private EditorBeatmap getEditorBeatmap() => getEditor().ChildrenOfType<EditorBeatmap>().Single();
|
private EditorBeatmap getEditorBeatmap() => getEditor().ChildrenOfType<EditorBeatmap>().Single();
|
||||||
|
|
||||||
private Editor getEditor() => (Editor)Game.ScreenStack.CurrentScreen;
|
private Editor getEditor() => (Editor)Game.ScreenStack.CurrentScreen;
|
||||||
|
|
||||||
|
private partial class DelayedLoadEditorLoader : EditorLoader
|
||||||
|
{
|
||||||
|
public readonly ManualResetEventSlim AllowLoad = new ManualResetEventSlim();
|
||||||
|
public Editor? Editor { get; private set; }
|
||||||
|
|
||||||
|
protected override Editor CreateEditor() => Editor = new DelayedLoadEditor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class DelayedLoadEditor : Editor
|
||||||
|
{
|
||||||
|
private readonly DelayedLoadEditorLoader loader;
|
||||||
|
|
||||||
|
public DelayedLoadEditor(DelayedLoadEditorLoader loader)
|
||||||
|
: base(loader)
|
||||||
|
{
|
||||||
|
this.loader = loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
// Importantly, this occurs before base.load().
|
||||||
|
if (!loader.AllowLoad.Wait(TimeSpan.FromSeconds(10)))
|
||||||
|
throw new TimeoutException();
|
||||||
|
|
||||||
|
return base.CreateChildDependencies(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -952,6 +952,8 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestTouchScreenDetectionAtSongSelect()
|
public void TestTouchScreenDetectionAtSongSelect()
|
||||||
{
|
{
|
||||||
|
AddUntilStep("wait for settings", () => Game.Settings.IsLoaded);
|
||||||
|
|
||||||
AddStep("touch logo", () =>
|
AddStep("touch logo", () =>
|
||||||
{
|
{
|
||||||
var button = Game.ChildrenOfType<OsuLogo>().Single();
|
var button = Game.ChildrenOfType<OsuLogo>().Single();
|
||||||
|
@ -157,6 +157,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
setUpCommentsResponse(getExampleComments());
|
setUpCommentsResponse(getExampleComments());
|
||||||
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
|
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
|
||||||
|
AddUntilStep("comments shown", () => commentsContainer.ChildrenOfType<DrawableComment>().Any());
|
||||||
|
|
||||||
setUpPostResponse();
|
setUpPostResponse();
|
||||||
AddStep("enter text", () => editorTextBox.Current.Value = "comm");
|
AddStep("enter text", () => editorTextBox.Current.Value = "comm");
|
||||||
@ -175,6 +176,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
setUpCommentsResponse(getExampleComments());
|
setUpCommentsResponse(getExampleComments());
|
||||||
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
|
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
|
||||||
|
AddUntilStep("comments shown", () => commentsContainer.ChildrenOfType<DrawableComment>().Any());
|
||||||
|
|
||||||
setUpPostResponse(true);
|
setUpPostResponse(true);
|
||||||
AddStep("enter text", () => editorTextBox.Current.Value = "comm");
|
AddStep("enter text", () => editorTextBox.Current.Value = "comm");
|
||||||
|
@ -609,7 +609,7 @@ namespace osu.Game.Screens.Select
|
|||||||
// clear pending task immediately to track any potential nested debounce operation.
|
// clear pending task immediately to track any potential nested debounce operation.
|
||||||
selectionChangedDebounce = null;
|
selectionChangedDebounce = null;
|
||||||
|
|
||||||
Logger.Log($"Song select updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ShortName ?? "null"}");
|
Logger.Log($"Song select updating selection with beatmap: {beatmap} {beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ShortName ?? "null"}");
|
||||||
|
|
||||||
if (transferRulesetValue())
|
if (transferRulesetValue())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user