aboutsummaryrefslogtreecommitdiff
path: root/autotests/fallbackconfigresourcestest.cpp
blob: 8d7768ee01384d9dc9c46cb1fb0bca1777ee5a43 (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
32
33
34
35
36
/*
   This file is part of the KDE libraries
   SPDX-FileCopyrightText: 2015 Christoph Cullmann <cullmann@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include <QtTest>
#include <ksharedconfig.h>
#include <kconfiggroup.h>

class FallbackConfigResourcesTest : public QObject
{
    Q_OBJECT
private Q_SLOTS:
    void initTestCase();
    void testResourceFallbackFile();
};

void FallbackConfigResourcesTest::initTestCase()
{
    QStandardPaths::setTestModeEnabled(true);
}

void FallbackConfigResourcesTest::testResourceFallbackFile()
{
    KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(QStringLiteral("kconfigtesting"), KConfig::NoGlobals);
    QVERIFY(sharedConfig);

    KConfigGroup cfg(sharedConfig, QStringLiteral("MainSection"));
    QCOMPARE(cfg.readEntry(QStringLiteral("TestEntry"), QStringLiteral("UnexpectedData")), QStringLiteral("ExpectedData"));
}

QTEST_MAIN(FallbackConfigResourcesTest)

#include "fallbackconfigresourcestest.moc"