diff options
author | David Faure <david.faure@kdab.com> | 2014-07-11 01:46:03 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2014-07-23 20:05:32 +0200 |
commit | c2cc74f862df3bbc8bf7c8ecd5909af9de3d95ca (patch) | |
tree | ce28bc9c9995db56eb863fbe3906f690958146c0 | |
parent | c99dfd8f631289d66c5aa1d667073530e9c30860 (diff) |
tst_qfiledialog: use QStandardPaths test mode
Otherwise, when interrupting the test half-way (e.g. in gdb),
the user's ~/.config/QtProject.conf would be modified.
Change-Id: Id582c4a3fbf0acbed460126fccf0d39b3a09758a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index d46d3501f1..b9ca831e0c 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -114,8 +114,8 @@ public: virtual ~tst_QFiledialog(); public slots: + void initTestCase(); void init(); - void cleanup(); private slots: void currentChangedSignal(); @@ -185,28 +185,25 @@ tst_QFiledialog::~tst_QFiledialog() { } +void tst_QFiledialog::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void tst_QFiledialog::init() { - // Save the developers settings so they don't get mad when their sidebar folders are gone. + // clean up the sidebar between each test QSettings settings(QSettings::UserScope, QLatin1String("QtProject")); settings.beginGroup(QLatin1String("Qt")); - userSettings = settings.value(QLatin1String("filedialog")).toByteArray(); settings.remove(QLatin1String("filedialog")); - // populate it with some default settings + // populate the sidebar with some default settings QNonNativeFileDialog fd; #if defined(Q_OS_WINCE) QTest::qWait(1000); #endif } -void tst_QFiledialog::cleanup() -{ - QSettings settings(QSettings::UserScope, QLatin1String("QtProject")); - settings.beginGroup(QLatin1String("Qt")); - settings.setValue(QLatin1String("filedialog"), userSettings); -} - class MyAbstractItemDelegate : public QAbstractItemDelegate { public: |