File indexing completed on 2024-04-28 15:19:31
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2015 Christoph Cullmann <cullmann@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include <QTest> 0009 #include <kconfiggroup.h> 0010 #include <ksharedconfig.h> 0011 0012 class FallbackConfigResourcesTest : public QObject 0013 { 0014 Q_OBJECT 0015 private Q_SLOTS: 0016 void initTestCase(); 0017 void testResourceFallbackFile(); 0018 }; 0019 0020 void FallbackConfigResourcesTest::initTestCase() 0021 { 0022 QStandardPaths::setTestModeEnabled(true); 0023 } 0024 0025 void FallbackConfigResourcesTest::testResourceFallbackFile() 0026 { 0027 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig(QStringLiteral("kconfigtesting"), KConfig::NoGlobals); 0028 QVERIFY(sharedConfig); 0029 0030 KConfigGroup cfg(sharedConfig, QStringLiteral("MainSection")); 0031 QCOMPARE(cfg.readEntry(QStringLiteral("TestEntry"), QStringLiteral("UnexpectedData")), QStringLiteral("ExpectedData")); 0032 } 0033 0034 QTEST_MAIN(FallbackConfigResourcesTest) 0035 0036 #include "fallbackconfigresourcestest.moc"