|
|
@@ -15,12 +15,15 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
TEST_CLASS (MockedInputSanityTests)
|
|
|
|
TEST_CLASS (MockedInputSanityTests)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// Test if mocked input is working
|
|
|
|
TEST_METHOD_INITIALIZE(InitializeTestEnv)
|
|
|
|
TEST_METHOD (MockedInput_ShouldSetKeyboardState_OnKeyEvent)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
// Reset test environment
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test if mocked input is working
|
|
|
|
|
|
|
|
TEST_METHOD (MockedInput_ShouldSetKeyboardState_OnKeyEvent)
|
|
|
|
|
|
|
|
{
|
|
|
|
// Send key down and key up for A key (0x41) and check keyboard state both times
|
|
|
|
// Send key down and key up for A key (0x41) and check keyboard state both times
|
|
|
|
const int nInputs = 1;
|
|
|
|
const int nInputs = 1;
|
|
|
|
INPUT input[nInputs] = {};
|
|
|
|
INPUT input[nInputs] = {};
|
|
|
@@ -45,8 +48,7 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
TEST_CLASS (SingleKeyRemappingTests)
|
|
|
|
TEST_CLASS (SingleKeyRemappingTests)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// Test if correct keyboard states are set for a single key remap
|
|
|
|
TEST_METHOD_INITIALIZE(InitializeTestEnv)
|
|
|
|
TEST_METHOD (RemappedKey_ShouldSetTargetKeyState_OnKeyEvent)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
// Reset test environment
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
@@ -54,7 +56,11 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Set HandleSingleKeyRemapEvent as the hook procedure
|
|
|
|
// Set HandleSingleKeyRemapEvent as the hook procedure
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleSingleKeyRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleSingleKeyRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test if correct keyboard states are set for a single key remap
|
|
|
|
|
|
|
|
TEST_METHOD (RemappedKey_ShouldSetTargetKeyState_OnKeyEvent)
|
|
|
|
|
|
|
|
{
|
|
|
|
// Remap A to B
|
|
|
|
// Remap A to B
|
|
|
|
testState.AddSingleKeyRemap(0x41, 0x42);
|
|
|
|
testState.AddSingleKeyRemap(0x41, 0x42);
|
|
|
|
const int nInputs = 1;
|
|
|
|
const int nInputs = 1;
|
|
|
@@ -82,13 +88,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if key is suppressed if a key is disabled by single key remap
|
|
|
|
// Test if key is suppressed if a key is disabled by single key remap
|
|
|
|
TEST_METHOD (RemappedKeyDisabled_ShouldNotChangeKeyState_OnKeyEvent)
|
|
|
|
TEST_METHOD (RemappedKeyDisabled_ShouldNotChangeKeyState_OnKeyEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleSingleKeyRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleSingleKeyRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap A to 0x0 (disabled)
|
|
|
|
// Remap A to 0x0 (disabled)
|
|
|
|
testState.AddSingleKeyRemap(0x41, 0x0);
|
|
|
|
testState.AddSingleKeyRemap(0x41, 0x0);
|
|
|
|
const int nInputs = 1;
|
|
|
|
const int nInputs = 1;
|
|
|
@@ -114,13 +113,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a remap to Win (Both) key
|
|
|
|
// Test if correct keyboard states are set for a remap to Win (Both) key
|
|
|
|
TEST_METHOD (RemappedKeyToWinBoth_ShouldSetWinLeftKeyState_OnKeyEvent)
|
|
|
|
TEST_METHOD (RemappedKeyToWinBoth_ShouldSetWinLeftKeyState_OnKeyEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleSingleKeyRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleSingleKeyRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap A to Common Win key
|
|
|
|
// Remap A to Common Win key
|
|
|
|
testState.AddSingleKeyRemap(0x41, CommonSharedConstants::VK_WIN_BOTH);
|
|
|
|
testState.AddSingleKeyRemap(0x41, CommonSharedConstants::VK_WIN_BOTH);
|
|
|
|
const int nInputs = 1;
|
|
|
|
const int nInputs = 1;
|
|
|
@@ -144,13 +136,64 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
Assert::AreEqual(mockedInputHandler.GetVirtualKeyState(0x41), false);
|
|
|
|
Assert::AreEqual(mockedInputHandler.GetVirtualKeyState(0x41), false);
|
|
|
|
Assert::AreEqual(mockedInputHandler.GetVirtualKeyState(VK_LWIN), false);
|
|
|
|
Assert::AreEqual(mockedInputHandler.GetVirtualKeyState(VK_LWIN), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test if SendVirtualInput is sent exactly once with the suppress flag when Caps Lock is remapped to Ctrl
|
|
|
|
|
|
|
|
TEST_METHOD (HandleSingleKeyRemapEvent_ShouldSendVirutalInputWithSuppressFlagExactlyOnce_WhenCapsLockIsMappedToCtrlAltShift)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Set sendvirtualinput call count condition to return true if the key event was sent with the suppress flag
|
|
|
|
|
|
|
|
mockedInputHandler.SetSendVirtualInputTestHandler([](LowlevelKeyboardEvent* data) {
|
|
|
|
|
|
|
|
if (data->lParam->dwExtraInfo == KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Caps Lock to Ctrl
|
|
|
|
|
|
|
|
testState.AddSingleKeyRemap(VK_CAPITAL, VK_CONTROL);
|
|
|
|
|
|
|
|
const int nInputs = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INPUT input[nInputs] = {};
|
|
|
|
|
|
|
|
input[0].type = INPUT_KEYBOARD;
|
|
|
|
|
|
|
|
input[0].ki.wVk = VK_CAPITAL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Send Caps Lock keydown
|
|
|
|
|
|
|
|
mockedInputHandler.SendVirtualInput(1, input, sizeof(INPUT));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SendVirtualInput should be called exactly once with the above condition
|
|
|
|
|
|
|
|
Assert::AreEqual(1, mockedInputHandler.GetSendVirtualInputCallCount());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test if SendVirtualInput is sent exactly once with the suppress flag when Ctrl is remapped to Caps Lock
|
|
|
|
|
|
|
|
TEST_METHOD (HandleSingleKeyRemapEvent_ShouldSendVirutalInputWithSuppressFlagExactlyOnce_WhenCtrlAltShiftIsMappedToCapsLock)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Set sendvirtualinput call count condition to return true if the key event was sent with the suppress flag
|
|
|
|
|
|
|
|
mockedInputHandler.SetSendVirtualInputTestHandler([](LowlevelKeyboardEvent* data) {
|
|
|
|
|
|
|
|
if (data->lParam->dwExtraInfo == KeyboardManagerConstants::KEYBOARDMANAGER_SUPPRESS_FLAG)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl to Caps Lock
|
|
|
|
|
|
|
|
testState.AddSingleKeyRemap(VK_CONTROL, VK_CAPITAL);
|
|
|
|
|
|
|
|
const int nInputs = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INPUT input[nInputs] = {};
|
|
|
|
|
|
|
|
input[0].type = INPUT_KEYBOARD;
|
|
|
|
|
|
|
|
input[0].ki.wVk = VK_CONTROL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Send Ctrl keydown
|
|
|
|
|
|
|
|
mockedInputHandler.SendVirtualInput(1, input, sizeof(INPUT));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SendVirtualInput should be called exactly once with the above condition
|
|
|
|
|
|
|
|
Assert::AreEqual(1, mockedInputHandler.GetSendVirtualInputCallCount());
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
TEST_CLASS (OSLevelShortcutRemappingTests)
|
|
|
|
TEST_CLASS (OSLevelShortcutRemappingTests)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap wih different modifiers key down
|
|
|
|
TEST_METHOD_INITIALIZE(InitializeTestEnv)
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
// Reset test environment
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
@@ -158,7 +201,11 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap wih different modifiers key down
|
|
|
|
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
|
|
|
|
{
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -188,13 +235,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with same modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with same modifiers key down
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithSameModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithSameModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Ctrl+V
|
|
|
|
// Remap Ctrl+A to Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -223,13 +263,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -265,13 +298,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with same modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 2 key shortcut remap with same modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithSameModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutWithSameModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Ctrl+V
|
|
|
|
// Remap Ctrl+A to Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -306,13 +332,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set when a 2 key shortcut is remapped, and a 3 key shortcut containing those keys is invoked - Ex: Ctrl+A remapped, but user presses Ctrl+Shift+A
|
|
|
|
// Test if correct keyboard states are set when a 2 key shortcut is remapped, and a 3 key shortcut containing those keys is invoked - Ex: Ctrl+A remapped, but user presses Ctrl+Shift+A
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutInvokingAShortcutContainingThoseKeys_ShouldNotBeRemapped_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedTwoKeyShortcutInvokingAShortcutContainingThoseKeys_ShouldNotBeRemapped_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
// Remap Ctrl+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -345,13 +364,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap wih different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap wih different modifiers key down
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+LWin+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+LWin+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -387,13 +399,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap wih partially different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap wih partially different modifiers key down
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+Ctrl+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -428,13 +433,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with same modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with same modifiers key down
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithSameModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithSameModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+Shift+V
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -468,13 +466,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+LWin+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+LWin+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -519,13 +510,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+Ctrl+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -569,13 +553,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with same modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 3 key shortcut remap with same modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithSameModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutWithSameModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+Shift+V
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -618,13 +595,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set when a 3 key shortcut is remapped, and a 2 key shortcut which is a subset of those keys is invoked - Ex: Ctrl+Shift+A remapped, but user presses Ctrl+A
|
|
|
|
// Test if correct keyboard states are set when a 3 key shortcut is remapped, and a 2 key shortcut which is a subset of those keys is invoked - Ex: Ctrl+Shift+A remapped, but user presses Ctrl+A
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutInvokingAShortcutSubsetOfThoseKeys_ShouldNotBeRemapped_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyShortcutInvokingAShortcutSubsetOfThoseKeys_ShouldNotBeRemapped_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -655,13 +625,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with different modifiers key down
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -695,13 +658,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with partially different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with partially different modifiers key down
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+V
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -734,13 +690,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
// Remap Ctrl+Shift+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -783,13 +732,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 3 key to 2 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedThreeKeyToTwoKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+V
|
|
|
|
// Remap Ctrl+Shift+A to Ctrl+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -831,13 +773,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with different modifiers key down
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -869,13 +804,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with partially different modifiers key down
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with partially different modifiers key down
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithPartiallyDiffModifiers_ShouldSetTargetShortcutDown_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Ctrl+Shift+V
|
|
|
|
// Remap Ctrl+A to Ctrl+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -906,13 +834,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -950,13 +871,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
// Test if correct keyboard states are set for a 2 key to 3 key shortcut remap with partially different modifiers key down followed by key up
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
TEST_METHOD (RemappedTwoKeyToThreeKeyShortcutWithPartiallyDiffModifiers_ShouldClearKeyboard_OnKeyUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Ctrl+Shift+V
|
|
|
|
// Remap Ctrl+A to Ctrl+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -993,13 +907,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set if a shortcut remap is pressed and then an unremapped shortcut with the same modifier is pressed - Ex: Ctrl+A is remapped. User invokes Ctrl+A then releases A and presses C (while Ctrl is held), should invoke Ctrl+C
|
|
|
|
// Test if correct keyboard states are set if a shortcut remap is pressed and then an unremapped shortcut with the same modifier is pressed - Ex: Ctrl+A is remapped. User invokes Ctrl+A then releases A and presses C (while Ctrl is held), should invoke Ctrl+C
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutAfterRemappedShortcutWithSameModifier_ShouldSetUnremappedShortcut_OnKeyDown)
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutAfterRemappedShortcutWithSameModifier_ShouldSetUnremappedShortcut_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
// Remap Ctrl+A to Alt+Shift+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
@@ -1037,13 +944,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set for a shortcut remap with win both modifier
|
|
|
|
// Test if correct keyboard states are set for a shortcut remap with win both modifier
|
|
|
|
TEST_METHOD (RemappedShortcutWithWinBothModifier_ShouldSetRemappedShortcut_OnKeyEvent)
|
|
|
|
TEST_METHOD (RemappedShortcutWithWinBothModifier_ShouldSetRemappedShortcut_OnKeyEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
@@ -1175,13 +1075,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set if a win both shortcut remap is pressed and then an unremapped shortcut with the LWin modifier is pressed
|
|
|
|
// Test if correct keyboard states are set if a win both shortcut remap is pressed and then an unremapped shortcut with the LWin modifier is pressed
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutWithLWinAfterRemappedShortcutWithWinBothModifier_ShouldSetUnremappedShortcutWithLWinKey_OnKeyDown)
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutWithLWinAfterRemappedShortcutWithWinBothModifier_ShouldSetUnremappedShortcutWithLWinKey_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
@@ -1222,13 +1115,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if correct keyboard states are set if a win both shortcut remap is pressed and then an unremapped shortcut with the RWin modifier is pressed
|
|
|
|
// Test if correct keyboard states are set if a win both shortcut remap is pressed and then an unremapped shortcut with the RWin modifier is pressed
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutWithRWinAfterRemappedShortcutWithWinBothModifier_ShouldSetUnremappedShortcutWithRWinKey_OnKeyDown)
|
|
|
|
TEST_METHOD (InvokingUnremappedShortcutWithRWinAfterRemappedShortcutWithWinBothModifier_ShouldSetUnremappedShortcutWithRWinKey_OnKeyDown)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
// Remap Win+A to Alt+V
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
|
src.SetKey(CommonSharedConstants::VK_WIN_BOTH);
|
|
|
@@ -1269,13 +1155,6 @@ namespace KeyboardManagerRemapLogicTests
|
|
|
|
// Test if target modifier is still held down even if the action key of the original shortcut is released - required for Alt+Tab/Win+Space cases
|
|
|
|
// Test if target modifier is still held down even if the action key of the original shortcut is released - required for Alt+Tab/Win+Space cases
|
|
|
|
TEST_METHOD (RemappedShortcutModifiers_ShouldBeDetectedAsPressed_OnReleasingActionKeyButHoldingModifiers)
|
|
|
|
TEST_METHOD (RemappedShortcutModifiers_ShouldBeDetectedAsPressed_OnReleasingActionKeyButHoldingModifiers)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Reset test environment
|
|
|
|
|
|
|
|
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set HandleOSLevelShortcutRemapEvent as the hook procedure
|
|
|
|
|
|
|
|
std::function<intptr_t(LowlevelKeyboardEvent*)> currentHookProc = std::bind(&KeyboardEventHandlers::HandleOSLevelShortcutRemapEvent, std::ref(mockedInputHandler), std::placeholders::_1, std::ref(testState));
|
|
|
|
|
|
|
|
mockedInputHandler.SetHookProc(currentHookProc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remap Ctrl+A to Alt+Tab
|
|
|
|
// Remap Ctrl+A to Alt+Tab
|
|
|
|
Shortcut src;
|
|
|
|
Shortcut src;
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|
src.SetKey(VK_CONTROL);
|
|
|
|