qt5base-lts/tests/auto/corelib
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
..
animation QSequentialAnimationGroup: extend bindable property unit tests 2023-09-03 18:20:21 +02:00
global Long live Q_(U)INT128_C()! 2023-09-14 18:39:24 +02:00
io QFile::moveToTrash: fix error reporting on Windows 2023-09-24 14:10:56 -07:00
ipc IPC: Move the legacy key to the QNativeIpcKey 2023-09-17 18:10:18 -07:00
itemmodels QItemSelectionModel: don't warn when destroying the model 2023-09-22 01:42:45 +02:00
kernel QPointer: also provide a converting assignment operator 2023-09-23 22:10:10 +00:00
mimetypes QMimeType: simplify implementation of filterString 2023-09-13 23:27:44 +02:00
platform CMake: Make corelib tests standalone projects 2023-07-05 15:09:32 +02:00
plugin QUuid: convert bswap(Id128Bytes) to a hidden friend of Id128Bytes 2023-08-18 18:00:09 +02:00
serialization Fix renamed and duplicated namespaces in QXmlStreamWriter 2023-09-20 17:16:29 +02:00
text tst_QStringBuilder: update the warning re:includes in stringbuilder.cpp 2023-09-20 17:16:28 +02:00
thread QtFuture: Prevent whenAll()/whenAny() from creating reference cycles 2023-09-15 13:36:15 +00:00
time Warn on failure to construct valid system time zone object 2023-09-15 21:53:36 +02:00
tools QCommandLineParser: Warn invalid value calls 2023-09-21 22:05:06 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00