mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Allow testing hitting sliders are certain points in tests
This commit is contained in:
parent
1ef0c92962
commit
ec82414090
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -37,14 +38,22 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private readonly BindableBool snakingIn = new BindableBool(true);
|
private readonly BindableBool snakingIn = new BindableBool(true);
|
||||||
private readonly BindableBool snakingOut = new BindableBool(true);
|
private readonly BindableBool snakingOut = new BindableBool(true);
|
||||||
|
|
||||||
[SetUpSteps]
|
private float progressToHit;
|
||||||
public void SetUpSteps()
|
|
||||||
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
AddToggleStep("disable snaking", v =>
|
AddToggleStep("disable snaking", v =>
|
||||||
{
|
{
|
||||||
snakingIn.Value = !v;
|
snakingIn.Value = !v;
|
||||||
snakingOut.Value = !v;
|
snakingOut.Value = !v;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddSliderStep("hit at", 0f, 1f, 0f, v =>
|
||||||
|
{
|
||||||
|
progressToHit = v;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -55,6 +64,18 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
config.BindWith(OsuRulesetSetting.SnakingOutSliders, snakingOut);
|
config.BindWith(OsuRulesetSetting.SnakingOutSliders, snakingOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
foreach (var slider in this.ChildrenOfType<DrawableSlider>())
|
||||||
|
{
|
||||||
|
double completionProgress = Math.Clamp((Time.Current - slider.HitObject.StartTime) / slider.HitObject.Duration, 0, 1);
|
||||||
|
if (completionProgress > progressToHit && !slider.IsHit)
|
||||||
|
slider.HeadCircle.HitArea.Hit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestVariousSliders()
|
public void TestVariousSliders()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user