2020-06-11 13:07:46 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
#include "TestHelpers.h"
|
2020-07-13 11:49:09 -07:00
|
|
|
#include "MockedInput.h"
|
|
|
|
|
#include "keyboardmanager/common/KeyboardManagerState.h"
|
2020-06-11 13:07:46 -07:00
|
|
|
|
|
|
|
|
namespace TestHelpers
|
|
|
|
|
{
|
|
|
|
|
// Function to reset the environment variables for tests
|
|
|
|
|
void ResetTestEnv(MockedInput& input, KeyboardManagerState& state)
|
|
|
|
|
{
|
|
|
|
|
input.ResetKeyboardState();
|
|
|
|
|
input.SetHookProc(nullptr);
|
2020-06-15 16:48:00 -07:00
|
|
|
input.SetSendVirtualInputTestHandler(nullptr);
|
2020-07-06 16:45:53 -07:00
|
|
|
input.SetForegroundProcess(L"");
|
2020-06-11 13:07:46 -07:00
|
|
|
state.ClearSingleKeyRemaps();
|
|
|
|
|
state.ClearOSLevelShortcuts();
|
2020-07-10 17:53:41 -07:00
|
|
|
state.ClearAppSpecificShortcuts();
|
|
|
|
|
|
|
|
|
|
// Allocate memory for the keyboardManagerState activatedApp member to avoid CRT assert errors
|
|
|
|
|
std::wstring maxLengthString;
|
|
|
|
|
maxLengthString.resize(MAX_PATH);
|
|
|
|
|
state.SetActivatedApp(maxLengthString);
|
|
|
|
|
state.SetActivatedApp(KeyboardManagerConstants::NoActivatedApp);
|
2020-06-11 13:07:46 -07:00
|
|
|
}
|
|
|
|
|
}
|