mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into fix-player-testcase
This commit is contained in:
@ -196,9 +196,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible;
|
||||
|
||||
public PausePlayer()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
PauseOnFocusLost = false;
|
||||
base.LoadComplete();
|
||||
HUDOverlay.HoldToQuit.PauseOnFocusLost = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,12 +129,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
case ScrollingDirection.Up:
|
||||
obj.Anchor = Anchor.TopCentre;
|
||||
break;
|
||||
|
||||
case ScrollingDirection.Down:
|
||||
obj.Anchor = Anchor.BottomCentre;
|
||||
break;
|
||||
|
||||
case ScrollingDirection.Left:
|
||||
obj.Anchor = Anchor.CentreLeft;
|
||||
break;
|
||||
|
||||
case ScrollingDirection.Right:
|
||||
obj.Anchor = Anchor.CentreRight;
|
||||
break;
|
||||
@ -189,6 +192,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 2;
|
||||
break;
|
||||
|
||||
case ScrollingDirection.Left:
|
||||
case ScrollingDirection.Right:
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
@ -508,6 +508,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>(),
|
||||
};
|
||||
|
||||
for (int b = 1; b < 101; b++)
|
||||
{
|
||||
toReturn.Beatmaps.Add(new BeatmapInfo
|
||||
|
@ -83,15 +83,19 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
case OsuRuleset _:
|
||||
testInfoLabels(5);
|
||||
break;
|
||||
|
||||
case TaikoRuleset _:
|
||||
testInfoLabels(5);
|
||||
break;
|
||||
|
||||
case CatchRuleset _:
|
||||
testInfoLabels(5);
|
||||
break;
|
||||
|
||||
case ManiaRuleset _:
|
||||
testInfoLabels(4);
|
||||
break;
|
||||
|
||||
default:
|
||||
testInfoLabels(2);
|
||||
break;
|
||||
|
16
osu.Game.Tests/Visual/TestCaseCharLookup.cs
Normal file
16
osu.Game.Tests/Visual/TestCaseCharLookup.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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 osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseCharLookup : OsuTestCase
|
||||
{
|
||||
public TestCaseCharLookup()
|
||||
{
|
||||
AddStep("null", () => { });
|
||||
AddStep("display acharacter", () => Add(new OsuSpriteText { Text = "振込申請" }));
|
||||
}
|
||||
}
|
||||
}
|
@ -86,12 +86,15 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
case 0:
|
||||
sendHelloNotification();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sendAmazingNotification();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
sendUploadProgress();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
sendDownloadProgress();
|
||||
break;
|
||||
|
@ -1,22 +1,27 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestCaseUpdateableBeatmapBackgroundSprite : OsuTestCase
|
||||
{
|
||||
private TestUpdateableBeatmapBackgroundSprite backgroundSprite;
|
||||
private BeatmapSetInfo testBeatmap;
|
||||
private IAPIProvider api;
|
||||
private RulesetStore rulesets;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
@ -24,40 +29,121 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osu, IAPIProvider api, RulesetStore rulesets)
|
||||
{
|
||||
Bindable<BeatmapInfo> beatmapBindable = new Bindable<BeatmapInfo>();
|
||||
this.api = api;
|
||||
this.rulesets = rulesets;
|
||||
|
||||
var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);
|
||||
testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu);
|
||||
}
|
||||
|
||||
Child = backgroundSprite = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
[Test]
|
||||
public void TestNullBeatmap()
|
||||
{
|
||||
TestUpdateableBeatmapBackgroundSprite background = null;
|
||||
|
||||
backgroundSprite.Beatmap.BindTo(beatmapBindable);
|
||||
AddStep("load null beatmap", () => Child = background = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both });
|
||||
AddUntilStep("wait for load", () => background.ContentLoaded);
|
||||
}
|
||||
|
||||
var req = new GetBeatmapSetRequest(1);
|
||||
api.Queue(req);
|
||||
[Test]
|
||||
public void TestLocalBeatmap()
|
||||
{
|
||||
TestUpdateableBeatmapBackgroundSprite background = null;
|
||||
|
||||
AddStep("load null beatmap", () => beatmapBindable.Value = null);
|
||||
AddUntilStep("wait for cleanup...", () => backgroundSprite.ChildCount == 1);
|
||||
AddStep("load imported beatmap", () => beatmapBindable.Value = imported.Beatmaps.First());
|
||||
AddUntilStep("wait for cleanup...", () => backgroundSprite.ChildCount == 1);
|
||||
AddStep("load local beatmap", () =>
|
||||
{
|
||||
Child = background = new TestUpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = { Value = testBeatmap.Beatmaps.First() }
|
||||
};
|
||||
});
|
||||
|
||||
AddUntilStep("wait for load", () => background.ContentLoaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlineBeatmap()
|
||||
{
|
||||
if (api.IsLoggedIn)
|
||||
{
|
||||
var req = new GetBeatmapSetRequest(1);
|
||||
api.Queue(req);
|
||||
|
||||
AddUntilStep("wait for api response", () => req.Result != null);
|
||||
AddStep("load online beatmap", () => beatmapBindable.Value = new BeatmapInfo
|
||||
|
||||
TestUpdateableBeatmapBackgroundSprite background = null;
|
||||
|
||||
AddStep("load online beatmap", () =>
|
||||
{
|
||||
BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
|
||||
Child = background = new TestUpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Beatmap = { Value = new BeatmapInfo { BeatmapSet = req.Result?.ToBeatmapSet(rulesets) } }
|
||||
};
|
||||
});
|
||||
AddUntilStep("wait for cleanup...", () => backgroundSprite.ChildCount == 1);
|
||||
|
||||
AddUntilStep("wait for load", () => background.ContentLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStep("online (login first)", () => { });
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUnloadAndReload()
|
||||
{
|
||||
var backgrounds = new List<TestUpdateableBeatmapBackgroundSprite>();
|
||||
ScrollContainer scrollContainer = null;
|
||||
|
||||
AddStep("create backgrounds hierarchy", () =>
|
||||
{
|
||||
FillFlowContainer backgroundFlow;
|
||||
|
||||
Child = scrollContainer = new ScrollContainer
|
||||
{
|
||||
Size = new Vector2(500),
|
||||
Child = backgroundFlow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(10),
|
||||
Padding = new MarginPadding { Bottom = 250 }
|
||||
}
|
||||
};
|
||||
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
var background = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
if (i % 2 == 0)
|
||||
background.Beatmap.Value = testBeatmap.Beatmaps.First();
|
||||
|
||||
backgroundFlow.Add(new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 100,
|
||||
Masking = true,
|
||||
Child = background
|
||||
});
|
||||
|
||||
backgrounds.Add(background);
|
||||
}
|
||||
});
|
||||
|
||||
var loadedBackgrounds = backgrounds.Where(b => b.ContentLoaded);
|
||||
|
||||
int initialLoadCount = 0;
|
||||
|
||||
AddUntilStep("some loaded", () => (initialLoadCount = loadedBackgrounds.Count()) > 0);
|
||||
AddStep("scroll to bottom", () => scrollContainer.ScrollToEnd());
|
||||
AddUntilStep("some unloaded", () => loadedBackgrounds.Count() < initialLoadCount);
|
||||
}
|
||||
|
||||
private class TestUpdateableBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite
|
||||
{
|
||||
public int ChildCount => InternalChildren.Count;
|
||||
protected override double UnloadDelay => 2000;
|
||||
|
||||
public bool ContentLoaded => ((DelayedLoadUnloadWrapper)InternalChildren.LastOrDefault())?.Content?.IsLoaded ?? false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user