Fix some test issues

This commit is contained in:
Mk-56spn
2022-09-05 04:49:48 +02:00
parent 0c6d8efa28
commit aace334fb3
2 changed files with 13 additions and 13 deletions

View File

@ -107,13 +107,13 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("circle added", () => AddAssert("circle added", () =>
this.ChildrenOfType<ColourHitErrorMeter>().All( this.ChildrenOfType<ColourHitErrorMeter>().All(
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 1)); meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Count() == 1));
AddStep("miss", () => newJudgement(50, HitResult.Miss)); AddStep("miss", () => newJudgement(50, HitResult.Miss));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("circle added", () => AddAssert("circle added", () =>
this.ChildrenOfType<ColourHitErrorMeter>().All( this.ChildrenOfType<ColourHitErrorMeter>().All(
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 2)); meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Count() == 2));
} }
[Test] [Test]
@ -123,11 +123,11 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("small bonus", () => newJudgement(result: HitResult.SmallBonus)); AddStep("small bonus", () => newJudgement(result: HitResult.SmallBonus));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
AddStep("large bonus", () => newJudgement(result: HitResult.LargeBonus)); AddStep("large bonus", () => newJudgement(result: HitResult.LargeBonus));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
} }
[Test] [Test]
@ -137,11 +137,11 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("ignore hit", () => newJudgement(result: HitResult.IgnoreHit)); AddStep("ignore hit", () => newJudgement(result: HitResult.IgnoreHit));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
AddStep("ignore miss", () => newJudgement(result: HitResult.IgnoreMiss)); AddStep("ignore miss", () => newJudgement(result: HitResult.IgnoreMiss));
AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("no bars added", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("no circle added", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
} }
[Test] [Test]
@ -155,16 +155,16 @@ namespace osu.Game.Tests.Visual.Gameplay
hitErrorMeter.Hide(); hitErrorMeter.Hide();
}); });
AddRepeatStep("hit", () => newJudgement(), ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS * 2); AddRepeatStep("hit", () => newJudgement(), ColourHitErrorMeter.HitErrorShape. *2);
AddAssert("bars added", () => this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("bars added", () => this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("circle added", () => this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("circle added", () => this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
AddUntilStep("wait for bars to disappear", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddUntilStep("wait for bars to disappear", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddUntilStep("ensure max circles not exceeded", () => AddUntilStep("ensure max circles not exceeded", () =>
{ {
return this.ChildrenOfType<ColourHitErrorMeter>() return this.ChildrenOfType<ColourHitErrorMeter>()
.All(m => m.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() <= ColourHitErrorMeter.MAX_DISPLAYED_JUDGEMENTS); .All(m => m.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Count() <= ColourHitErrorMeter.HitShapeCount.Default);
}); });
AddStep("show displays", () => AddStep("show displays", () =>
@ -183,12 +183,12 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("bar added", () => this.ChildrenOfType<BarHitErrorMeter>().All( AddAssert("bar added", () => this.ChildrenOfType<BarHitErrorMeter>().All(
meter => meter.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Count() == 1)); meter => meter.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Count() == 1));
AddAssert("circle added", () => this.ChildrenOfType<ColourHitErrorMeter>().All( AddAssert("circle added", () => this.ChildrenOfType<ColourHitErrorMeter>().All(
meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Count() == 1)); meter => meter.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Count() == 1));
AddStep("clear", () => this.ChildrenOfType<HitErrorMeter>().ForEach(meter => meter.Clear())); AddStep("clear", () => this.ChildrenOfType<HitErrorMeter>().ForEach(meter => meter.Clear()));
AddAssert("bar cleared", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any()); AddAssert("bar cleared", () => !this.ChildrenOfType<BarHitErrorMeter.JudgementLine>().Any());
AddAssert("colour cleared", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorCircle>().Any()); AddAssert("colour cleared", () => !this.ChildrenOfType<ColourHitErrorMeter.HitErrorShape>().Any());
} }
private void recreateDisplay(HitWindows hitWindows, float overallDifficulty) private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System; using System;
@ -110,7 +110,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
} }
} }
private class HitErrorShape : Container public class HitErrorShape : Container
{ {
public bool IsRemoved { get; private set; } public bool IsRemoved { get; private set; }