diff options
author | Ingo Klöcker <[email protected]> | 2023-02-13 09:58:31 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2023-02-14 08:25:21 +0000 |
commit | ea6f15ed602eeb9fa87766ba88acc78361a14b38 (patch) | |
tree | 8e3d23caee9507a367920116fddae0b6bc8fb9ed /lang/qt/tests/t-encrypt.cpp | |
parent | core: Switch to logging via gpgrt (diff) | |
download | gpgme-ea6f15ed602eeb9fa87766ba88acc78361a14b38.tar.gz gpgme-ea6f15ed602eeb9fa87766ba88acc78361a14b38.zip |
qt: Add simple and extended progress signals replacing old signal
* lang/qt/src/job.h (Job): Add signals jobProgress and rawProgress.
Deprecate signal progress.
* lang/qt/src/multideletejob.cpp (MultiDeleteJob::slotResult): Emit
new progress signals.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::slotStatus): Ditto.
* lang/qt/src/threadedjobmixin.h (ThreadedJobMixin::showProgress): Use
modern overload of QMetaObject::invokeMethod to forward the progress
signal and add the value of what. Add forwarding of progress to the new
signals.
* lang/qt/tests/t-encrypt.cpp (EncryptionTest::testProgress): Test
the new signals instead of the deprecated one.
--
The new signal jobProgress omits the what value which is useless for
most consumers. The new signal rawProgress makes all information
provided by the backend available to consumers. The latter is not
really meant to be used by users of gpgme. It will be used by the
archive jobs to provide more user-friendly signals.
GnuPG-bug-id: 6342
Diffstat (limited to 'lang/qt/tests/t-encrypt.cpp')
-rw-r--r-- | lang/qt/tests/t-encrypt.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp index 6a4c68e9..35b9bbf9 100644 --- a/lang/qt/tests/t-encrypt.cpp +++ b/lang/qt/tests/t-encrypt.cpp @@ -120,7 +120,22 @@ private Q_SLOTS: bool initSeen = false; bool finishSeen = false; - connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) { + connect(job, &Job::jobProgress, this, [&initSeen, &finishSeen] (int current, int total) { + // We only check for progress 0 and max progress as the other progress + // lines depend on the system speed and are as such unreliable to test. + QVERIFY(total == PROGRESS_TEST_SIZE); + if (current == 0) { + initSeen = true; + } + if (current == total) { + finishSeen = true; + } + QVERIFY(current >= 0 && current <= total); + }); + connect(job, &Job::rawProgress, this, [&initSeen, &finishSeen] (const QString &what, int type, int current, int total) { + // `what` is something like "-&12", i.e. a special fd passed to gpg; we only check that it's not empty + QVERIFY(!what.isEmpty()); + QCOMPARE(type, '?'); // We only check for progress 0 and max progress as the other progress // lines depend on the system speed and are as such unreliable to test. QVERIFY(total == PROGRESS_TEST_SIZE); |