Add tests for (and fix) removal of last item in carousel

This commit is contained in:
Dean Herbert
2017-12-16 00:33:09 +09:00
parent fd9d900ae0
commit a8a2c233a0
5 changed files with 69 additions and 9 deletions

View File

@ -24,5 +24,22 @@ namespace osu.Game.Screens.Select.Carousel
}
};
}
protected override void ItemStateChanged(CarouselItem item, CarouselItemState value)
{
base.ItemStateChanged(item, value);
if (value == CarouselItemState.NotSelected)
{
if (Children.All(i => i.State != CarouselItemState.Selected))
{
var first = Children.FirstOrDefault(i => !i.Filtered);
if (first != null)
{
first.State.Value = CarouselItemState.Selected;
}
}
}
}
}
}