|
|
|
|
@@ -874,72 +874,6 @@ namespace RemappingUITests
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test if the ValidateShortcutBufferElement method returns WinL error on setting a drop down to Win or L on a column resulting in Win+L
|
|
|
|
|
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnWinLError_OnSettingDropDownToWinOrLOnColumnResultingInWinL)
|
|
|
|
|
{
|
|
|
|
|
std::vector<ValidateShortcutBufferElementArgs> testCases;
|
|
|
|
|
// Case 1: Validate the element when selecting L (0x4C) on second dropdown of first column of LWin+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 0, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN }, Shortcut() }, std::wstring() } });
|
|
|
|
|
// Case 2: Validate the element when selecting L (0x4C) on second dropdown of second column of LWin+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN } }, std::wstring() } });
|
|
|
|
|
// Case 3: Validate the element when selecting L (0x4C) on second dropdown of second column of hybrid LWin+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN } }, std::wstring() } });
|
|
|
|
|
// Case 4: Validate the element when selecting L (0x4C) on second dropdown of first column of Win+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 0, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH }, Shortcut() }, std::wstring() } });
|
|
|
|
|
// Case 5: Validate the element when selecting L (0x4C) on second dropdown of second column of Win+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH } }, std::wstring() } });
|
|
|
|
|
// Case 6: Validate the element when selecting L (0x4C) on second dropdown of second column of hybrid Win+Empty shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 1, std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ CommonSharedConstants::VK_WIN_BOTH } }, std::wstring() } });
|
|
|
|
|
// Case 7: Validate the element when selecting LWin (VK_LWIN) on first dropdown of first column of Empty+L shortcut
|
|
|
|
|
testCases.push_back({ 0, 0, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ 0x4C }, Shortcut() }, std::wstring() } });
|
|
|
|
|
// Case 8: Validate the element when selecting LWin (VK_LWIN) on first dropdown of second column of Empty+L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ 0x4C } }, std::wstring() } });
|
|
|
|
|
// Case 9: Validate the element when selecting LWin (VK_LWIN) on first dropdown of second column of hybrid Empty+L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 0, std::vector<int32_t>{ VK_LWIN, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ 0x4C } }, std::wstring() } });
|
|
|
|
|
|
|
|
|
|
RunTestCases(testCases, [this](const ValidateShortcutBufferElementArgs& testCase) {
|
|
|
|
|
// Arrange
|
|
|
|
|
RemapBuffer remapBuffer;
|
|
|
|
|
remapBuffer.push_back(testCase.bufferRow);
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
std::pair<ShortcutErrorType, BufferValidationHelpers::DropDownAction> result = BufferValidationHelpers::ValidateShortcutBufferElement(testCase.elementRowIndex, testCase.elementColIndex, testCase.indexOfDropDownLastModified, testCase.selectedCodesOnDropDowns, testCase.targetAppNameInTextBox, testCase.isHybridColumn, remapBuffer, true);
|
|
|
|
|
|
|
|
|
|
// Assert that the element is invalid
|
|
|
|
|
Assert::AreEqual(true, result.first == ShortcutErrorType::WinL);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test if the ValidateShortcutBufferElement method returns WinL error on setting a drop down to null or none on a column resulting in Win+L
|
|
|
|
|
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnWinLError_OnSettingDropDownToNullOrNoneOnColumnResultingInWinL)
|
|
|
|
|
{
|
|
|
|
|
std::vector<ValidateShortcutBufferElementArgs> testCases;
|
|
|
|
|
// Case 1: Validate the element when selecting Null (-1) on second dropdown of first column of LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 0, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C }, Shortcut() }, std::wstring() } });
|
|
|
|
|
// Case 2: Validate the element when selecting Null (-1) on second dropdown of second column of LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
|
|
|
|
|
// Case 3: Validate the element when selecting Null (-1) on second dropdown of second column of hybrid LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, -1, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
|
|
|
|
|
// Case 4: Validate the element when selecting None (0) on second dropdown of first column of LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 0, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C }, Shortcut() }, std::wstring() } });
|
|
|
|
|
// Case 5: Validate the element when selecting None (0) on second dropdown of second column of LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), false, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
|
|
|
|
|
// Case 6: Validate the element when selecting None (0) on second dropdown of second column of hybrid LWin + Ctrl + L shortcut
|
|
|
|
|
testCases.push_back({ 0, 1, 2, std::vector<int32_t>{ VK_LWIN, 0, 0x4C }, std::wstring(), true, RemapBufferRow{ RemapBufferItem{ Shortcut(), std::vector<int32_t>{ VK_LWIN, VK_CONTROL, 0x4C } }, std::wstring() } });
|
|
|
|
|
|
|
|
|
|
RunTestCases(testCases, [this](const ValidateShortcutBufferElementArgs& testCase) {
|
|
|
|
|
// Arrange
|
|
|
|
|
RemapBuffer remapBuffer;
|
|
|
|
|
remapBuffer.push_back(testCase.bufferRow);
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
std::pair<ShortcutErrorType, BufferValidationHelpers::DropDownAction> result = BufferValidationHelpers::ValidateShortcutBufferElement(testCase.elementRowIndex, testCase.elementColIndex, testCase.indexOfDropDownLastModified, testCase.selectedCodesOnDropDowns, testCase.targetAppNameInTextBox, testCase.isHybridColumn, remapBuffer, true);
|
|
|
|
|
|
|
|
|
|
// Assert that the element is invalid
|
|
|
|
|
Assert::AreEqual(true, result.first == ShortcutErrorType::WinL);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test if the ValidateShortcutBufferElement method returns CtrlAltDel error on setting a drop down to Ctrl, Alt or Del on a column resulting in Ctrl+Alt+Del
|
|
|
|
|
TEST_METHOD (ValidateShortcutBufferElement_ShouldReturnCtrlAltDelError_OnSettingDropDownToCtrlAltOrDelOnColumnResultingInCtrlAltDel)
|
|
|
|
|
{
|
|
|
|
|
|