mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Merge pull request #2446 from peppy/more-test-fixes
Fix some occasionally failing tests
This commit is contained in:
commit
5b8793c390
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
var items = new List<DrawableCarouselItem>();
|
||||
|
||||
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<DrawableCarouselItem>(CreateDrawableRepresentation);
|
||||
DrawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
|
||||
|
||||
Filtered.ValueChanged += v =>
|
||||
{
|
||||
@ -44,13 +44,16 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
};
|
||||
}
|
||||
|
||||
private readonly Lazy<DrawableCarouselItem> drawableRepresentation;
|
||||
protected readonly Lazy<DrawableCarouselItem> DrawableRepresentation;
|
||||
|
||||
/// <summary>
|
||||
/// Used as a default sort method for <see cref="CarouselItem"/>s of differing types.
|
||||
/// </summary>
|
||||
internal ulong ChildID;
|
||||
|
||||
/// <summary>
|
||||
/// Create a fresh drawable version of this item. If you wish to consume the current representation, use <see cref="DrawableRepresentation"/> instead.
|
||||
/// </summary>
|
||||
protected abstract DrawableCarouselItem CreateDrawableRepresentation();
|
||||
|
||||
public virtual void Filter(FilterCriteria criteria)
|
||||
|
Loading…
Reference in New Issue
Block a user