1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-28 04:23:06 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserProfileRecentSection.cs

164 lines
5.5 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2019-03-25 00:02:36 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
2018-04-13 17:19:50 +08:00
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
2018-04-13 17:19:50 +08:00
using osu.Game.Online.API.Requests;
2019-03-25 00:02:36 +08:00
using osu.Game.Online.API.Requests.Responses;
2018-04-13 17:19:50 +08:00
using osu.Game.Overlays.Profile.Sections;
using osu.Game.Overlays.Profile.Sections.Recent;
2019-03-25 00:02:36 +08:00
namespace osu.Game.Tests.Visual.Online
2018-04-13 17:19:50 +08:00
{
[TestFixture]
public class TestSceneUserProfileRecentSection : OsuTestScene
2018-04-13 17:19:50 +08:00
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(RecentSection),
typeof(DrawableRecentActivity),
typeof(PaginatedRecentActivityContainer),
typeof(MedalIcon)
};
public TestSceneUserProfileRecentSection()
2018-04-13 17:19:50 +08:00
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f)
},
new OsuScrollContainer
2018-04-13 17:19:50 +08:00
{
RelativeSizeAxes = Axes.Both,
Child = new FillFlowContainer<DrawableRecentActivity>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
ChildrenEnumerable = createDummyActivities().Select(a => new DrawableRecentActivity(a))
},
}
};
}
private IEnumerable<APIRecentActivity> createDummyActivities()
2018-04-13 17:19:50 +08:00
{
var dummyBeatmap = new APIRecentActivity.RecentActivityBeatmap
2018-04-13 17:19:50 +08:00
{
Title = @"Dummy beatmap",
Url = "/b/1337",
};
var dummyUser = new APIRecentActivity.RecentActivityUser
2018-04-13 17:19:50 +08:00
{
Username = "DummyReborn",
Url = "/u/666",
PreviousUsername = "Dummy",
};
return new[]
{
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.Achievement,
Achievement = new APIRecentActivity.RecentActivityAchievement
2018-04-13 17:19:50 +08:00
{
Name = @"Feelin' It",
Slug = @"all-secret-feelinit",
},
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapPlaycount,
Count = 1337,
Beatmap = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetApprove,
Approval = BeatmapApproval.Qualified,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetDelete,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetRevive,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetRevive,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetUpdate,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.BeatmapsetUpload,
Beatmapset = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.Rank,
Rank = 1,
Mode = "osu!",
Beatmap = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.RankLost,
Mode = "osu!",
Beatmap = dummyBeatmap,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.UsernameChange,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.UserSupportAgain,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.UserSupportFirst,
},
new APIRecentActivity
2018-04-13 17:19:50 +08:00
{
User = dummyUser,
Type = RecentActivityType.UserSupportGift,
},
};
}
}
}