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 :-(
This commit is contained in:
parent
fed024eff1
commit
5eb261d602
@ -39,6 +39,8 @@
|
|||||||
#include "t-support.h"
|
#include "t-support.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "cryptoconfig.h"
|
#include "cryptoconfig.h"
|
||||||
|
#include "engineinfo.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
using namespace QGpgME;
|
using namespace QGpgME;
|
||||||
@ -51,7 +53,7 @@ private Q_SLOTS:
|
|||||||
void testKeyserver()
|
void testKeyserver()
|
||||||
{
|
{
|
||||||
// Repeatedly set a config value and clear it
|
// 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.
|
// unit test.
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
auto conf = cryptoConfig();
|
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()
|
void initTestCase()
|
||||||
{
|
{
|
||||||
QGpgMETest::initTestCase();
|
QGpgMETest::initTestCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user