aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/unittests/barrier/KeyMapTests.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-11-10 00:54:13 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2021-11-10 00:54:13 -0500
commitbeb08eb751fa8e1f72042f263316ab5e5ddb596d (patch)
tree3b00df983527648bdae610ac7b88cb639b1f1828 /src/test/unittests/barrier/KeyMapTests.cpp
parentfbc30002ab3438356c0476e70c4577a0310d52c0 (diff)
New upstream version 2.4.0+dfsg.upstream/2.4.0+dfsgupstream
Diffstat (limited to 'src/test/unittests/barrier/KeyMapTests.cpp')
-rw-r--r--src/test/unittests/barrier/KeyMapTests.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/test/unittests/barrier/KeyMapTests.cpp b/src/test/unittests/barrier/KeyMapTests.cpp
index 5980633..20c1c55 100644
--- a/src/test/unittests/barrier/KeyMapTests.cpp
+++ b/src/test/unittests/barrier/KeyMapTests.cpp
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2016 Symless
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define BARRIER_TEST_ENV
+
#include "barrier/KeyMap.h"
#include "test/global/gtest.h"
@@ -28,7 +30,7 @@ using ::testing::ReturnRef;
using ::testing::SaveArg;
namespace barrier {
-
+
TEST(KeyMapTests, findBestKey_requiredDown_matchExactFirstItem)
{
KeyMap keyMap;
@@ -44,7 +46,7 @@ TEST(KeyMapTests, findBestKey_requiredDown_matchExactFirstItem)
EXPECT_EQ(0, keyMap.findBestKey(entryList, currentState, desiredState));
}
-
+
TEST(KeyMapTests, findBestKey_requiredAndExtraSensitiveDown_matchExactFirstItem)
{
KeyMap keyMap;
@@ -82,7 +84,7 @@ TEST(KeyMapTests, findBestKey_requiredAndExtraSensitiveDown_matchExactSecondItem
EXPECT_EQ(1, keyMap.findBestKey(entryList, currentState, desiredState));
}
-
+
TEST(KeyMapTests, findBestKey_extraSensitiveDown_matchExactSecondItem)
{
KeyMap keyMap;
@@ -101,7 +103,7 @@ TEST(KeyMapTests, findBestKey_extraSensitiveDown_matchExactSecondItem)
itemList2.push_back(item2);
entryList.push_back(itemList1);
entryList.push_back(itemList2);
-
+
EXPECT_EQ(1, keyMap.findBestKey(entryList, currentState, desiredState));
}
@@ -123,7 +125,7 @@ TEST(KeyMapTests, findBestKey_noRequiredDown_matchOneRequiredChangeItem)
itemList2.push_back(item2);
entryList.push_back(itemList1);
entryList.push_back(itemList2);
-
+
EXPECT_EQ(1, keyMap.findBestKey(entryList, currentState, desiredState));
}
@@ -148,7 +150,7 @@ TEST(KeyMapTests, findBestKey_onlyOneRequiredDown_matchTwoRequiredChangesItem)
EXPECT_EQ(1, keyMap.findBestKey(entryList, currentState, desiredState));
}
-
+
TEST(KeyMapTests, findBestKey_noRequiredDown_cannotMatch)
{
KeyMap keyMap;
@@ -161,31 +163,31 @@ TEST(KeyMapTests, findBestKey_noRequiredDown_cannotMatch)
KeyModifierMask desiredState = 0;
itemList.push_back(item);
entryList.push_back(itemList);
-
+
EXPECT_EQ(-1, keyMap.findBestKey(entryList, currentState, desiredState));
}
-
+
TEST(KeyMapTests, isCommand_shiftMask_returnFalse)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierShift;
-
+
EXPECT_FALSE(keyMap.isCommand(mask));
}
-
+
TEST(KeyMapTests, isCommand_controlMask_returnTrue)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierControl;
-
+
EXPECT_EQ(true, keyMap.isCommand(mask));
}
-
+
TEST(KeyMapTests, isCommand_alternateMask_returnTrue)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierAlt;
-
+
EXPECT_EQ(true, keyMap.isCommand(mask));
}
@@ -193,15 +195,15 @@ TEST(KeyMapTests, isCommand_alternateGraphicMask_returnTrue)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierAltGr;
-
+
EXPECT_EQ(true, keyMap.isCommand(mask));
}
-
+
TEST(KeyMapTests, isCommand_metaMask_returnTrue)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierMeta;
-
+
EXPECT_EQ(true, keyMap.isCommand(mask));
}
@@ -209,8 +211,8 @@ TEST(KeyMapTests, isCommand_superMask_returnTrue)
{
KeyMap keyMap;
KeyModifierMask mask= KeyModifierSuper;
-
+
EXPECT_EQ(true, keyMap.isCommand(mask));
}
-
+
}