diff options
author | Andre Heinecke <[email protected]> | 2018-04-04 09:21:53 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2018-04-04 09:21:53 +0000 |
commit | 5eb261d6028ab2c0ddd9af8e3e1f82e479c6109c (patch) | |
tree | 117c1c579ccbb10e6a14ca5e7b6c1c7b7203b64c | |
parent | Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme (diff) | |
download | gpgme-5eb261d6028ab2c0ddd9af8e3e1f82e479c6109c.tar.gz gpgme-5eb261d6028ab2c0ddd9af8e3e1f82e479c6109c.zip |
qt: Add test for resetting config value
* lang/qt/tests/t-config.cpp (CryptoConfigTest::testDefault): New.
--
There is a bug around here somewhere. This test does not show
it :-(
-rw-r--r-- | lang/qt/tests/t-config.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lang/qt/tests/t-config.cpp b/lang/qt/tests/t-config.cpp index e04a6bb3..afbb4d1b 100644 --- a/lang/qt/tests/t-config.cpp +++ b/lang/qt/tests/t-config.cpp @@ -39,6 +39,8 @@ #include "t-support.h" #include "protocol.h" #include "cryptoconfig.h" +#include "engineinfo.h" + #include <unistd.h> using namespace QGpgME; @@ -51,7 +53,7 @@ private Q_SLOTS: void testKeyserver() { // Repeatedly set a config value and clear it - // this war broken at some point so it gets a + // this was broken at some point so it gets a // unit test. for (int i = 0; i < 10; i++) { auto conf = cryptoConfig(); @@ -78,6 +80,36 @@ private Q_SLOTS: } } + void testDefault() + { + if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.2.0") { + // We are using compliance here and other options might also + // be unsupported in older versions. + return; + } + // First set compliance to de-vs + auto conf = cryptoConfig(); + QVERIFY(conf); + auto entry = conf->entry(QStringLiteral("gpg"), + QStringLiteral("Configuration"), + QStringLiteral("compliance")); + QVERIFY(entry); + entry->setStringValue("de-vs"); + conf->sync(true); + conf->clear(); + entry = conf->entry(QStringLiteral("gpg"), + QStringLiteral("Configuration"), + QStringLiteral("compliance")); + QCOMPARE(entry->stringValue(), QStringLiteral("de-vs")); + entry->resetToDefault(); + conf->sync(true); + conf->clear(); + entry = conf->entry(QStringLiteral("gpg"), + QStringLiteral("Configuration"), + QStringLiteral("compliance")); + QCOMPARE(entry->stringValue(), QStringLiteral("gnupg")); + } + void initTestCase() { QGpgMETest::initTestCase(); |