Skip to content

Commit

Permalink
chore(developer): four additional test cases with spaces around the n…
Browse files Browse the repository at this point in the history
…ames of custom virtual keys
  • Loading branch information
markcsinclair committed Oct 29, 2024
1 parent 2da8f7b commit feb7c51
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions developer/src/kmcmplib/tests/gtest-compiler-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,30 @@ TEST_F(CompilerTest, GetXStringImpl_type_osb_test) {
fileKeyboard.cxVKDictionary = 3;
fileKeyboard.dpVKDictionary[3].szName[0] = 0;

// virtual key, custom name, space before, valid
fileKeyboard.version = VERSION_90;
u16cpy(str, u"[ jkl]");
EXPECT_EQ(STATUS_Success, GetXStringImpl(tstr, &fileKeyboard, str, u"", output, 80, 0, &newp, FALSE));
tstr_virtual_key_valid[2] = ISVIRTUALKEY;
tstr_virtual_key_valid[3] = 259; // VK__MAX + 4
EXPECT_EQ(0, u16cmp(tstr_virtual_key_valid, tstr));
EXPECT_EQ(0, u16cmp(u"jkl", fileKeyboard.dpVKDictionary[3].szName));
tstr_virtual_key_valid[3] = 65;
fileKeyboard.cxVKDictionary = 3;
fileKeyboard.dpVKDictionary[3].szName[0] = 0;

// virtual key, custom name, space after, valid
fileKeyboard.version = VERSION_90;
u16cpy(str, u"[jkl ]");
EXPECT_EQ(STATUS_Success, GetXStringImpl(tstr, &fileKeyboard, str, u"", output, 80, 0, &newp, FALSE));
tstr_virtual_key_valid[2] = ISVIRTUALKEY;
tstr_virtual_key_valid[3] = 259; // VK__MAX + 4
EXPECT_EQ(0, u16cmp(tstr_virtual_key_valid, tstr));
EXPECT_EQ(0, u16cmp(u"jkl", fileKeyboard.dpVKDictionary[3].szName));
tstr_virtual_key_valid[3] = 65;
fileKeyboard.cxVKDictionary = 3;
fileKeyboard.dpVKDictionary[3].szName[0] = 0;

// virtual key, custom name, pre-existing name, valid
fileKeyboard.version = VERSION_90;
u16cpy(str, u"[def]");
Expand All @@ -1963,6 +1987,24 @@ TEST_F(CompilerTest, GetXStringImpl_type_osb_test) {
EXPECT_EQ(0, u16cmp(tstr_virtual_key_valid, tstr));
tstr_virtual_key_valid[3] = 65;

// virtual key, custom name, pre-existing name, space before, valid
fileKeyboard.version = VERSION_90;
u16cpy(str, u"[ def]");
EXPECT_EQ(STATUS_Success, GetXStringImpl(tstr, &fileKeyboard, str, u"", output, 80, 0, &newp, FALSE));
tstr_virtual_key_valid[2] = ISVIRTUALKEY;
tstr_virtual_key_valid[3] = 257; // VK__MAX + 2
EXPECT_EQ(0, u16cmp(tstr_virtual_key_valid, tstr));
tstr_virtual_key_valid[3] = 65;

// virtual key, custom name, pre-existing name, space after, valid
fileKeyboard.version = VERSION_90;
u16cpy(str, u"[def ]");
EXPECT_EQ(STATUS_Success, GetXStringImpl(tstr, &fileKeyboard, str, u"", output, 80, 0, &newp, FALSE));
tstr_virtual_key_valid[2] = ISVIRTUALKEY;
tstr_virtual_key_valid[3] = 257; // VK__MAX + 2
EXPECT_EQ(0, u16cmp(tstr_virtual_key_valid, tstr));
tstr_virtual_key_valid[3] = 65;

// virtual key, in VKeyNames, kmcmp::FMnemonicLayout true, VKeyMayBeVCKey false, valid
fileKeyboard.version = VERSION_90;
kmcmp::FMnemonicLayout = TRUE;
Expand Down

0 comments on commit feb7c51

Please sign in to comment.