diff options
Diffstat (limited to 'lang/qt/tests/t-encrypt.cpp')
-rw-r--r-- | lang/qt/tests/t-encrypt.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp index 4d65dc7f..57b586d5 100644 --- a/lang/qt/tests/t-encrypt.cpp +++ b/lang/qt/tests/t-encrypt.cpp @@ -85,18 +85,18 @@ private Q_SLOTS: std::vector<Key> keys; auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"), false, keys); - Q_ASSERT(!keylistresult.error()); - Q_ASSERT(keys.size() == 1); + QVERIFY(!keylistresult.error()); + QVERIFY(keys.size() == 1); delete listjob; auto job = openpgp()->encryptJob(/*ASCII Armor */true, /* Textmode */ true); - Q_ASSERT(job); + QVERIFY(job); QByteArray cipherText; auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText); delete job; - Q_ASSERT(!result.error()); + QVERIFY(!result.error()); const auto cipherString = QString::fromUtf8(cipherText); - Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); + QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); /* Now decrypt */ if (!decryptSupported()) { @@ -109,8 +109,8 @@ private Q_SLOTS: auto decJob = new QGpgMEDecryptJob(ctx); QByteArray plainText; auto decResult = decJob->exec(cipherText, plainText); - Q_ASSERT(!result.error()); - Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello World")); + QVERIFY(!result.error()); + QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello World")); delete decJob; } @@ -125,12 +125,12 @@ private Q_SLOTS: std::vector<Key> keys; auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"), false, keys); - Q_ASSERT(!keylistresult.error()); - Q_ASSERT(keys.size() == 1); + QVERIFY(!keylistresult.error()); + QVERIFY(keys.size() == 1); delete listjob; auto job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false); - Q_ASSERT(job); + QVERIFY(job); QByteArray plainBa; plainBa.fill('X', PROGRESS_TEST_SIZE); QByteArray cipherText; @@ -140,21 +140,21 @@ private Q_SLOTS: connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, 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. - Q_ASSERT(total == PROGRESS_TEST_SIZE); + QVERIFY(total == PROGRESS_TEST_SIZE); if (current == 0) { initSeen = true; } if (current == total) { finishSeen = true; } - Q_ASSERT(current >= 0 && current <= total); + QVERIFY(current >= 0 && current <= total); }); connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &, const QByteArray &, const QString, const GpgME::Error) { - Q_ASSERT(initSeen); - Q_ASSERT(finishSeen); + QVERIFY(initSeen); + QVERIFY(finishSeen); Q_EMIT asyncDone(); }); @@ -165,7 +165,7 @@ private Q_SLOTS: job->start(keys, inptr, outptr, Context::AlwaysTrust); QSignalSpy spy (this, SIGNAL(asyncDone())); - Q_ASSERT(spy.wait()); + QVERIFY(spy.wait()); } void testSymmetricEncryptDecrypt() @@ -183,9 +183,9 @@ private Q_SLOTS: QByteArray cipherText; auto result = job->exec(std::vector<Key>(), QStringLiteral("Hello symmetric World").toUtf8(), Context::AlwaysTrust, cipherText); delete job; - Q_ASSERT(!result.error()); + QVERIFY(!result.error()); const auto cipherString = QString::fromUtf8(cipherText); - Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); + QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); killAgent(mDir.path()); @@ -195,8 +195,8 @@ private Q_SLOTS: auto decJob = new QGpgMEDecryptJob(ctx2); QByteArray plainText; auto decResult = decJob->exec(cipherText, plainText); - Q_ASSERT(!result.error()); - Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); + QVERIFY(!result.error()); + QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); delete decJob; } @@ -212,8 +212,8 @@ private: std::vector<Key> keys; auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"), false, keys); - Q_ASSERT(!keylistresult.error()); - Q_ASSERT(keys.size() == 1); + QVERIFY(!keylistresult.error()); + QVERIFY(keys.size() == 1); delete listjob; auto ctx = Context::createForProtocol(OpenPGP); @@ -229,10 +229,10 @@ private: cipherText); printf("After exec\n"); delete job; - Q_ASSERT(!result.error()); + QVERIFY(!result.error()); printf("Cipher:\n%s\n", cipherText.constData()); const auto cipherString = QString::fromUtf8(cipherText); - Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); + QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); killAgent(mDir.path()); @@ -240,7 +240,7 @@ private: QTemporaryDir tmp; qputenv("GNUPGHOME", tmp.path().toUtf8()); QFile agentConf(tmp.path() + QStringLiteral("/gpg-agent.conf")); - Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); + QVERIFY(agentConf.open(QIODevice::WriteOnly)); agentConf.write("allow-loopback-pinentry"); agentConf.close(); @@ -251,9 +251,9 @@ private: auto decJob = new QGpgMEDecryptJob(ctx2); QByteArray plainText; auto decResult = decJob->exec(cipherText, plainText); - Q_ASSERT(!decResult.error()); + QVERIFY(!decResult.error()); qDebug() << "Plain: " << plainText; - Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); + QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); delete decJob; killAgent(tmp.path()); @@ -267,12 +267,12 @@ public Q_SLOT: QGpgMETest::initTestCase(); const QString gpgHome = qgetenv("GNUPGHOME"); qputenv("GNUPGHOME", mDir.path().toUtf8()); - Q_ASSERT(mDir.isValid()); + QVERIFY(mDir.isValid()); QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf")); - Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); + QVERIFY(agentConf.open(QIODevice::WriteOnly)); agentConf.write("allow-loopback-pinentry"); agentConf.close(); - Q_ASSERT(copyKeyrings(gpgHome, mDir.path())); + QVERIFY(copyKeyrings(gpgHome, mDir.path())); } private: |