Add better test coverage of hit lighting (and ensure reset after animation reapplication)

This commit is contained in:
Dean Herbert 2020-11-19 14:10:07 +09:00
parent ba735584fa
commit 3024ae6d86
2 changed files with 5 additions and 4 deletions

View File

@ -43,8 +43,8 @@ namespace osu.Game.Rulesets.Osu.Tests
showResult(HitResult.Great); showResult(HitResult.Great);
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any()); AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
AddAssert("hit lighting hidden", AddAssert("hit lighting has no transforms", () => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => !judgement.Lighting.Transforms.Any()));
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => !judgement.Lighting.Transforms.Any())); AddAssert("hit lighting hidden", () => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.Lighting.Alpha == 0));
} }
[Test] [Test]
@ -55,8 +55,7 @@ namespace osu.Game.Rulesets.Osu.Tests
showResult(HitResult.Great); showResult(HitResult.Great);
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any()); AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
AddAssert("hit lighting shown", AddUntilStep("hit lighting shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any(judgement => judgement.Lighting.Alpha > 0));
() => this.ChildrenOfType<TestDrawableOsuJudgement>().Any(judgement => judgement.Lighting.Transforms.Any()));
} }
private void showResult(HitResult result) private void showResult(HitResult result)

View File

@ -48,6 +48,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
bool hitLightingEnabled = config.Get<bool>(OsuSetting.HitLighting); bool hitLightingEnabled = config.Get<bool>(OsuSetting.HitLighting);
Lighting.Alpha = 0;
if (hitLightingEnabled && Lighting.Drawable != null) if (hitLightingEnabled && Lighting.Drawable != null)
{ {
// todo: this animation changes slightly based on new/old legacy skin versions. // todo: this animation changes slightly based on new/old legacy skin versions.