1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:43:10 +08:00

Merge pull request #18110 from jai-x/new-chat-min-max-height

Clamp maximum and minimum height the chat overlay can be resized to
This commit is contained in:
Dean Herbert 2022-05-06 12:43:58 +09:00 committed by GitHub
commit 35e307672b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -133,22 +133,22 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestChatHeight()
{
Bindable<float> configChatHeight = null;
BindableFloat configChatHeight = new BindableFloat();
config.BindWith(OsuSetting.ChatDisplayHeight, configChatHeight);
float newHeight = 0;
AddStep("Bind config chat height", () => configChatHeight = config.GetBindable<float>(OsuSetting.ChatDisplayHeight).GetBoundCopy());
AddStep("Set config chat height", () => configChatHeight.Value = 0.4f);
AddStep("Reset config chat height", () => configChatHeight.SetDefault());
AddStep("Show overlay", () => chatOverlay.Show());
AddAssert("Overlay uses config height", () => chatOverlay.Height == 0.4f);
AddStep("Drag overlay to new height", () =>
AddAssert("Overlay uses config height", () => chatOverlay.Height == configChatHeight.Default);
AddStep("Click top bar", () =>
{
InputManager.MoveMouseTo(chatOverlayTopBar);
InputManager.PressButton(MouseButton.Left);
InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300));
InputManager.ReleaseButton(MouseButton.Left);
});
AddStep("Drag overlay to new height", () => InputManager.MoveMouseTo(chatOverlayTopBar, new Vector2(0, -300)));
AddStep("Stop dragging", () => InputManager.ReleaseButton(MouseButton.Left));
AddStep("Store new height", () => newHeight = chatOverlay.Height);
AddAssert("Config height changed", () => configChatHeight.Value != 0.4f && configChatHeight.Value == newHeight);
AddAssert("Config height changed", () => !configChatHeight.IsDefault && configChatHeight.Value == newHeight);
AddStep("Hide overlay", () => chatOverlay.Hide());
AddStep("Show overlay", () => chatOverlay.Show());
AddAssert("Overlay uses new height", () => chatOverlay.Height == newHeight);

View File

@ -39,7 +39,7 @@ namespace osu.Game.Overlays
private ChatTextBar textBar = null!;
private Container<DrawableChannel> currentChannelContainer = null!;
private readonly Bindable<float> chatHeight = new Bindable<float>();
private readonly BindableFloat chatHeight = new BindableFloat();
private bool isDraggingTopBar;
private float dragStartChatHeight;