Fix remapping issues to Home/PgUp and other keys which are also present on NumPad (#4398)

* Added extended key flag to more keys

* Add test for extended key flag

* Move shlwapi.lib reference

* Added shcore ref

* Fixed pipeline incompatibility

* Fixed lib declaration in common

* Fixed formatting

* Remove unused statements

* removed another statement
This commit is contained in:
Arjun Balgovind
2020-06-24 20:28:54 -07:00
committed by GitHub
parent 8e758507b1
commit f1b6e6570c
7 changed files with 49 additions and 9 deletions

View File

@@ -45,6 +45,34 @@ namespace KeyboardManagerRemapLogicTests
}
};
TEST_CLASS (SetKeyEventTests)
{
public:
TEST_METHOD_INITIALIZE(InitializeTestEnv)
{
// Reset test environment
TestHelpers::ResetTestEnv(mockedInputHandler, testState);
}
// Test if SetKeyEvent sets the extended key flag for all the extended keys
TEST_METHOD (SetKeyEvent_ShouldUseExtendedKeyFlag_WhenArgumentIsExtendedKey)
{
const int nInputs = 15;
INPUT input[nInputs] = {};
// List of extended keys
WORD keyCodes[nInputs] = { VK_RCONTROL, VK_RMENU, VK_NUMLOCK, VK_SNAPSHOT, VK_CANCEL, VK_INSERT, VK_HOME, VK_PRIOR, VK_DELETE, VK_END, VK_NEXT, VK_LEFT, VK_DOWN, VK_RIGHT, VK_UP };
for (int i = 0; i < nInputs; i++)
{
// Set key events for all the extended keys
KeyboardManagerHelper::SetKeyEvent(input, i, INPUT_KEYBOARD, keyCodes[i], 0, 0);
// Extended key flag should be set
Assert::AreEqual(true, bool(input[i].ki.dwFlags & KEYEVENTF_EXTENDEDKEY));
}
}
};
TEST_CLASS (SingleKeyRemappingTests)
{
public: