summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfile
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-05-19 14:02:12 +0200
committerJoão Abecasis <joao@abecasis.name>2009-05-22 14:33:41 +0200
commit3672deb3b35fc0660c58a8ecc741b989dd0bfc8a (patch)
treed883123f0c560e8b0f7632c55dbba6a5d2742ca8 /tests/auto/qfile
parent3580f5b4d002cca714d443054f8cdd6aefca3287 (diff)
Fix auto test
When copying a resource file to the native file system the (read-only) permissions also get copied. On Windows platforms, this was preventing a test file from being deleted. Reviewed-by: Peter Hartmann Reviewed-by: Thiago
Diffstat (limited to 'tests/auto/qfile')
-rw-r--r--tests/auto/qfile/tst_qfile.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 7e28d12273..9ee4d7c1bc 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -215,7 +215,11 @@ void tst_QFile::cleanup()
// This will be executed immediately after each test is run.
// for copyFallback()
- QFile::remove("file-copy-destination.txt");
+ if (QFile::exists("file-copy-destination.txt")) {
+ QFile::setPermissions("file-copy-destination.txt",
+ QFile::ReadOwner | QFile::WriteOwner);
+ QFile::remove("file-copy-destination.txt");
+ }
// for renameFallback()
QFile::remove("file-rename-destination.txt");
@@ -925,6 +929,9 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+ // Need to reset permissions on Windows to be able to delete
+ QVERIFY(QFile::setPermissions("file-copy-destination.txt",
+ QFile::ReadOwner | QFile::WriteOwner));
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.