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

Fix taiko playfield test scene

This commit is contained in:
Salman Ahmed 2024-01-25 16:31:12 +03:00
parent 5aa4235c3d
commit c35df0313f

View File

@ -1,17 +1,19 @@
// 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 NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Beatmaps; using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Tests.Skinning namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{ {
@ -37,11 +39,14 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
Beatmap.Value.Track.Start(); Beatmap.Value.Track.Start();
}); });
AddStep("Load playfield", () => SetContents(_ => new TaikoPlayfield AddStep("Load playfield", () => SetContents(_ => new Container
{ {
Height = 0.2f,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(2f, 1f),
Scale = new Vector2(0.5f),
Child = new TaikoPlayfieldAdjustmentContainer { Child = new TaikoPlayfield() },
})); }));
} }
@ -54,7 +59,20 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[Test] [Test]
public void TestHeightChanges() public void TestHeightChanges()
{ {
AddRepeatStep("change height", () => this.ChildrenOfType<TaikoPlayfield>().ForEach(p => p.Height = Math.Max(0.2f, (p.Height + 0.2f) % 1f)), 50); int value = 0;
AddRepeatStep("change height", () =>
{
value = (value + 1) % 5;
this.ChildrenOfType<TaikoPlayfieldAdjustmentContainer>().ForEach(p =>
{
var parent = (Container)p.Parent.AsNonNull();
parent.Scale = new Vector2(0.5f + 0.1f * value);
parent.Width = 1f / parent.Scale.X;
parent.Height = 0.5f / parent.Scale.Y;
});
}, 50);
} }
[Test] [Test]