diff options
author | Ingo Klöcker <[email protected]> | 2021-06-29 10:12:33 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2021-06-29 10:12:33 +0000 |
commit | 12006a782900687a7f0158a3f931528cfc5ff451 (patch) | |
tree | 99ac41fdd172540dd95b602a333e2aaffc16c2dd /lang/qt/tests/t-config.cpp | |
parent | Update NEWS. (diff) | |
download | gpgme-12006a782900687a7f0158a3f931528cfc5ff451.tar.gz gpgme-12006a782900687a7f0158a3f931528cfc5ff451.zip |
qt: Allow retrieving the default value of a config entry
* lang/qt/src/cryptoconfig.cpp, lang/qt/src/cryptoconfig.h
(CryptoConfigEntry::defaultValue): New.
* lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmenewcryptoconfig.h
(QGpgMENewCryptoConfigEntry::defaultValue): New.
* lang/qt/tests/t-config.cpp (CryptoConfigTest::testDefault()):
Add test of CryptoConfigEntry::defaultValue(). Port away from deprecated
CryptoConfig::entry overload.
--
GnuPG-bug-id: 5515
Diffstat (limited to 'lang/qt/tests/t-config.cpp')
-rw-r--r-- | lang/qt/tests/t-config.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lang/qt/tests/t-config.cpp b/lang/qt/tests/t-config.cpp index 9ec95669..b84dbfd4 100644 --- a/lang/qt/tests/t-config.cpp +++ b/lang/qt/tests/t-config.cpp @@ -57,27 +57,24 @@ private Q_SLOTS: // 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")); + auto entry = conf->entry(QStringLiteral("gpg"), QStringLiteral("compliance")); QVERIFY(entry); + const auto defaultValue = entry->defaultValue().toString(); + QCOMPARE(defaultValue, QStringLiteral("gnupg")); + entry->setStringValue("de-vs"); conf->sync(true); conf->clear(); - entry = conf->entry(QStringLiteral("gpg"), - QStringLiteral("Configuration"), - QStringLiteral("compliance")); + entry = conf->entry(QStringLiteral("gpg"), 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")); + entry = conf->entry(QStringLiteral("gpg"), QStringLiteral("compliance")); + QCOMPARE(entry->stringValue(), defaultValue); } void initTestCase() |