qt5base-lts/tests/auto/corelib/io
Volker Hilsheimer 6ca2008d6e QFile::moveToTrash: fix error reporting on Windows
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.

MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.

If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.

Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.

Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-24 14:10:56 -07:00
..
largefile CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qabstractfileengine tst_QAbstractFileEngine: compile with QT_NO_FOREACH 2023-08-19 16:28:33 +03:00
qbuffer CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qdataurl CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qdebug cmake: Enable Objective-C++ language for standalone test projects 2023-08-01 20:42:30 +02:00
qdir tst_QDir: compile with QT_NO_FOREACH 2023-08-19 16:28:53 +03:00
qdiriterator tst_QDirIterator: build with QT_NO_FOREACH 2023-08-19 16:29:03 +03:00
qfile QFile::moveToTrash: fix error reporting on Windows 2023-09-24 14:10:56 -07:00
qfileinfo tst_QFileInfo: don't trigger libstdc++ std::filesystem bug 2023-09-01 13:05:45 -07:00
qfileselector tests/auto/*: port Q_FOREACH to ranged-for 2023-08-19 16:29:09 +03:00
qfilesystementry CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qfilesystemmetadata CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qfilesystemwatcher tests/auto/: port Q_FOREACH to ranged-for, local const containers 2023-08-19 16:29:25 +03:00
qiodevice CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qipaddress CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qlockfile Mark all of Qt as free of Q_FOREACH, except where it isn't 2023-08-19 05:19:42 +00:00
qloggingcategory CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qloggingregistry CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qnodebug CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qprocess QProcess: remove a XFAIL for QNX 2023-09-08 19:00:49 +02:00
qprocess-noapplication CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qprocessenvironment CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qresourceengine CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qsavefile Fix undeclared identifier 'geteuid' for VxWorks 2023-09-12 02:07:04 +00:00
qsettings Main thread-proxy localStorage oprations in native WASM QSettings 2023-08-28 17:53:29 +02:00
qstandardpaths Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstorageinfo tst_QStorageInfo: compile with QT_NO_FOREACH 2023-08-19 16:29:40 +03:00
qtemporarydir tst_QTemporaryDir/File: compile with QT_NO_FOREACH 2023-08-19 16:29:47 +03:00
qtemporaryfile QFile::moveToTrash: fix error reporting on Windows 2023-09-24 14:10:56 -07:00
qurl CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qurlinternal CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qurlquery CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qurluts46 CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
qzip CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
CMakeLists.txt Move QZipReader/Writer from QtGui to QtCore 2023-04-26 12:01:05 +02:00