1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:07:29 +08:00

Tidy up various things everywhere

This commit is contained in:
Dean Herbert 2022-07-28 18:20:08 +09:00
parent 0d36907cad
commit 7108553883
2 changed files with 19 additions and 18 deletions

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
@ -11,6 +9,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
@ -20,18 +19,20 @@ namespace osu.Game.Tests.Visual.Gameplay
[TestFixture]
public class TestSceneSongProgress : SkinnableHUDComponentTestScene
{
private DefaultSongProgress progress => this.ChildrenOfType<DefaultSongProgress>().Single();
private GameplayClockContainer gameplayClockContainer;
private const double gameplay_start_time = -2000;
private GameplayClockContainer gameplayClockContainer = null!;
private const double skip_target_time = -2000;
[BackgroundDependencyLoader]
private void load()
{
var working = CreateWorkingBeatmap(Ruleset.Value);
working.LoadTrack();
Add(gameplayClockContainer = new MasterGameplayClockContainer(working, gameplay_start_time));
Dependencies.CacheAs(gameplayClockContainer);
Dependencies.CacheAs(gameplayClockContainer.GameplayClock);
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
Beatmap.Value.LoadTrack();
Add(gameplayClockContainer = new MasterGameplayClockContainer(Beatmap.Value, skip_target_time));
Dependencies.CacheAs(gameplayClockContainer); // required for StartTime
Dependencies.CacheAs(gameplayClockContainer.GameplayClock); // required for everything else
}
[SetUpSteps]
@ -44,7 +45,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
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("stop", gameplayClockContainer.Stop);
}
@ -52,11 +53,13 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestToggleSeeking()
{
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
AddStep("hide graph", () => progress.ShowGraph.Value = false);
AddStep("disallow seeking", () => progress.AllowSeeking.Value = false);
AddStep("allow seeking", () => progress.AllowSeeking.Value = true);
AddStep("show graph", () => progress.ShowGraph.Value = true);
DefaultSongProgress getDefaultProgress() => this.ChildrenOfType<DefaultSongProgress>().Single();
AddStep("allow seeking", () => getDefaultProgress().AllowSeeking.Value = true);
AddStep("hide graph", () => getDefaultProgress().ShowGraph.Value = false);
AddStep("disallow seeking", () => getDefaultProgress().AllowSeeking.Value = false);
AddStep("allow seeking", () => getDefaultProgress().AllowSeeking.Value = true);
AddStep("show graph", () => getDefaultProgress().ShowGraph.Value = true);
}
private void setHitObjects()

View File

@ -19,8 +19,6 @@ namespace osu.Game.Screens.Play.HUD
{
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 bottom_bar_height = 5;
private const float graph_height = SquareGraph.Column.WIDTH * 6;