Merge remote-tracking branch 'origin/master' into update-beatmap-scores-design

# Conflicts:
#	osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs
#	osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs
#	osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs
This commit is contained in:
smoogipoo
2019-03-29 15:08:21 +09:00
250 changed files with 1693 additions and 1929 deletions

View File

@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Background
public void PlayerLoaderSettingsHoverTest()
{
setupUserSettings();
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer())));
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { BlockLoad = true })));
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
AddStep("Trigger background preview", () =>
@ -255,14 +255,8 @@ namespace osu.Game.Tests.Visual.Background
{
setupUserSettings();
AddStep("Start player loader", () =>
{
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
{
AllowPause = allowPause,
Ready = true,
}));
});
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer(allowPause))));
AddUntilStep("Wait for Player Loader to load", () => playerLoader.IsLoaded);
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
AddUntilStep("Wait for player to load", () => player.IsLoaded);
@ -351,21 +345,27 @@ namespace osu.Game.Tests.Visual.Background
public UserDimContainer CurrentStoryboardContainer => StoryboardContainer;
// Whether or not the player should be allowed to load.
public bool Ready;
public bool BlockLoad;
public Bindable<bool> StoryboardEnabled;
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
public TestPlayer(bool allowPause = true)
: base(allowPause)
{
}
public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1;
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, CancellationToken token)
{
while (!Ready)
while (BlockLoad && !token.IsCancellationRequested)
Thread.Sleep(1);
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
ReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
DrawableRuleset.IsPaused.BindTo(IsPaused);

View File

@ -15,12 +15,7 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override Player CreatePlayer(Ruleset ruleset)
{
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
return new ScoreAccessiblePlayer
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
};
return new ScoreAccessiblePlayer();
}
protected override void AddCheckSteps()
@ -33,6 +28,11 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
public new HUDOverlay HUDOverlay => base.HUDOverlay;
public ScoreAccessiblePlayer()
: base(false, false)
{
}
}
}
}

View File

