mirror of https://github.com/ppy/osu
Add tests for chat height saving/loading
This commit is contained in:
parent
5ea6f62951
commit
9cb52f8879
|
@ -6,12 +6,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
|
@ -21,6 +23,7 @@
|
|||
using osu.Game.Overlays.Chat;
|
||||
using osu.Game.Overlays.Chat.Listing;
|
||||
using osu.Game.Overlays.Chat.ChannelList;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
|
@ -38,6 +41,9 @@ public class TestSceneChatOverlayV2 : OsuManualInputManagerTestScene
|
|||
private Channel testChannel1 => testChannels[0];
|
||||
private Channel testChannel2 => testChannels[1];
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; } = null!;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
|
@ -124,6 +130,28 @@ public void TestShowHide()
|
|||
AddAssert("Overlay is hidden", () => chatOverlay.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChatHeight()
|
||||
{
|
||||
Bindable<float> configChatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight);
|
||||
float newHeight = 0;
|
||||
|
||||
AddStep("Set config chat height", () => configChatHeight.Value = 0.4f);
|
||||
AddStep("Show overlay", () => chatOverlay.Show());
|
||||
AddAssert("Overlay uses config height", () => chatOverlay.Height == 0.4f);
|
||||
AddStep("Drag overlay to new height", () => {
|
||||
InputManager.MoveMouseTo(chatOverlayTopBar);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
AddStep("Store new height", () => newHeight = chatOverlay.Height);
|
||||
AddAssert("Config height changed", () => configChatHeight.Value != 0.4f && configChatHeight.Value == newHeight);
|
||||
AddStep("Hide overlay", () => chatOverlay.Hide());
|
||||
AddStep("Show overlay", () => chatOverlay.Show());
|
||||
AddAssert("Overlay uses new height", () => chatOverlay.Height == newHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChannelSelection()
|
||||
{
|
||||
|
@ -360,6 +388,9 @@ private ChannelListItem getChannelListItem(Channel channel) =>
|
|||
private ChatTextBox chatOverlayTextBox =>
|
||||
chatOverlay.ChildrenOfType<ChatTextBox>().Single();
|
||||
|
||||
private ChatOverlayTopBar chatOverlayTopBar =>
|
||||
chatOverlay.ChildrenOfType<ChatOverlayTopBar>().Single();
|
||||
|
||||
private void clickDrawable(Drawable d)
|
||||
{
|
||||
InputManager.MoveMouseTo(d);
|
||||
|
|
Loading…
Reference in New Issue