aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test4main.cpp
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2014-03-16 23:30:59 +0100
committerDavid Faure <faure@kde.org>2014-03-23 23:00:03 +0100
commitc1980dbc51c9aa2770d09850e69529ea2211924b (patch)
tree2bbccf3cdebbd6d1149eb1ae615c832570cfa000 /autotests/kconfig_compiler/test4main.cpp
parent41ccd7bcd61c478a4243165b1df0c48e2ecad0df (diff)
downloadkconfig-c1980dbc51c9aa2770d09850e69529ea2211924b.tar.gz
kconfig-c1980dbc51c9aa2770d09850e69529ea2211924b.tar.bz2
Add KCoreConfigSkeleton::read() which doesn't call reparseConfiguration.
Call it from generated singletons, since the constructor creates a KConfig from a filename, which already loads from disk. This removes the need for using DelayedParsing. REVIEW: 116845
Diffstat (limited to 'autotests/kconfig_compiler/test4main.cpp')
-rw-r--r--autotests/kconfig_compiler/test4main.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/autotests/kconfig_compiler/test4main.cpp b/autotests/kconfig_compiler/test4main.cpp
index 8f1c1ec8..1df7cc5e 100644
--- a/autotests/kconfig_compiler/test4main.cpp
+++ b/autotests/kconfig_compiler/test4main.cpp
@@ -21,12 +21,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "test4.h"
#include <QGuiApplication>
+#include <QStandardPaths>
+#include <QFile>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
Q_UNUSED(app);
+ {
+ KConfig initialConfig(QLatin1String("test4rc"));
+ KConfigGroup group = initialConfig.group(QLatin1String("Foo"));
+ group.writeEntry(QLatin1String("foo bar"), QStringLiteral("Value"));
+ }
Test4 *t = Test4::self();
+ bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/test4rc");
+ if (!ok) {
+ qWarning() << "config file was not created!";
+ }
+ if (t->fooBar() != QStringLiteral("Value")) {
+ qWarning() << "wrong value for foo bar:" << t->fooBar();
+ }
delete t;
- return 0;
+ return ok ? 0 : 1;
}