Skip to content

Commit

Permalink
platform: update key normalization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed Oct 23, 2024
1 parent 2e848ca commit 2d906ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/platform/termio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void TermIO::normalizeKey(KeyDownEvent &keyDown) noexcept
{
// Modifier precedece: Shift < Ctrl < Alt.
int largestMod = (newMods & kbLeftAlt) ? 2
: (newMods & kbLeftShift) ? 1
: (newMods & kbLeftCtrl) ? 1
: 0;
if (ushort keyCode = moddedKeyCodes[tKey.code][largestMod])
{
Expand Down
1 change: 1 addition & 0 deletions source/tvision/tvtext2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
*/

#define Uses_TKeys
#define Uses_TEditWindow
#define Uses_TFileList
#define Uses_TProgram
Expand Down
6 changes: 3 additions & 3 deletions test/platform/termio.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ TEST(TermIO, ShouldNormalizeKeys)
{keyDownEv('a', kbLeftAlt, "a"), keyDownEv(kbAltA, kbLeftAlt, "")},
{keyDownEv(kbIns, kbShift, ""), keyDownEv(kbShiftIns, kbShift, "")},
{keyDownEv(kbBack, kbLeftCtrl | kbLeftAlt, ""), keyDownEv(kbAltBack, kbLeftCtrl | kbLeftAlt, "")},
{keyDownEv(kbCtrlBack, kbLeftCtrl, ""), keyDownEv(kbCtrlBack, kbLeftCtrl, "")},
{keyDownEv(kbCtrlBack, 0x0000, ""), keyDownEv(kbCtrlBack, kbCtrlShift, "")},
{keyDownEv(kbCtrlBack, kbRightCtrl, ""), keyDownEv(kbCtrlBack, kbRightCtrl, "")},
{keyDownEv(kbCtrlBack, 0x0000, ""), keyDownEv(kbCtrlBack, kbLeftCtrl, "")},
{keyDownEv(kbIns, kbLeftCtrl | kbEnhanced, ""), keyDownEv(kbCtrlIns, kbLeftCtrl | kbEnhanced, "")},
{keyDownEv(kbCtrlDel, kbLeftAlt, ""), keyDownEv(kbAltDel, kbCtrlShift | kbLeftAlt, "")},
{keyDownEv(kbCtrlDel, kbLeftAlt, ""), keyDownEv(kbAltDel, kbLeftCtrl | kbLeftAlt, "")},
};

for (auto &testCase : testCases)
Expand Down

0 comments on commit 2d906ff

Please sign in to comment.