Diagnostics collects what this session doesn't allow, logs it, and lists it in the settings panel (with a dot on the gear): KWin not launching sloposk as its keyboard (detected by WAYLAND_SOCKET, since KWin offers the input-method global to every client), fake input missing or too old, org.kde.keyboard unreachable, and the D-Bus control name taken. Modifier combos go through fake input even in text fields: KWin drops the input method's modifier mask for most clients, so Ctrl+A typed "a". The desktop file is generated with an absolute Exec, which KWin needs to match it: one for the installed binary, one for the build's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
#include "diagnostics/Diagnostics.h"
|
|
|
|
#include <QSignalSpy>
|
|
#include <QTest>
|
|
|
|
class TestDiagnostics : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
void reportsAndClears()
|
|
{
|
|
Diagnostics diagnostics;
|
|
QSignalSpy changed(&diagnostics, &Diagnostics::problemsChanged);
|
|
QTest::ignoreMessage(QtWarningMsg, "broken");
|
|
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken"));
|
|
QCOMPARE(diagnostics.problems(), QStringList{QStringLiteral("broken")});
|
|
diagnostics.check(QStringLiteral("a"), true, QStringLiteral("broken"));
|
|
QVERIFY(diagnostics.problems().isEmpty());
|
|
QCOMPARE(changed.count(), 2);
|
|
}
|
|
|
|
void repeatsAreQuiet()
|
|
{
|
|
Diagnostics diagnostics;
|
|
QSignalSpy changed(&diagnostics, &Diagnostics::problemsChanged);
|
|
diagnostics.check(QStringLiteral("a"), true, QStringLiteral("fine"));
|
|
QTest::ignoreMessage(QtWarningMsg, "broken");
|
|
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken"));
|
|
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken")); // no second warning
|
|
QCOMPARE(changed.count(), 1);
|
|
}
|
|
|
|
void listsByIdNotArrival()
|
|
{
|
|
Diagnostics diagnostics;
|
|
QTest::ignoreMessage(QtWarningMsg, "second");
|
|
QTest::ignoreMessage(QtWarningMsg, "first");
|
|
diagnostics.check(QStringLiteral("b"), false, QStringLiteral("second"));
|
|
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("first"));
|
|
QCOMPARE(diagnostics.problems(), (QStringList{QStringLiteral("first"), QStringLiteral("second")}));
|
|
}
|
|
};
|
|
|
|
QTEST_GUILESS_MAIN(TestDiagnostics)
|
|
#include "tst_diagnostics.moc"
|