mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 09:27:34 +08:00
Remove pointless test scenes
This commit is contained in:
parent
b79a0237a3
commit
822d99e69f
@ -1,71 +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 System.Collections.Generic;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Game.Overlays.News.Sidebar;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
|
||||||
{
|
|
||||||
public class TestSceneNewsMonthDropdown : OsuTestScene
|
|
||||||
{
|
|
||||||
[Cached]
|
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void CreateClosedMonthPanel()
|
|
||||||
{
|
|
||||||
create(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void CreateOpenMonthPanel()
|
|
||||||
{
|
|
||||||
create(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void create(bool isOpen) => AddStep("Create", () => Child = new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Width = 160,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider.Background2,
|
|
||||||
},
|
|
||||||
new MonthDropdown(posts)
|
|
||||||
{
|
|
||||||
IsOpen = { Value = isOpen }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private static List<APINewsPost> posts => new List<APINewsPost>
|
|
||||||
{
|
|
||||||
new APINewsPost
|
|
||||||
{
|
|
||||||
Title = "Short title",
|
|
||||||
PublishedAt = DateTimeOffset.Now
|
|
||||||
},
|
|
||||||
new APINewsPost
|
|
||||||
{
|
|
||||||
Title = "Oh boy that's a long post title I wonder if it will break anything"
|
|
||||||
},
|
|
||||||
new APINewsPost
|
|
||||||
{
|
|
||||||
Title = "Medium title, nothing to see here"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.News.Sidebar;
|
using osu.Game.Overlays.News.Sidebar;
|
||||||
@ -18,33 +20,18 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
private NewsSideBar sidebar;
|
private NewsSideBar sidebar;
|
||||||
|
|
||||||
[Test]
|
[SetUp]
|
||||||
public void TestCreateEmpty()
|
public void SetUp() => Schedule(() => Child = sidebar = new NewsSideBar());
|
||||||
{
|
|
||||||
createSidebar(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCreateWithData()
|
public void TestMetadataChange()
|
||||||
{
|
{
|
||||||
createSidebar(metadata);
|
AddUntilStep("Years panel is hidden", () => yearsPanel?.Alpha == 0);
|
||||||
|
AddStep("Add data", () => sidebar.Metadata.Value = metadata);
|
||||||
|
AddUntilStep("Years panel is visible", () => yearsPanel?.Alpha == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
private YearsPanel yearsPanel => sidebar.ChildrenOfType<YearsPanel>().FirstOrDefault();
|
||||||
public void TestDataChange()
|
|
||||||
{
|
|
||||||
createSidebar(null);
|
|
||||||
AddStep("Add data", () =>
|
|
||||||
{
|
|
||||||
if (sidebar != null)
|
|
||||||
sidebar.Metadata.Value = metadata;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createSidebar(APINewsSidebar metadata) => AddStep("Create", () => Child = sidebar = new NewsSideBar
|
|
||||||
{
|
|
||||||
Metadata = { Value = metadata }
|
|
||||||
});
|
|
||||||
|
|
||||||
private static readonly APINewsSidebar metadata = new APINewsSidebar
|
private static readonly APINewsSidebar metadata = new APINewsSidebar
|
||||||
{
|
{
|
||||||
|
@ -1,47 +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 osu.Framework.Graphics;
|
|
||||||
using osu.Game.Overlays.News.Sidebar;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
|
||||||
{
|
|
||||||
public class TestSceneNewsYearsPanel : OsuTestScene
|
|
||||||
{
|
|
||||||
[Cached]
|
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private readonly Bindable<APINewsSidebar> metadataBindable = new Bindable<APINewsSidebar>();
|
|
||||||
|
|
||||||
private YearsPanel panel;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void SetUp() => Schedule(() => Child = panel = new YearsPanel
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
});
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestVisibility()
|
|
||||||
{
|
|
||||||
AddStep("Change metadata to null", () => metadataBindable.Value = null);
|
|
||||||
AddUntilStep("Panel is hidden", () => panel?.Alpha == 0);
|
|
||||||
AddStep("Change metadata", () => metadataBindable.Value = metadata);
|
|
||||||
AddUntilStep("Panel is visible", () => panel?.Alpha == 1);
|
|
||||||
AddStep("Change metadata to null", () => metadataBindable.Value = null);
|
|
||||||
AddUntilStep("Panel is hidden", () => panel?.Alpha == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly APINewsSidebar metadata = new APINewsSidebar
|
|
||||||
{
|
|
||||||
Years = new[] { 1001, 2001, 3001, 4001, 5001, 6001, 7001, 8001, 9001 }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user