Text rules: auto-capitalization, double-space period, backspace repeat
- TextContext: field purpose/hints and text before the cursor, reported by the backend (KWin content_type + surrounding_text) - TextRules: sentence-start and double-space heuristics, deletion helpers - KeyRepeater: held backspace repeats, then deletes whole words (Ctrl+BS) - Controller keeps a best-guess of the text before the cursor so rules work instantly and in fields that don't report surrounding text - No auto-capitalization or smart punctuation in password/URL/email fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "input/KeyRepeater.h"
|
||||
|
||||
#include <QSignalSpy>
|
||||
#include <QTest>
|
||||
|
||||
class TestKeyRepeater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void repeatsThenSwitchesToWords()
|
||||
{
|
||||
KeyRepeater repeater({.initialDelayMs = 50, .intervalMs = 10, .wordModeAfterMs = 150, .wordIntervalMs = 20});
|
||||
QSignalSpy spy(&repeater, &KeyRepeater::repeat);
|
||||
repeater.start();
|
||||
|
||||
QTest::qWait(40);
|
||||
QCOMPARE(spy.count(), 0); // still in the initial delay
|
||||
QTRY_VERIFY(spy.count() >= 3);
|
||||
QCOMPARE(spy.first().first().toBool(), false);
|
||||
QTRY_VERIFY(spy.last().first().toBool()); // word mode eventually
|
||||
|
||||
repeater.stop();
|
||||
const auto count = spy.count();
|
||||
QTest::qWait(60);
|
||||
QCOMPARE(spy.count(), count);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_GUILESS_MAIN(TestKeyRepeater)
|
||||
#include "tst_keyrepeater.moc"
|
||||
Reference in New Issue
Block a user