From 8fa7b42ab1bca55683d20aae6b390d4b954b4f93 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 25 Sep 2023 14:32:51 -0700 Subject: [PATCH] tst_QFile::moveToTrash: use QDir::tempPath() for the rows w/ "temporary" Both QTemporaryFile and QTemporaryDir are documented to use the current directory if given a pattern. That can be anything & arbitrary, so it doesn't give us consistency in checking. Moreover, it might be a read- only directory. Drive-by fix the number of 'X'. Task-number: QTBUG-117449 Change-Id: Ifeb6206a9fa04424964bfffd178841c44e9636a0 Reviewed-by: Ahmad Samir (cherry picked from commit a40341366f8e5b50dc62ef21fb47ba18deb38c2e) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 4f182e1bdb6..b48eba8bc97 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -3847,13 +3847,13 @@ void tst_QFile::moveToTrash_data() // success cases { - QTemporaryFile temp("tst_qfile-moveToTrash-XXXXX"); + QTemporaryFile temp(QDir::tempPath() + "/tst_qfile-moveToTrash-XXXXXX"); if (!temp.open()) QSKIP("Failed to create temporary file!"); QTest::newRow("temporary file") << temp.fileName() << true << true; } { - QTemporaryDir tempDir("tst_qfile-moveToTrash-XXXXX"); + QTemporaryDir tempDir(QDir::tempPath() + "/tst_qfile-moveToTrash-XXXXXX"); if (!tempDir.isValid()) QSKIP("Failed to create temporary directory!"); tempDir.setAutoRemove(false);