From b8b86cbd2ae50baafae55158e9bb65187a76467c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 12 Nov 2021 21:41:17 +0100 Subject: [PATCH] Add failing tests for desired multiple selection behaviour --- ...ceneHitObjectDifficultyPointAdjustments.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs index bbae10e5ff..a678582dd6 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectDifficultyPointAdjustments.cs @@ -85,6 +85,46 @@ public void TestSingleSelection() hitObjectHasVelocity(1, 5); } + [Test] + public void TestMultipleSelectionWithSameSliderVelocity() + { + AddStep("unify slider velocity", () => + { + foreach (var h in EditorBeatmap.HitObjects) + h.DifficultyControlPoint.SliderVelocity = 1.5; + }); + + AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects)); + clickDifficultyPiece(0); + velocityPopoverHasSingleValue(1.5); + + dismissPopover(); + + clickDifficultyPiece(1); + velocityPopoverHasSingleValue(1.5); + + setVelocityViaPopover(5); + hitObjectHasVelocity(0, 5); + hitObjectHasVelocity(1, 5); + } + + [Test] + public void TestMultipleSelectionWithDifferentSliderVelocity() + { + AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects)); + clickDifficultyPiece(0); + velocityPopoverHasIndeterminateValue(); + + dismissPopover(); + + clickDifficultyPiece(1); + velocityPopoverHasIndeterminateValue(); + + setVelocityViaPopover(3); + hitObjectHasVelocity(0, 3); + hitObjectHasVelocity(1, 3); + } + private void clickDifficultyPiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} difficulty piece", () => { var difficultyPiece = this.ChildrenOfType().Single(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); @@ -101,6 +141,14 @@ private void velocityPopoverHasSingleValue(double velocity) => AddUntilStep($"ve return slider?.Current.Value == velocity; }); + private void velocityPopoverHasIndeterminateValue() => AddUntilStep("velocity popover has indeterminate value", () => + { + var popover = this.ChildrenOfType().SingleOrDefault(); + var slider = popover?.ChildrenOfType>().Single(); + + return slider != null && slider.Current.Value == null; + }); + private void dismissPopover() { AddStep("dismiss popover", () => InputManager.Key(Key.Escape));