Add failing test

This commit is contained in:
Dean Herbert 2019-11-13 18:54:33 +09:00
parent 4adf967801
commit bca1be0bfa
2 changed files with 39 additions and 18 deletions

View File

@ -57,23 +57,6 @@ namespace osu.Game.Tests.Visual.SongSelect
typeof(DrawableCarouselBeatmapSet), typeof(DrawableCarouselBeatmapSet),
}; };
private class TestSongSelect : PlaySongSelect
{
public Action StartRequested;
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
public WorkingBeatmap CurrentBeatmap => Beatmap.Value;
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
public new BeatmapCarousel Carousel => base.Carousel;
protected override bool OnStart()
{
StartRequested?.Invoke();
return base.OnStart();
}
}
private TestSongSelect songSelect; private TestSongSelect songSelect;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -101,6 +84,17 @@ namespace osu.Game.Tests.Visual.SongSelect
manager?.Delete(manager.GetAllUsableBeatmapSets()); manager?.Delete(manager.GetAllUsableBeatmapSets());
}); });
[Test]
public void TestSingleFilterOnEnter()
{
addRulesetImportStep(0);
addRulesetImportStep(0);
createSongSelect();
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
}
[Test] [Test]
public void TestAudioResuming() public void TestAudioResuming()
{ {
@ -357,5 +351,30 @@ namespace osu.Game.Tests.Visual.SongSelect
base.Dispose(isDisposing); base.Dispose(isDisposing);
rulesets?.Dispose(); rulesets?.Dispose();
} }
private class TestSongSelect : PlaySongSelect
{
public Action StartRequested;
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
public WorkingBeatmap CurrentBeatmap => Beatmap.Value;
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
public new BeatmapCarousel Carousel => base.Carousel;
protected override bool OnStart()
{
StartRequested?.Invoke();
return base.OnStart();
}
public int FilterCount;
protected override void ApplyFilterToCarousel(FilterCriteria criteria)
{
FilterCount++;
base.ApplyFilterToCarousel(criteria);
}
}
} }
} }

View File

@ -165,7 +165,7 @@ namespace osu.Game.Screens.Select
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = FilterControl.HEIGHT, Height = FilterControl.HEIGHT,
FilterChanged = c => Carousel.Filter(c), FilterChanged = ApplyFilterToCarousel,
Background = { Width = 2 }, Background = { Width = 2 },
}, },
} }
@ -217,6 +217,8 @@ namespace osu.Game.Screens.Select
BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score)); BeatmapDetails.Leaderboard.ScoreSelected += score => this.Push(new SoloResults(score));
} }
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria) => Carousel.Filter(criteria);
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores) private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
{ {