mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 12:13:52 +08:00
Added Tests for the Ctrl+Shift+T shortcut
Tests have not actually been run yet.
This commit is contained in:
parent
08a2cdaf8d
commit
337309ec13
@ -208,6 +208,84 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert("All channels closed", () => !channelManager.JoinedChannels.Any());
|
AddAssert("All channels closed", () => !channelManager.JoinedChannels.Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Control-Shift-T should reopen the most recently closed tab that has not
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TestCtrlShiftTShortcut1()
|
||||||
|
{
|
||||||
|
AddStep("Join 2 channels", () =>
|
||||||
|
{
|
||||||
|
channelManager.JoinChannel(channel1);
|
||||||
|
channelManager.JoinChannel(channel2);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close channel 2
|
||||||
|
AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
|
||||||
|
AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
|
||||||
|
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
|
||||||
|
AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
|
||||||
|
|
||||||
|
AddStep("Press Control-Shift-T", () => pressControlShiftT());
|
||||||
|
|
||||||
|
// Channel 2 should now be open again
|
||||||
|
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
|
||||||
|
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TestCtrlShiftTShortcut2()
|
||||||
|
{
|
||||||
|
AddStep("Join 2 channels", () =>
|
||||||
|
{
|
||||||
|
channelManager.JoinChannel(channel1);
|
||||||
|
channelManager.JoinChannel(channel2);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close channels 1 and channel 2
|
||||||
|
AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
|
||||||
|
AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
|
||||||
|
|
||||||
|
AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1]));
|
||||||
|
AddStep("Click channel 1 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child));
|
||||||
|
|
||||||
|
AddAssert("channel 1 closed", () => !channelManager.JoinedChannels.Contains(channel1));
|
||||||
|
AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
|
||||||
|
|
||||||
|
AddStep("Press Control-Shift-T", () => 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());
|
||||||
|
|
||||||
|
// 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());
|
||||||
|
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
|
||||||
|
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
|
||||||
|
|
||||||
|
// Close channel 2 again
|
||||||
|
AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
|
||||||
|
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());
|
||||||
|
AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
|
||||||
|
AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void pressChannelHotkey(int number)
|
private void pressChannelHotkey(int number)
|
||||||
{
|
{
|
||||||
var channelKey = Key.Number0 + number;
|
var channelKey = Key.Number0 + number;
|
||||||
|
Loading…
Reference in New Issue
Block a user