From 27e145e797a265de93cc1238d6e6ee5d3f3c1998 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 5 Aug 2015 10:00:33 +0200 Subject: test_kconf_update: use QStandardPaths test mode to avoid touching the user's real files --- src/kconf_update/kconf_update.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/kconf_update/kconf_update.cpp b/src/kconf_update/kconf_update.cpp index 7659e7b2..bd346234 100644 --- a/src/kconf_update/kconf_update.cpp +++ b/src/kconf_update/kconf_update.cpp @@ -117,6 +117,10 @@ KonfUpdate::KonfUpdate(QCommandLineParser *parser) m_debug = parser->isSet("debug"); + if (parser->isSet("testmode")) { + QStandardPaths::setTestModeEnabled(true); + } + m_bUseConfigInfo = false; if (parser->isSet("check")) { m_bUseConfigInfo = true; @@ -948,6 +952,7 @@ int main(int argc, char **argv) parser.setApplicationDescription(QCoreApplication::translate("main", "KDE Tool for updating user configuration files")); parser.addHelpOption(); parser.addOption(QCommandLineOption(QStringList() << "debug", QCoreApplication::translate("main", "Keep output results from scripts"))); + parser.addOption(QCommandLineOption(QStringList() << "testmode", QCoreApplication::translate("main", "For unit tests only: use test directories to stay away from the user's real files"))); parser.addOption(QCommandLineOption(QStringList() << "check", QCoreApplication::translate("main", "Check whether config file itself requires updating"), "update-file")); //parser.addOption(QCommandLineOption(QStringList() << "+[file]", QCoreApplication::translate("main", "File to read update instructions from"))); -- cgit v1.2.1