1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:17:51 +08:00
osu-lazer/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoPlayfield.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
2.8 KiB
C#
Raw Normal View History

2020-04-21 17:40:18 +08:00
// 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.
2022-11-07 12:22:01 +08:00
using NUnit.Framework;
2020-04-21 17:40:18 +08:00
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
2024-01-25 21:31:12 +08:00
using osu.Framework.Extensions.ObjectExtensions;
2020-04-21 17:40:18 +08:00
using osu.Framework.Graphics;
2024-01-25 21:31:12 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
2020-04-21 17:40:18 +08:00
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Beatmaps;
2020-04-21 17:40:18 +08:00
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
2024-01-25 21:31:12 +08:00
using osuTK;
2020-04-21 17:40:18 +08:00
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{
public partial class TestSceneTaikoPlayfield : TaikoSkinnableTestScene
{
[Cached(typeof(IScrollingInfo))]
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
{
Direction = { Value = ScrollingDirection.Left },
TimeRange = { Value = 5000 },
};
2022-11-07 12:22:01 +08:00
[SetUpSteps]
public void SetUpSteps()
2020-04-21 17:40:18 +08:00
{
TaikoBeatmap beatmap;
AddStep("set beatmap", () =>
{
Beatmap.Value = CreateWorkingBeatmap(beatmap = new TaikoBeatmap());
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
Beatmap.Value.Track.Start();
});
2024-01-25 21:31:12 +08:00
AddStep("Load playfield", () => SetContents(_ => new Container
2020-04-21 17:40:18 +08:00
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2024-01-25 21:31:12 +08:00
RelativeSizeAxes = Axes.Both,
Size = new Vector2(2f, 1f),
Scale = new Vector2(0.5f),
Child = new TaikoPlayfieldAdjustmentContainer { Child = new TaikoPlayfield() },
2020-04-21 17:40:18 +08:00
}));
2022-11-07 12:22:01 +08:00
}
[Test]
public void TestBasic()
{
AddStep("do nothing", () => { });
}
2022-11-07 12:22:01 +08:00
[Test]
public void TestHeightChanges()
{
2024-01-25 21:31:12 +08:00
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);
2022-11-07 12:22:01 +08:00
}
[Test]
public void TestKiai()
{
bool kiai = false;
AddStep("Toggle kiai", () =>
{
Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new EffectControlPoint { KiaiMode = (kiai = !kiai) });
});
2020-04-21 17:40:18 +08:00
}
}
}