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

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using osu.Framework.Configuration;
using osu.Framework.Logging;
namespace osu.Game.Screens.Select.Carousel
{
@ -48,6 +49,8 @@ namespace osu.Game.Screens.Select.Carousel
{
if (InternalChildren == null) return;
Logger.Log($"State changed to {v}");
switch (v)
{
case CarouselItemState.Hidden:
@ -56,6 +59,12 @@ namespace osu.Game.Screens.Select.Carousel
break;
}
};
Filtered.ValueChanged += v =>
{
if (v && State == CarouselItemState.Selected)
State.Value = CarouselItemState.NotSelected;
};
}
private readonly Lazy<DrawableCarouselItem> drawableRepresentation;