23 using 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");
50 QVERIFY2(key.
getKeyAsString() == QString(),
"Default constructed object should return empty string");
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()
98 QVERIFY2(actionHotkey1 == actionHotkey2,
"Objects should equal");
101 void CTestInput::hotKeyNonEqual()
112 QVERIFY2(actionHotkey1 != actionHotkey2,
"Objects should not be equal");
118 QVERIFY2(actionHotkey1 != actionHotkey3,
"Objects should not be equal");
124 QVERIFY2(actionHotkey1 != actionHotkey4,
"Objects should not be equal");
127 void CTestInput::hotkeyEqualFromVariant()
145 void CTestInput::hotkeyFindSupersetOf()
168 void CTestInput::hotkeyFindSubsetOf()
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.