tst_QFile::moveToTrash: avoid QSKIP+FAIL condition

QtTest can't handle a test that does both. This ends up recorded as a
skip in the summary.

Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd1788412a438085b0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2023-09-25 14:21:49 -07:00
parent 9aaf12ebaa
commit ef22527bf5

View File

@ -4018,6 +4018,7 @@ void tst_QFile::moveToTrash()
};
ensureFile(source, create);
if (!QFileInfo::exists(source) && create) return;
/* This test makes assumptions about the file system layout
which might be wrong - moveToTrash may fail if the file lives
@ -4065,6 +4066,7 @@ void tst_QFile::moveToTrash()
// static version
{
ensureFile(source, create);
if (!QFileInfo::exists(source) && create) return;
QString pathInTrash;
const bool success = QFile::moveToTrash(source, &pathInTrash);
QCOMPARE(success, result);