public void TestLocal([Values] BeatmapSetCoverType coverType)
        {
            AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
            {
                OnlineInfo       = CreateAPIBeatmapSet(),
                RelativeSizeAxes = Axes.Both,
                Masking          = true,
            });

            AddUntilStep("wait for load", () => this.ChildrenOfType <OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
        }
        public void TestUnloadAndReload()
        {
            OsuScrollContainer scroll = null;
            List <UpdateableOnlineBeatmapSetCover> covers = new List <UpdateableOnlineBeatmapSetCover>();

            AddStep("setup covers", () =>
            {
                var beatmapSet = CreateAPIBeatmapSet();

                FillFlowContainer fillFlow;

                Child = scroll = new OsuScrollContainer
                {
                    Size  = new Vector2(500f),
                    Child = fillFlow = new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Spacing          = new Vector2(10),
                        Padding          = new MarginPadding {
                            Bottom = 550
                        }
                    }
                };

                var coverTypes = Enum.GetValues(typeof(BeatmapSetCoverType))
                                 .Cast <BeatmapSetCoverType>()
                                 .ToList();

                for (int i = 0; i < 25; i++)
                {
                    var coverType = coverTypes[i % coverTypes.Count];

                    var cover = new UpdateableOnlineBeatmapSetCover(coverType)
                    {
                        OnlineInfo = beatmapSet,
                        Height     = 100,
                        Masking    = true,
                    };

                    if (coverType == BeatmapSetCoverType.Cover)
                    {
                        cover.Width = 500;
                    }
                    else if (coverType == BeatmapSetCoverType.Card)
                    {
                        cover.Width = 400;
                    }
                    else if (coverType == BeatmapSetCoverType.List)
                    {
                        cover.Size = new Vector2(100, 50);
                    }

                    fillFlow.Add(cover);
                    covers.Add(cover);
                }
            });

            var loadedCovers = covers.Where(c => c.ChildrenOfType <OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);

            AddUntilStep("some loaded", () => loadedCovers.Any());
            AddStep("scroll to end", () => scroll.ScrollToEnd());
            AddUntilStep("all unloaded", () => !loadedCovers.Any());
        }
Ejemplo n.º 3
0
        public BeatmapListingSearchControl()
        {
            AutoSizeAxes     = Axes.Y;
            RelativeSizeAxes = Axes.X;
            AddRangeInternal(new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Child            = beatmapCover = new TopSearchBeatmapSetCover
                    {
                        RelativeSizeAxes = Axes.Both,
                        Alpha            = 0,
                    }
                },
                new Container
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    Padding          = new MarginPadding
                    {
                        Vertical   = 20,
                        Horizontal = 40,
                    },
                    Child = new FillFlowContainer
                    {
                        AutoSizeAxes     = Axes.Y,
                        RelativeSizeAxes = Axes.X,
                        Direction        = FillDirection.Vertical,
                        Spacing          = new Vector2(0, 20),
                        Children         = new Drawable[]
                        {
                            textBox = new BeatmapSearchTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                TextChanged      = () => TypingStarted?.Invoke(),
                            },
                            new ReverseChildIDFillFlowContainer <Drawable>
                            {
                                AutoSizeAxes     = Axes.Y,
                                RelativeSizeAxes = Axes.X,
                                Direction        = FillDirection.Vertical,
                                Padding          = new MarginPadding {
                                    Horizontal = 10
                                },
                                Children = new Drawable[]
                                {
                                    generalFilter         = new BeatmapSearchGeneralFilterRow(),
                                    modeFilter            = new BeatmapSearchRulesetFilterRow(),
                                    categoryFilter        = new BeatmapSearchFilterRow <SearchCategory>(BeatmapsStrings.ListingSearchFiltersStatus),
                                    genreFilter           = new BeatmapSearchFilterRow <SearchGenre>(BeatmapsStrings.ListingSearchFiltersGenre),
                                    languageFilter        = new BeatmapSearchFilterRow <SearchLanguage>(BeatmapsStrings.ListingSearchFiltersLanguage),
                                    extraFilter           = new BeatmapSearchMultipleSelectionFilterRow <SearchExtra>(BeatmapsStrings.ListingSearchFiltersExtra),
                                    ranksFilter           = new BeatmapSearchScoreFilterRow(),
                                    playedFilter          = new BeatmapSearchFilterRow <SearchPlayed>(BeatmapsStrings.ListingSearchFiltersPlayed),
                                    explicitContentFilter = new BeatmapSearchFilterRow <SearchExplicit>(BeatmapsStrings.ListingSearchFiltersNsfw),
                                }
                            }
                        }
                    }
                }
            });

            categoryFilter.Current.Value = SearchCategory.Leaderboard;
        }