2019-08-07 10:09:12 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QtTest>
|
|
|
|
|
|
|
|
#include <dgiofile.h>
|
|
|
|
#include <dgiofileinfo.h>
|
|
|
|
|
|
|
|
#include "dgiosettings.h"
|
|
|
|
|
|
|
|
class DGioSettingsTest : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DGioSettingsTest() {}
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void testCase_Settings() {
|
2019-08-07 11:51:36 +02:00
|
|
|
if (DGioSettings::isSchemaInstalled("com.deepin.dde.appearance") == false) {
|
2019-08-07 10:09:12 +02:00
|
|
|
qWarning() << "com.deepin.dde.appearance" << "invalid";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-07 11:51:36 +02:00
|
|
|
DGioSettings settings("com.deepin.dde.appearance", this);
|
2019-08-07 10:09:12 +02:00
|
|
|
QVERIFY(settings.value("background-uris").isValid());
|
|
|
|
QVERIFY(settings.value("extra-picture-uris").isValid());
|
|
|
|
const QStringList& tmpValue = settings.value("extra-picture-uris").toStringList();
|
|
|
|
settings.setValue("extra-picture-uris", QStringList());
|
|
|
|
settings.setValue("extra-picture-uris", QStringList() << "ddd");
|
|
|
|
settings.sync();
|
|
|
|
QVERIFY(settings.value("extra-picture-uris").toStringList() == QStringList() << "ddd");
|
|
|
|
settings.setValue("extra-picture-uris", tmpValue, true);
|
|
|
|
QVERIFY(settings.value("extra-picture-uris").toStringList() == tmpValue);
|
|
|
|
|
|
|
|
QVERIFY(settings.keys().contains("extra-picture-uris"));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
QTEST_APPLESS_MAIN(DGioSettingsTest)
|
|
|
|
|
|
|
|
#include "tst_dgiosettings.moc"
|