mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Audio;
|
||||
@ -37,14 +38,22 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
private readonly BindableBool snakingIn = new BindableBool(true);
|
||||
private readonly BindableBool snakingOut = new BindableBool(true);
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
private float progressToHit;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AddToggleStep("disable snaking", v =>
|
||||
{
|
||||
snakingIn.Value = !v;
|
||||
snakingOut.Value = !v;
|
||||
});
|
||||
|
||||
AddSliderStep("hit at", 0f, 1f, 0f, v =>
|
||||
{
|
||||
progressToHit = v;
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -55,6 +64,18 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
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]
|
||||
public void TestVariousSliders()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user