2019-01-24 17:43:03 +09:00
|
|
|
|
// 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.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Overlays.Toolbar;
|
|
|
|
|
|
2019-03-25 01:02:36 +09:00
|
|
|
|
namespace osu.Game.Tests.Visual.Menus
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-05-14 22:37:25 +03:00
|
|
|
|
public class TestSceneToolbar : OsuTestScene
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(ToolbarButton),
|
2018-07-10 01:20:21 +09:00
|
|
|
|
typeof(ToolbarRulesetSelector),
|
2019-06-12 20:51:21 +03:00
|
|
|
|
typeof(ToolbarRulesetTabButton),
|
2018-04-13 18:19:50 +09:00
|
|
|
|
typeof(ToolbarNotificationButton),
|
|
|
|
|
};
|
|
|
|
|
|
2019-05-14 22:37:25 +03:00
|
|
|
|
public TestSceneToolbar()
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2019-06-11 14:28:52 +09:00
|
|
|
|
var toolbar = new Toolbar { State = { Value = Visibility.Visible } };
|
2019-03-08 12:30:52 +09:00
|
|
|
|
ToolbarNotificationButton notificationButton = null;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-03-08 12:30:52 +09:00
|
|
|
|
AddStep("create toolbar", () =>
|
|
|
|
|
{
|
|
|
|
|
Add(toolbar);
|
|
|
|
|
notificationButton = toolbar.Children.OfType<FillFlowContainer>().Last().Children.OfType<ToolbarNotificationButton>().First();
|
|
|
|
|
});
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
void setNotifications(int count) => AddStep($"set notification count to {count}", () => notificationButton.NotificationCount.Value = count);
|
|
|
|
|
|
|
|
|
|
setNotifications(1);
|
|
|
|
|
setNotifications(2);
|
|
|
|
|
setNotifications(3);
|
|
|
|
|
setNotifications(0);
|
|
|
|
|
setNotifications(144);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|