@ -20,13 +20,13 @@ namespace osu.Game.Tests.Visual.Gameplay
{
typeof(KeyCounterKeyboard),
typeof(KeyCounterMouse),
typeof(KeyCounterCollection)
typeof(KeyCounterDisplay)
};
public TestCaseKeyCounter()
{
KeyCounterKeyboard rewindTestKeyCounterKeyboard;
KeyCounterCollection kc = new KeyCounterCollection
KeyCounterDisplay kc = new KeyCounterDisplay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,

View File

@ -26,12 +26,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Beatmap.Value = new DummyWorkingBeatmap(game);
AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
})));
AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player(false, false))));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
@ -47,12 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
SlowLoadPlayer slow = null;
stack.Push(loader = new PlayerLoader(() => slow = new SlowLoadPlayer
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
}));
stack.Push(loader = new PlayerLoader(() => slow = new SlowLoadPlayer(false, false)));
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
});
@ -64,6 +54,11 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public bool Ready;
public SlowLoadPlayer(bool allowPause = true, bool showResults = true)
: base(allowPause, showResults)
{
}
[BackgroundDependencyLoader]
private void load()
{

View File

@ -170,12 +170,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{
Origin = Anchor.Centre;
InternalChild = new Box
AddInternal(new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both
};
});
switch (direction)
{
@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual.Gameplay
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
InternalChild = new Box { Size = new Vector2(75) };
AddInternal(new Box { Size = new Vector2(75) });
}
protected override void UpdateState(ArmedState state)

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Screens;
@ -12,19 +13,24 @@ using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Menus
{
[TestFixture]
public class TestCaseLoaderAnimation : OsuTestCase
public class TestCaseLoaderAnimation : ScreenTestCase
{
private TestLoader loader;
[Cached]
private OsuLogo logo;
public TestCaseLoaderAnimation()
{
Add(logo = new OsuLogo { Depth = float.MinValue });
}
protected override void LoadComplete()
{
base.LoadComplete();
// required to preload the logo in a headless run (so it doesn't delay the loading itself).
Add(new OsuLogo());
bool logoVisible = false;
AddStep("almost instant display", () => Child = loader = new TestLoader(250));
AddStep("almost instant display", () => LoadScreen(loader = new TestLoader(250)));
AddUntilStep("loaded", () =>
{
logoVisible = loader.Logo?.Alpha > 0;
@ -32,7 +38,7 @@ namespace osu.Game.Tests.Visual.Menus
});
AddAssert("logo not visible", () => !logoVisible);
AddStep("short load", () => Child = loader = new TestLoader(800));
AddStep("short load", () => LoadScreen(loader = new TestLoader(800)));
AddUntilStep("loaded", () =>
{
logoVisible = loader.Logo?.Alpha > 0;
@ -41,7 +47,7 @@ namespace osu.Game.Tests.Visual.Menus
AddAssert("logo visible", () => logoVisible);
AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
AddStep("longer load", () => Child = loader = new TestLoader(1400));
AddStep("longer load", () => LoadScreen(loader = new TestLoader(1400)));
AddUntilStep("loaded", () =>
{
logoVisible = loader.Logo?.Alpha > 0;

View File

@ -27,7 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(Type = typeof(IRoomManager))]
private TestRoomManager roomManager = new TestRoomManager();
public TestCaseLoungeRoomsContainer()
[BackgroundDependencyLoader]
private void load()
{
RoomsContainer container;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Select.Options;
using osuTK.Graphics;
using osuTK.Input;
@ -16,10 +16,10 @@ namespace osu.Game.Tests.Visual.SongSelect
{
var overlay = new BeatmapOptionsOverlay();
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1);
overlay.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, Color4.Purple, null, Key.Number2);
overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, Color4.Yellow, null, Key.Number3);
overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, Color4.Pink, null, Key.Number4, float.MaxValue);
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.TimesCircleOutline, Color4.Purple, null, Key.Number1);
overlay.AddButton(@"Clear", @"local scores", FontAwesome.Eraser, Color4.Purple, null, Key.Number2);
overlay.AddButton(@"Edit", @"Beatmap", FontAwesome.Pencil, Color4.Yellow, null, Key.Number3);
overlay.AddButton(@"Delete", @"Beatmap", FontAwesome.Trash, Color4.Pink, null, Key.Number4, float.MaxValue);
Add(overlay);

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
@ -53,9 +52,9 @@ namespace osu.Game.Tests.Visual.SongSelect
}
};
IEnumerable<APIScoreInfo> scores = new[]
IEnumerable<ScoreInfo> scores = new[]
{
new APIScoreInfo
new ScoreInfo
{
User = new User
{
@ -80,7 +79,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234567890,
Accuracy = 1,
},
new APIScoreInfo
new ScoreInfo
{
User = new User
{
@ -104,7 +103,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234789,
Accuracy = 0.9997,
},
new APIScoreInfo
new ScoreInfo
{
User = new User
{
@ -127,7 +126,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 12345678,
Accuracy = 0.9854,
},
new APIScoreInfo
new ScoreInfo
{
User = new User
{
@ -149,7 +148,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234567,
Accuracy = 0.8765,
},
new APIScoreInfo
new ScoreInfo
{
User = new User
{

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams;
@ -11,7 +12,8 @@ namespace osu.Game.Tests.Visual.Tournament
[Description("for tournament use")]
public class TestCaseDrawings : ScreenTestCase
{
public TestCaseDrawings()
[BackgroundDependencyLoader]
private void load()
{
LoadScreen(new Drawings
{

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("dialog #1", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_trash_o,
Icon = FontAwesome.TrashOutline,
HeaderText = @"Confirm deletion of",
BodyText = @"Ayase Rie - Yuima-ru*World TVver.",
Buttons = new PopupDialogButton[]
@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("dialog #2", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_gear,
Icon = FontAwesome.Gear,
HeaderText = @"What do you want to do with",
BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz",
Buttons = new PopupDialogButton[]

View File

@ -111,7 +111,7 @@ namespace osu.Game.Tests.Visual.UserInterface
button.Anchor = Anchor.Centre;
button.Origin = Anchor.Centre;
button.Icon = FontAwesome.fa_osu_osu_o;
button.Icon = OsuIcon.RulesetOsu;
}
}
}

View File

@ -0,0 +1,73 @@
// 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 System.Reflection;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestCaseOsuIcon : TestCase
{
public TestCaseOsuIcon()
{
FillFlowContainer<Icon> flow;
AddRange(new Drawable[]
{
new Box
{
Colour = Color4.Teal,
RelativeSizeAxes = Axes.Both,
},
new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = flow = new FillFlowContainer<Icon>
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
},
}
});
foreach (var p in typeof(OsuIcon).GetProperties(BindingFlags.Public | BindingFlags.Static))
flow.Add(new Icon($"{nameof(OsuIcon)}.{p.Name}", (IconUsage)p.GetValue(null)));
AddStep("toggle shadows", () => flow.Children.ForEach(i => i.SpriteIcon.Shadow = !i.SpriteIcon.Shadow));
AddStep("change icons", () => flow.Children.ForEach(i => i.SpriteIcon.Icon = new IconUsage((char)(i.SpriteIcon.Icon.Icon + 1))));
}
private class Icon : Container, IHasTooltip
{
public string TooltipText { get; }
public SpriteIcon SpriteIcon { get; }
public Icon(string name, IconUsage icon)
{
TooltipText = name;
AutoSizeAxes = Axes.Both;
Child = SpriteIcon = new SpriteIcon
{
Icon = icon,
Size = new Vector2(60),
};
}
}
}
}

View File

@ -3,7 +3,7 @@
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Tests.Visual.UserInterface
@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
RelativeSizeAxes = Axes.Both,
State = Framework.Graphics.Containers.Visibility.Visible,
Icon = FontAwesome.fa_assistive_listening_systems,
Icon = FontAwesome.AssistiveListeningSystems,
HeaderText = @"This is a test popup",
BodyText = "I can say lots of stuff and even wrap my words!",
Buttons = new PopupDialogButton[]

View File

@ -1,55 +0,0 @@
// 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 System;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics;
using osuTK;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestCaseTextAwesome : OsuTestCase
{
public TestCaseTextAwesome()
{
FillFlowContainer flow;
Add(new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = flow = new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
},
});
foreach (FontAwesome fa in Enum.GetValues(typeof(FontAwesome)))
flow.Add(new Icon(fa));
}
private class Icon : Container, IHasTooltip
{
public string TooltipText { get; }
public Icon(FontAwesome fa)
{
TooltipText = fa.ToString();
AutoSizeAxes = Axes.Both;
Child = new SpriteIcon
{
Icon = fa,
Size = new Vector2(60),
};
}
}
}
}