23using namespace swift::misc::input;
37 void hotkeyCombination();
40 void hotKeyNonEqual();
41 void hotkeyEqualFromVariant();
42 void hotkeyFindSupersetOf();
43 void hotkeyFindSubsetOf();
46 void CTestInput::keyboardKey()
49 QVERIFY2(key.
getKey() == Key_Unknown,
"Default constructed object should have unknown key");
51 QVERIFY2(key.
hasKey() ==
false,
"Default constructed object should return false");
54 QVERIFY2(key.
getKey() == Key_C,
"CKeyboardKey::setKey(char key) failed");
57 QVERIFY2(key2.getKey() == Key_5,
"Returned key is wrong");
58 QVERIFY2(key2.getKeyAsString() ==
"5",
"Key as string failed");
59 QVERIFY2(key2.hasKey() ==
true,
"Should return true for key != Key_Unknown");
62 QVERIFY2(key3.isModifier(),
"RightAlt is a modifier");
65 void CTestInput::hotkeyCombination()
71 QVERIFY2(comb.
size() == 3,
"Size is incorrect");
72 QVERIFY2(comb.
toQString() ==
"CtrlLeft+AltLeft+5",
"String representation failed");
75 QVERIFY2(comb.
size() == 3,
"Size is incorrect");
76 QVERIFY2(comb.
toQString() ==
"CtrlLeft+AltRight+5",
"String representation failed");
79 QVERIFY2(comb.
size() == 2,
"Size is incorrect");
80 QVERIFY2(comb.
toQString() ==
"CtrlLeft+5",
"String representation failed");
83 QVERIFY2(comb.
size() == 1,
"Size is incorrect");
84 QVERIFY2(comb.
toQString() ==
"CtrlLeft",
"String representation failed");
87 void CTestInput::hotKeyEqual()
89 CHotkeyCombination comb1;
94 CHotkeyCombination comb2;
98 QVERIFY2(actionHotkey1 == actionHotkey2,
"Objects should equal");
101 void CTestInput::hotKeyNonEqual()
103 CHotkeyCombination comb;
108 CHotkeyCombination comb2;
112 QVERIFY2(actionHotkey1 != actionHotkey2,
"Objects should not be equal");
114 CHotkeyCombination comb3;
118 QVERIFY2(actionHotkey1 != actionHotkey3,
"Objects should not be equal");
120 CHotkeyCombination comb4;
124 QVERIFY2(actionHotkey1 != actionHotkey4,
"Objects should not be equal");
127 void CTestInput::hotkeyEqualFromVariant()
129 CHotkeyCombination comb1;
133 CActionHotkeyList list1;
136 CHotkeyCombination comb2;
140 CActionHotkeyList list2;
145 void CTestInput::hotkeyFindSupersetOf()
147 CHotkeyCombination comb1;
152 CHotkeyCombination comb2;
156 CHotkeyCombination comb3;
161 CActionHotkeyList list1;
168 void CTestInput::hotkeyFindSubsetOf()
170 CHotkeyCombination comb1;
174 CHotkeyCombination comb2;
179 CHotkeyCombination comb3;
184 CActionHotkeyList list1;
195#include "testinput.moc"
static const CIdentifier & anonymous()
Returns an anonymous identifier, which is a valid identifier without name.
void push_back(const T &value)
Appends an element at the end of the sequence.
bool isEmpty() const
Synonym for empty.
static CVariant fromValue(T &&value)
Construct a variant from a value.
QString toQString(bool i18n=false) const
Cast as QString.
Free functions in swift::misc.
QVERIFY2(condition, message)
#define SWIFTTEST_APPLESS_MAIN(TestObject)
Implements a main() function that executes all tests in TestObject without instantiating a QApplicati...