mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:42:55 +08:00
Add VisualTest.
This commit is contained in:
parent
f78538fea8
commit
983cefbe40
162
osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs
Normal file
162
osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
using osu.Game.Overlays.Profile.Sections.Recent;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestCaseUserProfileRecentSection : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(RecentSection),
|
||||||
|
typeof(DrawableRecentActivity),
|
||||||
|
typeof(PaginatedRecentActivityContainer),
|
||||||
|
typeof(MedalIcon)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestCaseUserProfileRecentSection()
|
||||||
|
{
|
||||||
|
var flow = new FillFlowContainer<DrawableRecentActivity>
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
};
|
||||||
|
|
||||||
|
flow.AddRange(createDummyActivities().Select(a => new DrawableRecentActivity(a)));
|
||||||
|
|
||||||
|
Add(new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.Gray(0.2f)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new ScrollContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = flow,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<RecentActivity> createDummyActivities()
|
||||||
|
{
|
||||||
|
var dummyBeatmap = new RecentActivity.RecentActivityBeatmap
|
||||||
|
{
|
||||||
|
Title = @"Dummy beatmap",
|
||||||
|
Url = "/b/1337",
|
||||||
|
};
|
||||||
|
|
||||||
|
var dummyUser = new RecentActivity.RecentActivityUser
|
||||||
|
{
|
||||||
|
Username = "DummyReborn",
|
||||||
|
Url = "/u/666",
|
||||||
|
PreviousUsername = "Dummy",
|
||||||
|
};
|
||||||
|
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.Achievement,
|
||||||
|
Achievement = new RecentActivity.RecentActivityAchievement
|
||||||
|
{
|
||||||
|
Name = @"Feelin' It",
|
||||||
|
Slug = @"all-secret-feelinit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapPlaycount,
|
||||||
|
Count = 1337,
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetApprove,
|
||||||
|
Approval = BeatmapApproval.Qualified,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetDelete,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetRevive,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetRevive,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetUpdate,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetUpload,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.Rank,
|
||||||
|
Rank = 1,
|
||||||
|
Mode = "osu!",
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.RankLost,
|
||||||
|
Mode = "osu!",
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UsernameChange,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportAgain,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportFirst,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportGift,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -173,6 +173,7 @@
|
|||||||
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseUserProfileRecentSection.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserRanks.cs" />
|
<Compile Include="Visual\TestCaseUserRanks.cs" />
|
||||||
<Compile Include="Visual\TestCaseVolumePieces.cs" />
|
<Compile Include="Visual\TestCaseVolumePieces.cs" />
|
||||||
<Compile Include="Visual\TestCaseWaveform.cs" />
|
<Compile Include="Visual\TestCaseWaveform.cs" />
|
||||||
|
@ -9,7 +9,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
{
|
{
|
||||||
internal class MedalIcon : Container
|
public class MedalIcon : Container
|
||||||
{
|
{
|
||||||
private readonly string slug;
|
private readonly string slug;
|
||||||
private readonly Sprite sprite;
|
private readonly Sprite sprite;
|
||||||
|
@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
{
|
{
|
||||||
internal class PaginatedRecentActivityContainer : PaginatedContainer
|
public class PaginatedRecentActivityContainer : PaginatedContainer
|
||||||
{
|
{
|
||||||
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
|
Loading…
Reference in New Issue
Block a user