- Full (iPad Pro) mode: every typing key from the keymap, number row, tab, caps lock, ctrl/super/alt; shifted symbol shown above and flickable - Dead keys compose with the locale's XKB compose table - Ctrl/Alt/Super stick like shift and turn keys into shortcuts; a tapped or held shift joins shortcuts and non-text keys, auto-shift and caps lock don't - Auto-capitalization and caps lock only capitalize letters; the user's shift picks the keymap's shifted level - Mode switch in settings keeps key size by resizing the window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1011 B
C++
44 lines
1011 B
C++
#include "input/DeadKeys.h"
|
|
|
|
#include <QTest>
|
|
#include <xkbcommon/xkbcommon-keysyms.h>
|
|
|
|
using namespace Qt::StringLiterals;
|
|
|
|
class TestDeadKeys : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
void composesWithTheNextLetter()
|
|
{
|
|
DeadKeys dead(u"en_US.UTF-8"_s);
|
|
QVERIFY(!dead.isPending());
|
|
dead.press(XKB_KEY_dead_acute);
|
|
QVERIFY(dead.isPending());
|
|
QCOMPARE(dead.compose(u"e"_s), u"é");
|
|
QVERIFY(!dead.isPending());
|
|
|
|
dead.press(XKB_KEY_dead_caron);
|
|
QCOMPARE(dead.compose(u"C"_s), u"Č");
|
|
}
|
|
|
|
void typesAccentAndLetterWhenNothingComposes()
|
|
{
|
|
DeadKeys dead(u"en_US.UTF-8"_s);
|
|
dead.press(XKB_KEY_dead_caron);
|
|
QCOMPARE(dead.compose(u"q"_s), u"ˇq");
|
|
}
|
|
|
|
void cancelForgetsTheAccent()
|
|
{
|
|
DeadKeys dead(u"en_US.UTF-8"_s);
|
|
dead.press(XKB_KEY_dead_acute);
|
|
dead.cancel();
|
|
QVERIFY(!dead.isPending());
|
|
}
|
|
};
|
|
|
|
QTEST_GUILESS_MAIN(TestDeadKeys)
|
|
#include "tst_deadkeys.moc"
|