blob: 8792842f0d6e08dae67e3bc9661d223ead00693f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
SPDX-FileCopyrightText: 2003, 2004 Waldo Bastian <bastian@kde.org>
SPDX-License-Identifier: MIT
*/
#include "test4.h"
#include <QGuiApplication>
#include <QStandardPaths>
#include <QFile>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
Q_UNUSED(app);
{
KConfig initialConfig(QStringLiteral("test4rc"));
KConfigGroup group = initialConfig.group(QStringLiteral("Foo"));
group.writeEntry(QStringLiteral("foo bar"), QStringLiteral("Value"));
}
Test4 *t = Test4::self();
const bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String{"/test4rc"});
if (!ok) {
qWarning() << "config file was not created!";
}
if (t->fooBar() != QLatin1String("Value")) {
qWarning() << "wrong value for foo bar:" << t->fooBar();
}
delete t;
return ok ? 0 : 1;
}
|