mirror of
https://github.com/ppy/osu.git
synced 2024-11-18 10:13:21 +08:00
82 lines
2.7 KiB
C#
82 lines
2.7 KiB
C#
// 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.
|
|
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.UserInterface;
|
|
using osu.Framework.Testing;
|
|
using osu.Game.Overlays;
|
|
using osu.Game.Overlays.Settings;
|
|
using osu.Game.Rulesets;
|
|
using osu.Game.Rulesets.Osu;
|
|
using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
|
using osu.Game.Skinning.Editor;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Tests.Visual.Gameplay
|
|
{
|
|
public class TestSceneSkinEditor : PlayerTestScene
|
|
{
|
|
private SkinEditor skinEditor;
|
|
|
|
protected override bool Autoplay => true;
|
|
|
|
[Cached]
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
|
|
|
[SetUpSteps]
|
|
public override void SetUpSteps()
|
|
{
|
|
base.SetUpSteps();
|
|
|
|
AddStep("reload skin editor", () =>
|
|
{
|
|
skinEditor?.Expire();
|
|
Player.ScaleTo(0.4f);
|
|
LoadComponentAsync(skinEditor = new SkinEditor(Player), Add);
|
|
});
|
|
AddUntilStep("wait for loaded", () => skinEditor.IsLoaded);
|
|
}
|
|
|
|
[Test]
|
|
public void TestToggleEditor()
|
|
{
|
|
AddToggleStep("toggle editor visibility", visible => skinEditor.ToggleVisibility());
|
|
}
|
|
|
|
[Test]
|
|
public void TestEditComponent()
|
|
{
|
|
BarHitErrorMeter hitErrorMeter = null;
|
|
|
|
AddStep("select bar hit error blueprint", () =>
|
|
{
|
|
var blueprint = skinEditor.ChildrenOfType<SkinBlueprint>().First(b => b.Item is BarHitErrorMeter);
|
|
|
|
hitErrorMeter = (BarHitErrorMeter)blueprint.Item;
|
|
skinEditor.SelectedComponents.Clear();
|
|
skinEditor.SelectedComponents.Add(blueprint.Item);
|
|
});
|
|
|
|
AddAssert("value is default", () => hitErrorMeter.JudgementLineThickness.IsDefault);
|
|
|
|
AddStep("hover first slider", () =>
|
|
{
|
|
InputManager.MoveMouseTo(
|
|
skinEditor.ChildrenOfType<SkinSettingsToolbox>().First()
|
|
.ChildrenOfType<SettingsSlider<float>>().First()
|
|
.ChildrenOfType<SliderBar<float>>().First()
|
|
);
|
|
});
|
|
|
|
AddStep("adjust slider via keyboard", () => InputManager.Key(Key.Left));
|
|
|
|
AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
|
|
}
|
|
|
|
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
|
}
|
|
}
|