mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Merge remote-tracking branch 'upstream/master' into more-inspections
This commit is contained in:
@ -4,10 +4,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -21,8 +21,12 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(OsuLogo),
|
||||
};
|
||||
|
||||
public TestCaseOsuGame()
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
OsuGame game = new OsuGame();
|
||||
game.SetHost(host);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -30,10 +34,7 @@ namespace osu.Game.Tests.Visual
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
new ScreenStack(new Loader())
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
game
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Tests.Visual
|
||||
public class TestCaseSongProgress : OsuTestCase
|
||||
{
|
||||
private readonly SongProgress progress;
|
||||
private readonly SongProgressGraph graph;
|
||||
private readonly TestSongProgressGraph graph;
|
||||
|
||||
private readonly StopwatchClock clock;
|
||||
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual
|
||||
Origin = Anchor.BottomLeft,
|
||||
});
|
||||
|
||||
Add(graph = new SongProgressGraph
|
||||
Add(graph = new TestSongProgressGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 200,
|
||||
@ -39,13 +39,24 @@ namespace osu.Game.Tests.Visual
|
||||
Origin = Anchor.TopLeft,
|
||||
});
|
||||
|
||||
AddWaitStep(5);
|
||||
AddAssert("ensure not created", () => graph.CreationCount == 0);
|
||||
|
||||
AddStep("display values", displayNewValues);
|
||||
AddWaitStep(5);
|
||||
AddUntilStep(() => graph.CreationCount == 1, "wait for creation count");
|
||||
|
||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
||||
AddWaitStep(5);
|
||||
AddUntilStep(() => graph.CreationCount == 1, "wait for creation count");
|
||||
|
||||
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
||||
AddWaitStep(2);
|
||||
AddWaitStep(5);
|
||||
AddUntilStep(() => graph.CreationCount == 1, "wait for creation count");
|
||||
AddRepeatStep("New Values", displayNewValues, 5);
|
||||
|
||||
displayNewValues();
|
||||
AddWaitStep(5);
|
||||
AddAssert("ensure debounced", () => graph.CreationCount == 2);
|
||||
}
|
||||
|
||||
private void displayNewValues()
|
||||
@ -60,5 +71,16 @@ namespace osu.Game.Tests.Visual
|
||||
progress.AudioClock = clock;
|
||||
progress.OnSeek = pos => clock.Seek(pos);
|
||||
}
|
||||
|
||||
private class TestSongProgressGraph : SongProgressGraph
|
||||
{
|
||||
public int CreationCount { get; private set; }
|
||||
|
||||
protected override void RecreateGraph()
|
||||
{
|
||||
base.RecreateGraph();
|
||||
CreationCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user