mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Add failing test coverage showing hit meters don't update when not visible
This commit is contained in:
@ -142,6 +142,36 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestProcessingWhileHidden()
|
||||||
|
{
|
||||||
|
AddStep("OD 1", () => recreateDisplay(new OsuHitWindows(), 1));
|
||||||
|
|
||||||
|
AddStep("hide displays", () =>
|
||||||
|
{
|
||||||
|
foreach (var hitErrorMeter in this.ChildrenOfType<HitErrorMeter>())
|
||||||
|
hitErrorMeter.Hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddRepeatStep("hit", () => newJudgement(), ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS * 2);
|
||||||
|
|
||||||
|
AddAssert("bars added", () => this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddAssert("circle added", () => this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any());
|
||||||
|
|
||||||
|
AddUntilStep("wait for bars to disappear", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
|
||||||
|
AddUntilStep("ensure max circles not exceeded", () =>
|
||||||
|
{
|
||||||
|
return this.ChildrenOfType<ColourHitErrorMeter>()
|
||||||
|
.All(m => m.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() <= ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("show displays", () =>
|
||||||
|
{
|
||||||
|
foreach (var hitErrorMeter in this.ChildrenOfType<HitErrorMeter>())
|
||||||
|
hitErrorMeter.Show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestClear()
|
public void TestClear()
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,11 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
{
|
{
|
||||||
public class ColourHitErrorMeter : HitErrorMeter
|
public class ColourHitErrorMeter : HitErrorMeter
|
||||||
{
|
{
|
||||||
|
internal const int MAX_DISPLAYED_JUDGEMENTS = 20;
|
||||||
|
|
||||||
private const int animation_duration = 200;
|
private const int animation_duration = 200;
|
||||||
|
private const int drawable_judgement_size = 8;
|
||||||
|
private const int spacing = 2;
|
||||||
|
|
||||||
private readonly JudgementFlow judgementsFlow;
|
private readonly JudgementFlow judgementsFlow;
|
||||||
|
|
||||||
@ -37,16 +41,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
|
|
||||||
private class JudgementFlow : FillFlowContainer<HitErrorCircle>
|
private class JudgementFlow : FillFlowContainer<HitErrorCircle>
|
||||||
{
|
{
|
||||||
private const int max_available_judgements = 20;
|
|
||||||
private const int drawable_judgement_size = 8;
|
|
||||||
private const int spacing = 2;
|
|
||||||
|
|
||||||
public override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
|
public override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
|
||||||
|
|
||||||
public JudgementFlow()
|
public JudgementFlow()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.X;
|
||||||
Height = max_available_judgements * (drawable_judgement_size + spacing) - spacing;
|
Height = MAX_DISPLAYED_JUDGEMENTS * (drawable_judgement_size + spacing) - spacing;
|
||||||
Spacing = new Vector2(0, spacing);
|
Spacing = new Vector2(0, spacing);
|
||||||
Direction = FillDirection.Vertical;
|
Direction = FillDirection.Vertical;
|
||||||
LayoutDuration = animation_duration;
|
LayoutDuration = animation_duration;
|
||||||
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
{
|
{
|
||||||
Add(new HitErrorCircle(colour, drawable_judgement_size));
|
Add(new HitErrorCircle(colour, drawable_judgement_size));
|
||||||
|
|
||||||
if (Children.Count > max_available_judgements)
|
if (Children.Count > MAX_DISPLAYED_JUDGEMENTS)
|
||||||
Children.FirstOrDefault(c => !c.IsRemoved)?.Remove();
|
Children.FirstOrDefault(c => !c.IsRemoved)?.Remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user