Merge remote-tracking branch 'upstream/master' into user-status-wiring

This commit is contained in:
Lucas A
2019-05-25 11:02:19 +02:00
57 changed files with 674 additions and 343 deletions

View File

@ -9,7 +9,6 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Framework.Platform;
@ -19,6 +18,7 @@ using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
@ -240,7 +240,7 @@ namespace osu.Game.Tests.Visual.Background
{
player.StoryboardEnabled.Value = false;
player.ReplacesBackground.Value = false;
player.CurrentStoryboardContainer.Add(new SpriteText
player.CurrentStoryboardContainer.Add(new OsuSpriteText
{
Size = new Vector2(250, 50),
Alpha = 1,

View File

@ -24,7 +24,9 @@ namespace osu.Game.Tests.Visual.Gameplay
GC.WaitForPendingFinalizers();
int count = 0;
workingWeakReferences.ForEachAlive(_ => count++);
foreach (var unused in workingWeakReferences)
count++;
return count == 1;
});
@ -34,7 +36,9 @@ namespace osu.Game.Tests.Visual.Gameplay
GC.WaitForPendingFinalizers();
int count = 0;
playerWeakReferences.ForEachAlive(_ => count++);
foreach (var unused in playerWeakReferences)
count++;
return count == 1;
});
}

View File

@ -5,6 +5,7 @@ using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play.HUD;
using osuTK;
@ -53,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay
};
Add(stars);
SpriteText starsLabel = new SpriteText
SpriteText starsLabel = new OsuSpriteText
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,

View File

@ -7,9 +7,9 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK.Graphics;
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
},
new SpriteText
new OsuSpriteText
{
Font = OsuFont.Default.With(size: 40),
Anchor = Anchor.Centre,

View File

@ -53,38 +53,12 @@ namespace osu.Game.Tests.Visual.Menus
}
[Test]
public void TestShortLoad()
public void TestDelayedLoad()
{
bool logoVisible = false;
AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
AddWaitStep("wait", 3);
AddStep("finish loading", () =>
{
logoVisible = loader.Logo?.Alpha > 0;
loader.AllowLoad.Set();
});
AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0);
AddStep("finish loading", () => loader.AllowLoad.Set());
AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded);
AddAssert("logo was visible", () => logoVisible);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
}
[Test]
public void TestLongLoad()
{
bool logoVisible = false;
AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
AddWaitStep("wait", 10);
AddStep("finish loading", () =>
{
logoVisible = loader.Logo?.Alpha > 0;
loader.AllowLoad.Set();
});
AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded);
AddAssert("logo was visible", () => logoVisible);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
}

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat.Tabs;
using osu.Game.Users;
@ -61,7 +62,7 @@ namespace osu.Game.Tests.Visual.Online
Anchor = Anchor.TopLeft,
Children = new Drawable[]
{
currentText = new SpriteText
currentText = new OsuSpriteText
{
Text = "Currently selected channel:"
}

View File

@ -31,6 +31,7 @@ namespace osu.Game.Tests.Visual.Online
var data = new int[89];
var dataWithZeros = new int[89];
var smallData = new int[89];
var edgyData = new int[89];
for (int i = 0; i < 89; i++)
data[i] = dataWithZeros[i] = (i + 1) * 1000;
@ -41,6 +42,14 @@ namespace osu.Game.Tests.Visual.Online
for (int i = 79; i < 89; i++)
smallData[i] = 100000 - i * 1000;
bool edge = true;
for (int i = 0; i < 20; i++)
{
edgyData[i] = 100000 + (edge ? 1000 : -1000) * (i + 1);
edge = !edge;
}
Add(new Container
{
Anchor = Anchor.Centre,
@ -120,6 +129,22 @@ namespace osu.Game.Tests.Visual.Online
}
};
});
AddStep("graph with edges", () =>
{
graph.User.Value = new User
{
Statistics = new UserStatistics
{
Ranks = new UserStatistics.UserRanks { Global = 12000 },
PP = 12345,
},
RankHistory = new User.RankHistoryData
{
Data = edgyData,
}
};
});
}
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile;
using osu.Game.Overlays.Profile.Header;
using osu.Game.Overlays.Profile.Header.Components;
@ -21,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(ProfileHeader),
typeof(RankGraph),
typeof(LineGraph),
typeof(ProfileHeaderTabControl),
typeof(OverlayHeaderTabControl),
typeof(CentreHeaderContainer),
typeof(BottomHeaderContainer),
typeof(DetailHeaderContainer),

View File

@ -4,9 +4,9 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens;
using osu.Game.Screens.Play;
using osuTK.Graphics;
@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader]
private void load()
{
AddInternal(new SpriteText
AddInternal(new OsuSpriteText
{
Text = screenText,
Colour = Color4.White,

View File

@ -0,0 +1,50 @@
// 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.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneExpandingBar : OsuTestScene
{
public TestSceneExpandingBar()
{
Container container;
ExpandingBar expandingBar;
Add(container = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Gray,
Alpha = 0.5f,
RelativeSizeAxes = Axes.Both,
},
expandingBar = new ExpandingBar
{
Anchor = Anchor.Centre,
ExpandedSize = 10,
CollapsedSize = 2,
Colour = Color4.DeepSkyBlue,
}
}
});
AddStep(@"Collapse", () => expandingBar.Collapse());
AddStep(@"Expand", () => expandingBar.Expand());
AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre);
AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes = Axes.Y);
AddStep(@"Anchor left", () => expandingBar.Anchor = Anchor.CentreLeft);
}
}
}

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
@ -40,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Origin = Anchor.TopRight
});
SpriteText displayedCount = new SpriteText();
SpriteText displayedCount = new OsuSpriteText();
Content.Add(displayedCount);