diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 51a8bacd2e..886c1120d4 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -52,6 +52,9 @@ namespace osu.Game.Tests.Visual infoWedge.UpdateBeatmap(beatmap); }); + // select part is redundant, but wait for load isn't + selectBeatmap(beatmap.Value.Beatmap); + AddWaitStep(3); AddStep("hide", () => { infoWedge.State = Visibility.Hidden; }); @@ -63,10 +66,11 @@ namespace osu.Game.Tests.Visual foreach (var rulesetInfo in rulesets.AvailableRulesets) { var ruleset = rulesetInfo.CreateInstance(); - beatmaps.Add(createTestBeatmap(rulesetInfo)); + var testBeatmap = createTestBeatmap(rulesetInfo); - var name = rulesetInfo.ShortName; - selectBeatmap(name); + beatmaps.Add(testBeatmap); + + selectBeatmap(testBeatmap); // TODO: adjust cases once more info is shown for other gamemodes switch (ruleset) @@ -108,16 +112,14 @@ namespace osu.Game.Tests.Visual AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } - private void selectBeatmap(string name) + private void selectBeatmap(Beatmap b) { BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null; - AddStep($"select {name} beatmap", () => + AddStep($"select {b.Metadata.Title} beatmap", () => { infoBefore = infoWedge.Info; - WorkingBeatmap bm = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); - beatmap.Value = bm; - infoWedge.UpdateBeatmap(beatmap); + infoWedge.UpdateBeatmap(beatmap.Value = new TestWorkingBeatmap(b)); }); AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load"); diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index a1f44763d6..2118cfdc78 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -27,6 +27,11 @@ namespace osu.Game.Screens.Select.Carousel get { var drawables = base.Drawables; + + // if we are explicitly not present, don't ever present children. + // without this check, children drawables can potentially be presented without their group header. + if (DrawableRepresentation.Value?.IsPresent == false) return drawables; + foreach (var c in InternalChildren) drawables.AddRange(c.Drawables); return drawables; diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index 0de32c12f1..c0781f09c0 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select.Carousel { var items = new List(); - var self = drawableRepresentation.Value; + var self = DrawableRepresentation.Value; if (self?.IsPresent == true) items.Add(self); return items; @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select.Carousel protected CarouselItem() { - drawableRepresentation = new Lazy(CreateDrawableRepresentation); + DrawableRepresentation = new Lazy(CreateDrawableRepresentation); Filtered.ValueChanged += v => { @@ -44,13 +44,16 @@ namespace osu.Game.Screens.Select.Carousel }; } - private readonly Lazy drawableRepresentation; + protected readonly Lazy DrawableRepresentation; /// /// Used as a default sort method for s of differing types. /// internal ulong ChildID; + /// + /// Create a fresh drawable version of this item. If you wish to consume the current representation, use instead. + /// protected abstract DrawableCarouselItem CreateDrawableRepresentation(); public virtual void Filter(FilterCriteria criteria)