mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:52:54 +08:00
Tidy up various things everywhere
This commit is contained in:
parent
0d36907cad
commit
7108553883
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -11,6 +9,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -20,18 +19,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneSongProgress : SkinnableHUDComponentTestScene
|
public class TestSceneSongProgress : SkinnableHUDComponentTestScene
|
||||||
{
|
{
|
||||||
private DefaultSongProgress progress => this.ChildrenOfType<DefaultSongProgress>().Single();
|
private GameplayClockContainer gameplayClockContainer = null!;
|
||||||
private GameplayClockContainer gameplayClockContainer;
|
|
||||||
private const double gameplay_start_time = -2000;
|
private const double skip_target_time = -2000;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
var working = CreateWorkingBeatmap(Ruleset.Value);
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
working.LoadTrack();
|
Beatmap.Value.LoadTrack();
|
||||||
Add(gameplayClockContainer = new MasterGameplayClockContainer(working, gameplay_start_time));
|
|
||||||
Dependencies.CacheAs(gameplayClockContainer);
|
Add(gameplayClockContainer = new MasterGameplayClockContainer(Beatmap.Value, skip_target_time));
|
||||||
Dependencies.CacheAs(gameplayClockContainer.GameplayClock);
|
|
||||||
|
Dependencies.CacheAs(gameplayClockContainer); // required for StartTime
|
||||||
|
Dependencies.CacheAs(gameplayClockContainer.GameplayClock); // required for everything else
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestDisplay()
|
public void TestDisplay()
|
||||||
{
|
{
|
||||||
AddStep("seek to intro", () => gameplayClockContainer.Seek(gameplay_start_time));
|
AddStep("seek to intro", () => gameplayClockContainer.Seek(skip_target_time));
|
||||||
AddStep("start", gameplayClockContainer.Start);
|
AddStep("start", gameplayClockContainer.Start);
|
||||||
AddStep("stop", gameplayClockContainer.Stop);
|
AddStep("stop", gameplayClockContainer.Stop);
|
||||||
}
|
}
|
||||||
@ -52,11 +53,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestToggleSeeking()
|
public void TestToggleSeeking()
|
||||||
{
|
{
|
||||||
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
DefaultSongProgress getDefaultProgress() => this.ChildrenOfType<DefaultSongProgress>().Single();
|
||||||
AddStep("hide graph", () => progress.ShowGraph.Value = false);
|
|
||||||
AddStep("disallow seeking", () => progress.AllowSeeking.Value = false);
|
AddStep("allow seeking", () => getDefaultProgress().AllowSeeking.Value = true);
|
||||||
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
|
AddStep("hide graph", () => getDefaultProgress().ShowGraph.Value = false);
|
||||||
AddStep("show graph", () => progress.ShowGraph.Value = true);
|
AddStep("disallow seeking", () => getDefaultProgress().AllowSeeking.Value = false);
|
||||||
|
AddStep("allow seeking", () => getDefaultProgress().AllowSeeking.Value = true);
|
||||||
|
AddStep("show graph", () => getDefaultProgress().ShowGraph.Value = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setHitObjects()
|
private void setHitObjects()
|
||||||
|
@ -19,8 +19,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public class DefaultSongProgress : SongProgress
|
public class DefaultSongProgress : SongProgress
|
||||||
{
|
{
|
||||||
public const float MAX_HEIGHT = info_height + bottom_bar_height + graph_height + handle_height;
|
|
||||||
|
|
||||||
private const float info_height = 20;
|
private const float info_height = 20;
|
||||||
private const float bottom_bar_height = 5;
|
private const float bottom_bar_height = 5;
|
||||||
private const float graph_height = SquareGraph.Column.WIDTH * 6;
|
private const float graph_height = SquareGraph.Column.WIDTH * 6;
|
||||||
|
Loading…
Reference in New Issue
Block a user