From 3672deb3b35fc0660c58a8ecc741b989dd0bfc8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 19 May 2009 14:02:12 +0200 Subject: [PATCH] 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 --- tests/auto/qfile/tst_qfile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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. -- 2.11.4.GIT