2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2018-03-07 20:03:21 +08:00
|
|
|
|
using NUnit.Framework;
|
2020-01-30 02:01:40 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2018-03-07 20:03:21 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
2019-06-14 14:55:32 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-03-07 20:03:21 +08:00
|
|
|
|
using osu.Game.Online.API.Requests;
|
2019-03-25 00:02:36 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2020-01-30 02:01:40 +08:00
|
|
|
|
using osu.Game.Overlays;
|
2018-03-07 20:03:21 +08:00
|
|
|
|
using osu.Game.Overlays.Profile.Sections.Recent;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-03-25 00:02:36 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public class TestSceneUserProfileRecentSection : OsuTestScene
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
2020-01-30 02:01:40 +08:00
|
|
|
|
[Cached]
|
|
|
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
|
|
|
|
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public TestSceneUserProfileRecentSection()
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
2018-03-07 23:58:16 +08:00
|
|
|
|
Children = new Drawable[]
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
2018-03-07 23:58:16 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.Gray(0.2f)
|
|
|
|
|
},
|
2019-06-14 14:55:32 +08:00
|
|
|
|
new OsuScrollContainer
|
2018-03-07 23:58:16 +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))
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-03-07 20:03:21 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-08 10:41:54 +08:00
|
|
|
|
private IEnumerable<APIRecentActivity> createDummyActivities()
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
2018-06-08 10:41:54 +08:00
|
|
|
|
var dummyBeatmap = new APIRecentActivity.RecentActivityBeatmap
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
Title = @"Dummy beatmap",
|
|
|
|
|
Url = "/b/1337",
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-08 10:41:54 +08:00
|
|
|
|
var dummyUser = new APIRecentActivity.RecentActivityUser
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
Username = "DummyReborn",
|
|
|
|
|
Url = "/u/666",
|
|
|
|
|
PreviousUsername = "Dummy",
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-07 20:03:21 +08:00
|
|
|
|
return new[]
|
|
|
|
|
{
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.Achievement,
|
2018-06-08 10:41:54 +08:00
|
|
|
|
Achievement = new APIRecentActivity.RecentActivityAchievement
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
Name = @"Feelin' It",
|
|
|
|
|
Slug = @"all-secret-feelinit",
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapPlaycount,
|
|
|
|
|
Count = 1337,
|
|
|
|
|
Beatmap = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetApprove,
|
|
|
|
|
Approval = BeatmapApproval.Qualified,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetDelete,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetRevive,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetRevive,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetUpdate,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.BeatmapsetUpload,
|
|
|
|
|
Beatmapset = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.Rank,
|
|
|
|
|
Rank = 1,
|
|
|
|
|
Mode = "osu!",
|
|
|
|
|
Beatmap = dummyBeatmap,
|
2020-02-02 17:03:51 +08:00
|
|
|
|
},
|
|
|
|
|
new APIRecentActivity
|
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.Rank,
|
|
|
|
|
Rank = 1,
|
|
|
|
|
Mode = "vitaru",
|
|
|
|
|
Beatmap = dummyBeatmap,
|
|
|
|
|
},
|
|
|
|
|
new APIRecentActivity
|
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.Rank,
|
|
|
|
|
Rank = 1,
|
|
|
|
|
Mode = "fruits",
|
|
|
|
|
Beatmap = dummyBeatmap,
|
2018-03-07 20:03:21 +08:00
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.RankLost,
|
|
|
|
|
Mode = "osu!",
|
|
|
|
|
Beatmap = dummyBeatmap,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.UsernameChange,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.UserSupportAgain,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.UserSupportFirst,
|
|
|
|
|
},
|
2018-06-08 10:41:54 +08:00
|
|
|
|
new APIRecentActivity
|
2018-03-07 20:03:21 +08:00
|
|
|
|
{
|
|
|
|
|
User = dummyUser,
|
|
|
|
|
Type = RecentActivityType.UserSupportGift,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|