1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:52:57 +08:00

Add tests

This commit is contained in:
Dean Herbert 2019-11-13 12:09:18 +09:00
parent 3c5008f94c
commit f18263aa70

View File

@ -2,9 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Overlays.BeatmapSet.Buttons;
using osuTK;
namespace osu.Game.Tests.Visual.Online
{
@ -15,7 +17,13 @@ namespace osu.Game.Tests.Visual.Online
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create button", () => Child = favourite = new FavouriteButton());
AddStep("create button", () => Child = favourite = new FavouriteButton
{
RelativeSizeAxes = Axes.None,
Size = new Vector2(50),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
}
[Test]
@ -35,7 +43,7 @@ namespace osu.Game.Tests.Visual.Online
AddStep("set valid beatmap", () => favourite.BeatmapSet.Value = new BeatmapSetInfo { OnlineBeatmapSetID = 88 });
checkEnabled(true);
AddStep("set invalid beatmap", () => favourite.BeatmapSet.Value = new BeatmapSetInfo());
checkEnabled(true);
checkEnabled(false);
}
private void checkEnabled(bool expected)