mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
added visual tests
This commit is contained in:
@ -14,6 +14,7 @@ using osu.Game.Online.API.Requests.Responses;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapListing;
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
@ -58,6 +59,79 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddUntilStep("placeholder shown", () => overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault()?.IsPresent == true);
|
AddUntilStep("placeholder shown", () => overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault()?.IsPresent == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSupporterOnlyFiltersPlaceholder() {
|
||||||
|
|
||||||
|
AddStep("toggle non-supporter", () =>
|
||||||
|
{
|
||||||
|
// non-supporter user
|
||||||
|
((DummyAPIAccess)API).LocalUser.Value = new User
|
||||||
|
{
|
||||||
|
Username = API.LocalUser.Value.Username,
|
||||||
|
Id = API.LocalUser.Value.Id + 1,
|
||||||
|
IsSupporter = false,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
AddStep("fetch for 1 beatmap", () => fetchFor(CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet));
|
||||||
|
|
||||||
|
AddStep("toggle Random Rank Achieved filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Clear();
|
||||||
|
Scoring.ScoreRank r = (Scoring.ScoreRank)(TestContext.CurrentContext.Random.NextShort() % 8);
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Add(r);
|
||||||
|
// overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("supporter-placeholder show", () => overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().SingleOrDefault()?.IsPresent == true);
|
||||||
|
|
||||||
|
AddStep("Clear Rank Achieved filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Clear();
|
||||||
|
});
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
|
||||||
|
AddStep("toggle Random Played filter", () => {
|
||||||
|
SearchPlayed r = (SearchPlayed)(TestContext.CurrentContext.Random.NextShort() % 2 + 1);
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Played.Value = r;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("supporter-placeholder show", () => overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().SingleOrDefault()?.IsPresent == true);
|
||||||
|
|
||||||
|
AddStep("Clear Played filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Played.Value = SearchPlayed.Any;
|
||||||
|
});
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
|
||||||
|
AddStep("toggle supporter", () =>
|
||||||
|
{
|
||||||
|
// supporter user
|
||||||
|
((DummyAPIAccess)API).LocalUser.Value.IsSupporter = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("toggle Random Rank Achieved filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Clear();
|
||||||
|
Scoring.ScoreRank r = (Scoring.ScoreRank)(TestContext.CurrentContext.Random.NextShort() % 8);
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Add(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
|
||||||
|
AddStep("Clear Rank Achieved filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Ranks.Clear();
|
||||||
|
});
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
|
||||||
|
AddStep("toggle Random Played filter", () => {
|
||||||
|
SearchPlayed r = (SearchPlayed)(TestContext.CurrentContext.Random.NextShort() % 2 + 1);
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Played.Value = r;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
|
||||||
|
AddStep("Clear Played filter", () => {
|
||||||
|
overlay.ChildrenOfType<BeatmapListingSearchControl>().Single().Played.Value = SearchPlayed.Any;
|
||||||
|
});
|
||||||
|
AddUntilStep("supporter-placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.SupporterRequiredDrawable>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
private void fetchFor(params BeatmapSetInfo[] beatmaps)
|
private void fetchFor(params BeatmapSetInfo[] beatmaps)
|
||||||
{
|
{
|
||||||
setsForResponse.Clear();
|
setsForResponse.Clear();
|
||||||
|
@ -181,11 +181,16 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
var transform = lastContent.FadeOut(100, Easing.OutQuint);
|
var transform = lastContent.FadeOut(100, Easing.OutQuint);
|
||||||
|
|
||||||
if (lastContent == notFoundContent || lastContent == supporterRequiredContent)
|
if (lastContent == notFoundContent)
|
||||||
{
|
{
|
||||||
// not found display may be used multiple times, so don't expire/dispose it.
|
// not found display may be used multiple times, so don't expire/dispose it.
|
||||||
transform.Schedule(() => panelTarget.Remove(lastContent));
|
transform.Schedule(() => panelTarget.Remove(lastContent));
|
||||||
}
|
}
|
||||||
|
else if (lastContent == supporterRequiredContent)
|
||||||
|
{
|
||||||
|
// supporter required display may be used multiple times, so don't expire/dispose it.
|
||||||
|
transform.Schedule(() => panelTarget.Remove(supporterRequiredContent));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Consider the case when the new content is smaller than the last content.
|
// Consider the case when the new content is smaller than the last content.
|
||||||
@ -256,9 +261,8 @@ namespace osu.Game.Overlays
|
|||||||
public SupporterRequiredDrawable()
|
public SupporterRequiredDrawable()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 250;
|
Height = 225;
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
Margin = new MarginPadding { Top = 15 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -271,7 +275,6 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(10, 0),
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new Sprite
|
||||||
@ -290,24 +293,7 @@ namespace osu.Game.Overlays
|
|||||||
private Drawable createSupportRequiredText()
|
private Drawable createSupportRequiredText()
|
||||||
{
|
{
|
||||||
LinkFlowContainer linkFlowContainer;
|
LinkFlowContainer linkFlowContainer;
|
||||||
string[] text = BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(
|
string[] text = BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(BeatmapsStrings.ListingSearchFiltersRank.ToString(), "{1}").ToString().Split("{1}");
|
||||||
BeatmapsStrings.ListingSearchFiltersRank.ToString(),
|
|
||||||
"{1}"
|
|
||||||
).ToString().Split("{1}");
|
|
||||||
|
|
||||||
// var titleContainer = new Container
|
|
||||||
// {
|
|
||||||
// RelativeSizeAxes = Axes.X,
|
|
||||||
// Margin = new MarginPadding { Vertical = 5 },
|
|
||||||
// Children = new Drawable[]
|
|
||||||
// {
|
|
||||||
// linkFlowContainer = new LinkFlowContainer
|
|
||||||
// {
|
|
||||||
// Anchor = Anchor.Centre,
|
|
||||||
// Origin = Anchor.Centre,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
linkFlowContainer = new LinkFlowContainer
|
linkFlowContainer = new LinkFlowContainer
|
||||||
{
|
{
|
||||||
@ -335,7 +321,7 @@ namespace osu.Game.Overlays
|
|||||||
t =>
|
t =>
|
||||||
{
|
{
|
||||||
t.Font = OsuFont.GetFont(size: 16);
|
t.Font = OsuFont.GetFont(size: 16);
|
||||||
t.Colour = Colour4.AliceBlue;
|
t.Colour = Colour4.FromHex("#A6C8D9");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user