tst_QFile::moveToTrash: include the test name in the tempfile templates

Makes it easier to locate later which test may be leaking stuff.

Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 610b26b819c7963dfeebf3e073562a51554acc9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2023-09-21 18:22:22 -07:00 committed by Qt Cherry-pick Bot
parent f7bead1dd6
commit f4bcf9f5af

View File

@ -3845,13 +3845,13 @@ void tst_QFile::moveToTrash_data()
// success cases
{
QTemporaryFile temp;
QTemporaryFile temp("tst_qfile-moveToTrash-XXXXX");
if (!temp.open())
QSKIP("Failed to create temporary file!");
QTest::newRow("temporary file") << temp.fileName() << true << true;
}
{
QTemporaryDir tempDir;
QTemporaryDir tempDir("tst_qfile-moveToTrash-XXXXX");
if (!tempDir.isValid())
QSKIP("Failed to create temporary directory!");
tempDir.setAutoRemove(false);
@ -3860,11 +3860,11 @@ void tst_QFile::moveToTrash_data()
<< true << true;
}
{
QTemporaryDir homeDir(QDir::homePath() + QLatin1String("/XXXXXX"));
QTemporaryDir homeDir(QDir::homePath() + QLatin1String("/tst_qfile.moveToTrash-XXXXXX"));
if (!homeDir.isValid())
QSKIP("Failed to create temporary directory in $HOME!");
QTemporaryFile homeFile(homeDir.path()
+ QLatin1String("/tst_qfile-XXXXXX"));
+ QLatin1String("/tst_qfile-moveToTrash-XXXXX"));
if (!homeFile.open())
QSKIP("Failed to create temporary file in $HOME");
homeDir.setAutoRemove(false);
@ -3876,7 +3876,7 @@ void tst_QFile::moveToTrash_data()
<< homeDir.path() + QLatin1Char('/')
<< true << true;
}
QTest::newRow("relative") << QStringLiteral("tst_qfile_moveToTrash.tmp") << true << true;
QTest::newRow("relative") << QStringLiteral("tst_qfile-moveToTrash.tmp") << true << true;
// failure cases
QTest::newRow("root") << QDir::rootPath() << false << false;