summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 2e4ed2fba1..624ab39188 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -3714,13 +3714,6 @@ void tst_QFile::moveToTrash()
QFETCH(bool, create);
QFETCH(bool, result);
- /* This test makes assumptions about the file system layout
- which might be wrong - moveToTrash may fail if the file lives
- on a file system that is different from the home file system, and
- has no .Trash directory.
- */
- const bool mayFail = QStorageInfo(source) != QStorageInfo(QDir::home());
-
#if defined(Q_OS_WINRT)
QSKIP("WinRT does not have a trash", SkipAll);
#endif
@@ -3749,9 +3742,20 @@ void tst_QFile::moveToTrash()
sourceFile.remove();
}
};
+
+ ensureFile(source, create);
+
+ /* This test makes assumptions about the file system layout
+ which might be wrong - moveToTrash may fail if the file lives
+ on a file system that is different from the home file system, and
+ has no .Trash directory.
+ */
+ const QStorageInfo sourceStorage(source);
+ const bool mayFail = sourceStorage.isValid()
+ && QStorageInfo(source) != QStorageInfo(QDir::home());
+
// non-static version
{
- ensureFile(source, create);
QFile sourceFile(source);
const bool success = sourceFile.moveToTrash();