From cad594018f925e7fd51581833ebc0a1fb50cd3da Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 26 Jun 2017 00:38:00 +0800 Subject: [PATCH] Add dummy data in test case. --- .../Tests/TestCaseUserProfile.cs | 27 +++++++++++++++++++ osu.Game/Users/User.cs | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs index f932b01d2c..a41834b647 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Linq; using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Users; @@ -17,6 +19,31 @@ namespace osu.Desktop.VisualTests.Tests var profile = new UserProfileOverlay(); Add(profile); + AddStep("Show offline dummy", () => profile.ShowUser(new User + { + Username = @"Somebody", + Id = 1, + Country = new Country { FullName = @"Alien" }, + CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", + JoinDate = DateTimeOffset.Now.AddDays(-1), + LastVisit = DateTimeOffset.Now, + Age = 1, + ProfileOrder = new[] { "me" }, + CountryRank = 1, + Statistics = new UserStatistics + { + Rank = 2148, + PP = 4567.89m + }, + AllRankHistories = new User.RankHistories + { + Osu = new User.RankHistory + { + Mode = @"osu", + Data = Enumerable.Range(2345,45).Concat(Enumerable.Range(2109,40)).ToArray() + } + } + }, false)); AddStep("Show ppy", () => profile.ShowUser(new User { Username = @"peppy", diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index bf78565e28..37b426ac2c 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -124,5 +124,32 @@ namespace osu.Game.Users [JsonProperty(@"defaultStatistics")] public UserStatistics Statistics; + + public class RankHistories + { + [JsonProperty(@"osu")] + public RankHistory Osu; + + [JsonProperty(@"taiko")] + public RankHistory Taiko; + + [JsonProperty(@"fruits")] + public RankHistory Fruits; + + [JsonProperty(@"mania")] + public RankHistory Mania; + } + + public class RankHistory + { + [JsonProperty(@"mode")] + public string Mode; + + [JsonProperty(@"data")] + public int[] Data; + } + + [JsonProperty(@"allRankHistories")] + public RankHistories AllRankHistories; } }