Refactor StarRatingDisplay to be mutable with a current bindable

This commit is contained in:
Salman Ahmed
2021-05-08 12:55:07 +03:00
parent 5a6c7c30e0
commit 301dab1ce8
2 changed files with 68 additions and 34 deletions

View File

@ -1,8 +1,10 @@
// 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.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Screens.Ranking.Expanded;
@ -10,8 +12,11 @@ namespace osu.Game.Tests.Visual.Ranking
{
public class TestSceneStarRatingDisplay : OsuTestScene
{
public TestSceneStarRatingDisplay()
[SetUp]
public void SetUp() => Schedule(() =>
{
StarRatingDisplay changingStarRating;
Child = new FillFlowContainer
{
Anchor = Anchor.Centre,
@ -25,8 +30,14 @@ namespace osu.Game.Tests.Visual.Ranking
new StarRatingDisplay(new StarDifficulty(5.67, 0)),
new StarRatingDisplay(new StarDifficulty(6.78, 0)),
new StarRatingDisplay(new StarDifficulty(10.11, 0)),
changingStarRating = new StarRatingDisplay(),
}
};
}
Scheduler.AddDelayed(() =>
{
changingStarRating.Current.Value = new StarDifficulty(RNG.NextDouble(0, 10), RNG.Next());
}, 500, true);
});
}
}