public void TestDifficultyIconSelecting() { addRulesetImportStep(0); createSongSelect(); DrawableCarouselBeatmapSet set = null; AddStep("Find the DrawableCarouselBeatmapSet", () => { set = songSelect.Carousel.ChildrenOfType <DrawableCarouselBeatmapSet>().First(); }); FilterableDifficultyIcon difficultyIcon = null; AddUntilStep("Find an icon", () => { return((difficultyIcon = set.ChildrenOfType <FilterableDifficultyIcon>() .FirstOrDefault(icon => getDifficultyIconIndex(set, icon) != getCurrentBeatmapIndex())) != null); }); AddStep("Click on a difficulty", () => { InputManager.MoveMouseTo(difficultyIcon); InputManager.Click(MouseButton.Left); }); AddAssert("Selected beatmap correct", () => getCurrentBeatmapIndex() == getDifficultyIconIndex(set, difficultyIcon)); double?maxBPM = null; AddStep("Filter some difficulties", () => songSelect.Carousel.Filter(new FilterCriteria { BPM = new FilterCriteria.OptionalRange <double> { Min = maxBPM = songSelect.Carousel.SelectedBeatmapSet.MaxBPM, IsLowerInclusive = true } })); BeatmapInfo filteredBeatmap = null; FilterableDifficultyIcon filteredIcon = null; AddStep("Get filtered icon", () => { var selectedSet = songSelect.Carousel.SelectedBeatmapSet; filteredBeatmap = selectedSet.Beatmaps.First(b => b.BPM < maxBPM); int filteredBeatmapIndex = getBeatmapIndex(selectedSet, filteredBeatmap); filteredIcon = set.ChildrenOfType <FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex); }); AddStep("Click on a filtered difficulty", () => { InputManager.MoveMouseTo(filteredIcon); InputManager.Click(MouseButton.Left); }); AddAssert("Selected beatmap correct", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(filteredBeatmap)); }
public void TestDifficultyIconSelecting() { addRulesetImportStep(0); createSongSelect(); DrawableCarouselBeatmapSet set = null; AddStep("Find the DrawableCarouselBeatmapSet", () => { set = songSelect.Carousel.ChildrenOfType <DrawableCarouselBeatmapSet>().First(); }); DrawableCarouselBeatmapSet.FilterableDifficultyIcon difficultyIcon = null; AddStep("Find an icon", () => { difficultyIcon = set.ChildrenOfType <DrawableCarouselBeatmapSet.FilterableDifficultyIcon>() .First(icon => getDifficultyIconIndex(set, icon) != getCurrentBeatmapIndex()); }); AddStep("Click on a difficulty", () => { InputManager.MoveMouseTo(difficultyIcon); InputManager.PressButton(MouseButton.Left); InputManager.ReleaseButton(MouseButton.Left); }); AddAssert("Selected beatmap correct", () => getCurrentBeatmapIndex() == getDifficultyIconIndex(set, difficultyIcon)); double?maxBPM = null; AddStep("Filter some difficulties", () => songSelect.Carousel.Filter(new FilterCriteria { BPM = new FilterCriteria.OptionalRange <double> { Min = maxBPM = songSelect.Carousel.SelectedBeatmapSet.MaxBPM, IsLowerInclusive = true } })); DrawableCarouselBeatmapSet.FilterableDifficultyIcon filteredIcon = null; AddStep("Get filtered icon", () => { var filteredBeatmap = songSelect.Carousel.SelectedBeatmapSet.Beatmaps.Find(b => b.BPM < maxBPM); int filteredBeatmapIndex = getBeatmapIndex(filteredBeatmap.BeatmapSet, filteredBeatmap); filteredIcon = set.ChildrenOfType <DrawableCarouselBeatmapSet.FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex); }); int?previousID = null; AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmap.ID); AddStep("Click on a filtered difficulty", () => { InputManager.MoveMouseTo(filteredIcon); InputManager.PressButton(MouseButton.Left); InputManager.ReleaseButton(MouseButton.Left); }); AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmap.ID == previousID); }
public void TestDifficultyIconSelectingForDifferentRuleset() { changeRuleset(0); createSongSelect(); AddStep("import multi-ruleset map", () => { var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray(); manager.Import(createTestBeatmapSet(usableRulesets)).Wait(); }); DrawableCarouselBeatmapSet set = null; AddUntilStep("Find the DrawableCarouselBeatmapSet", () => { set = songSelect.Carousel.ChildrenOfType <DrawableCarouselBeatmapSet>().FirstOrDefault(); return(set != null); }); FilterableDifficultyIcon difficultyIcon = null; AddUntilStep("Find an icon for different ruleset", () => { difficultyIcon = set.ChildrenOfType <FilterableDifficultyIcon>() .FirstOrDefault(icon => icon.Item.BeatmapInfo.Ruleset.ID == 3); return(difficultyIcon != null); }); AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0); int previousSetID = 0; AddStep("record set ID", () => previousSetID = Beatmap.Value.BeatmapSetInfo.ID); AddStep("Click on a difficulty", () => { InputManager.MoveMouseTo(difficultyIcon); InputManager.Click(MouseButton.Left); }); AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3); AddAssert("Selected beatmap still same set", () => songSelect.Carousel.SelectedBeatmapInfo.BeatmapSet.ID == previousSetID); AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.ID == 3); }
public void TestGroupedDifficultyIconSelecting() { changeRuleset(0); createSongSelect(); BeatmapSetInfo imported = null; AddStep("import huge difficulty count map", () => { var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray(); imported = manager.Import(createTestBeatmapSet(usableRulesets, 50)).Result; }); AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported.Beatmaps.First())); DrawableCarouselBeatmapSet set = null; AddUntilStep("Find the DrawableCarouselBeatmapSet", () => { set = songSelect.Carousel.ChildrenOfType <DrawableCarouselBeatmapSet>().FirstOrDefault(); return(set != null); }); FilterableGroupedDifficultyIcon groupIcon = null; AddStep("Find group icon for different ruleset", () => { groupIcon = set.ChildrenOfType <FilterableGroupedDifficultyIcon>() .First(icon => icon.Items.First().Beatmap.Ruleset.ID == 3); }); AddAssert("Check ruleset is osu!", () => Ruleset.Value.ID == 0); AddStep("Click on group", () => { InputManager.MoveMouseTo(groupIcon); InputManager.PressButton(MouseButton.Left); InputManager.ReleaseButton(MouseButton.Left); }); AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.ID == 3); AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo == groupIcon.Items.First().Beatmap); }
private int getDifficultyIconIndex(DrawableCarouselBeatmapSet set, FilterableDifficultyIcon icon) { return(set.ChildrenOfType <FilterableDifficultyIcon>().ToList().FindIndex(i => i == icon)); }