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

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

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2023-09-21 18:22:22 -07:00
parent 6e4d9ff74d
commit 610b26b819

View File

@ -3919,13 +3919,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);
@ -3934,11 +3934,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);
@ -3950,7 +3950,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;