File: test4main.cpp

package info (click to toggle)
kconfig 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,080 kB
  • sloc: cpp: 17,783; xml: 73; perl: 63; sh: 14; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 913 bytes parent folder | download | duplicates (2)
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 <QFile>
#include <QGuiApplication>
#include <QStandardPaths>

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;
}