aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_notmuchworker.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-26 19:31:45 +0200
committerDanilo M. <danix@danix.xyz>2026-08-26 19:31:45 +0200
commit59a196ea849c64c51311f56bf62130e74d90b784 (patch)
treef322f955b0b5981dfafc85db72f224795941a4ad /tests/test_notmuchworker.cpp
parent1c034f6358f17c5c1d0eeaa04c42c33fac125d93 (diff)
downloadqtmaildir-59a196ea849c64c51311f56bf62130e74d90b784.tar.gz
qtmaildir-59a196ea849c64c51311f56bf62130e74d90b784.zip
feat: open the unsynced-changes count to see what it counts
Item 119, and item 146 which is the same request recorded again. The status bar's count answers "is my work safe to quit on" and could not say what the work was. The label opens a read-only list on a click. A QLabel has no clicked signal, so the press is taken by MainWindow's existing event filter rather than by replacing the label with a flat QToolButton, which would have brought the style's button metrics into a status bar the label already sits correctly in. The pointing-hand cursor is the affordance, since a status-bar label has room for nothing else. The layout is the user's own: a message appears once with its actions beneath it. PendingChangesDialog::rowsFor() does the grouping over a run of rows sharing an id, which the snapshot has already ordered, so the actions under one message keep the order they were made in. Read-only, deliberately. Retrying or discarding a change from here would be a new mutation path with its own undo question, and the count exists to be understood rather than edited. Three rules the tests pin, each of which is a way the list could disagree with the count it was opened from: - Grouping must not collapse: two actions on one message are two rows. - A thread row stays thread-scoped and reports how many messages it covered. - An id the index no longer holds still opens a run of its own, showing that its subject is unknown rather than folding its actions under the message above it. This is why the row carries startsMessage rather than inferring it from a non-empty subject. The queued call carrying QStringList, QList<bool> and QList<int> is covered by a test that drives it across a real thread, since a container whose metatype does not resolve is dropped at runtime and the slot runs with a default. Both survive on Qt 6.11; the test is what says so, and what would fail if that changed. Italian ships with it: five new strings, lupdate clean, lrelease 522 finished and 0 unfinished. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P88Q3MCSCSQxKDy7pmXh9F
Diffstat (limited to 'tests/test_notmuchworker.cpp')
-rw-r--r--tests/test_notmuchworker.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_notmuchworker.cpp b/tests/test_notmuchworker.cpp
index bcde45c..2e960be 100644
--- a/tests/test_notmuchworker.cpp
+++ b/tests/test_notmuchworker.cpp
@@ -58,6 +58,7 @@ private slots:
void applyTagsToThreadsSpansMultipleThreads();
void applyTagsToThreadsWithNoThreadsDoesNothing();
+ void pendingSubjectsCrossAQueuedCall();
void pendingSubjectsAnswerPositionally();
void aMissingPendingIdYieldsAnEmptySubject();
void requestAllTagsReturnsSortedTags();
@@ -964,6 +965,40 @@ void TestNotmuchWorker::applyTagsToThreadsWithNoThreadsDoesNothing()
QVERIFY(errors.isEmpty());
}
+void TestNotmuchWorker::pendingSubjectsCrossAQueuedCall()
+{
+ // The dialog reaches the worker over a QUEUED connection, and a container
+ // whose metatype is not registered under the name invokeMethod resolves is
+ // DROPPED at runtime with a warning, leaving the slot to run with a
+ // default. CLAUDE.md records that trap for Q_ENUM; QList<int> is the same
+ // trap in a different shape, and it is the type this signal answers with.
+ //
+ // Driven through invokeMethod on a real thread rather than by calling the
+ // slot directly: a direct call proves nothing about the queued path, which
+ // is the only one production uses.
+ NotmuchWorker worker(m_fixture.configPath());
+ QThread thread;
+ worker.moveToThread(&thread);
+ thread.start();
+
+ QSignalSpy spy(&worker, &NotmuchWorker::pendingSubjectsResolved);
+ QVERIFY(QMetaObject::invokeMethod(
+ &worker, "resolvePendingSubjects", Qt::QueuedConnection,
+ Q_ARG(QStringList, QStringList{ QStringLiteral("b1@example.org") }),
+ Q_ARG(QList<bool>, QList<bool>{ false })));
+
+ QVERIFY2(spy.wait(5000),
+ "the queued call never produced an answer: a container argument "
+ "was most likely dropped for want of a registered metatype");
+ QCOMPARE(spy.first().at(0).toStringList().size(), 1);
+ QVERIFY(!spy.first().at(0).toStringList().at(0).isEmpty());
+ // And the counts survived the crossing as a real list, not a default.
+ QCOMPARE(spy.first().at(1).value<QList<int>>().size(), 1);
+
+ thread.quit();
+ QVERIFY(thread.wait(5000));
+}
+
void TestNotmuchWorker::pendingSubjectsAnswerPositionally()
{
// Item 119. The dialog has already decided what its rows are and in what