File indexing completed on 2024-05-12 15:34:03

0001 /*
0002     SPDX-FileCopyrightText: 2003, 2004 Waldo Bastian <bastian@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #include "test4.h"
0008 #include <QFile>
0009 #include <QGuiApplication>
0010 #include <QStandardPaths>
0011 
0012 int main(int argc, char **argv)
0013 {
0014     QGuiApplication app(argc, argv);
0015     Q_UNUSED(app);
0016     {
0017         KConfig initialConfig(QStringLiteral("test4rc"));
0018         KConfigGroup group = initialConfig.group(QStringLiteral("Foo"));
0019         group.writeEntry(QStringLiteral("foo bar"), QStringLiteral("Value"));
0020     }
0021     Test4 *t = Test4::self();
0022     const bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String{"/test4rc"});
0023     if (!ok) {
0024         qWarning() << "config file was not created!";
0025     }
0026     if (t->fooBar() != QLatin1String("Value")) {
0027         qWarning() << "wrong value for foo bar:" << t->fooBar();
0028     }
0029     delete t;
0030     return ok ? 0 : 1;
0031 }