Additional formatting

Ran the dotnet format as well as the .\InspectCode.ps1 tools, and
fixed the style issues they found.
This commit is contained in:
Joseph-Ramos-CMU
2020-12-13 23:27:48 -05:00
parent 337309ec13
commit 3301f532ee
2 changed files with 16 additions and 18 deletions

View File

@ -212,11 +212,11 @@ namespace osu.Game.Tests.Visual.Online
// already been reopened
private void pressControlShiftT()
{
InputManager.PressKey(Key.ControlLeft);
InputManager.PressKey(Key.ShiftLeft);
InputManager.Key(Key.T);
InputManager.ReleaseKey(Key.ControlLeft);
InputManager.ReleaseKey(Key.ShiftLeft);
AddStep("Press and hold Control", () => InputManager.PressKey(Key.ControlLeft));
AddStep("Press and hold Shift", () => InputManager.PressKey(Key.ShiftLeft));
AddStep("Press T", () => InputManager.Key(Key.T));
AddStep("Release Control", () => InputManager.ReleaseKey(Key.ControlLeft));
AddStep("Release Shift", () => InputManager.ReleaseKey(Key.ShiftLeft));
}
public void TestCtrlShiftTShortcut1()
@ -233,7 +233,7 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
AddStep("Press Control-Shift-T", () => pressControlShiftT());
pressControlShiftT();
// Channel 2 should now be open again
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
@ -258,19 +258,19 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("channel 1 closed", () => !channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
AddStep("Press Control-Shift-T", () => pressControlShiftT());
pressControlShiftT();
// Channel 1 should now be open again. Channel 2 should not
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
AddStep("Press Control-Shift-T", () => pressControlShiftT());
pressControlShiftT();
// Both Channel 1 and Channel 2 should be open
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
// Processing this again should have not effect
AddStep("Press Control-Shift-T", () => pressControlShiftT());
pressControlShiftT();
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
@ -279,13 +279,11 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
// Both channel 1 and channel 2 should be open
AddStep("Press Control-Shift-T", () => pressControlShiftT());
pressControlShiftT();
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
}
private void pressChannelHotkey(int number)
{
var channelKey = Key.Number0 + number;

View File

@ -33,14 +33,13 @@ namespace osu.Game.Online.Chat
private readonly BindableList<Channel> availableChannels = new BindableList<Channel>();
private readonly BindableList<Channel> joinedChannels = new BindableList<Channel>();
// Keeps a list of closed channels. More recently closed channels appear at higher indeces
private readonly BindableList<Channel> closedChannels = new BindableList<Channel>();
// For efficiency purposes, this constant bounds the number of closed channels we store.
// This number is somewhat arbitrary; future developers are free to modify it.
// Must be a positive number.
private const int closedChannelsMaxSize = 50;
private const int closed_channels_max_size = 50;
/// <summary>
/// The currently opened channel
@ -419,7 +418,7 @@ namespace osu.Game.Online.Chat
// Prevent the closedChannel list from exceeding the max size
// by removing the oldest element
if (closedChannels.Count >= closedChannelsMaxSize)
if (closedChannels.Count >= closed_channels_max_size)
{
closedChannels.Remove(closedChannels[0]);
}
@ -434,8 +433,6 @@ namespace osu.Game.Online.Chat
}
}
/// <summary>
/// Opens the most recently closed channel that has not
/// already been reopened
@ -448,8 +445,11 @@ namespace osu.Game.Online.Chat
return;
}
Channel lastClosedChannel = closedChannels[closedChannels.Count - 1];
// equivalent to Channel lastClosedChannel = closedChannels[closedChannels.Count - 1];
Channel lastClosedChannel = closedChannels[^1];
closedChannels.Remove(lastClosedChannel);
// If the user already joined the channel, try the next
// channel in the list
if (joinedChannels.IndexOf(lastClosedChannel) >= 0)