From feb7c51f8ff4aa600c8bc0b3bdb41ca70e881124 Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Tue, 29 Oct 2024 13:20:20 +0000 Subject: [PATCH] chore(developer): four additional test cases with spaces around the names of custom virtual keys --- .../kmcmplib/tests/gtest-compiler-test.cpp | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/developer/src/kmcmplib/tests/gtest-compiler-test.cpp b/developer/src/kmcmplib/tests/gtest-compiler-test.cpp index b0c3e0fa00..9f34faa156 100644 --- a/developer/src/kmcmplib/tests/gtest-compiler-test.cpp +++ b/developer/src/kmcmplib/tests/gtest-compiler-test.cpp @@ -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]"); @@ -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;