tests: Fix tst_qtemporaryfile to use temporary file

Create a temporary file instead of trying to use a file from source
directory because that's not available when test was installed via
packaging.

Task-number: QTBUG-118680
Change-Id: Ic152d68c79ac467c0d149cab04ab224c3b64099f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ari Parkkila 2024-05-23 11:06:36 +03:00
parent e9b79c0c74
commit 41b0277924

View File

@ -592,7 +592,9 @@ void tst_QTemporaryFile::rename()
void tst_QTemporaryFile::renameFdLeak() void tst_QTemporaryFile::renameFdLeak()
{ {
#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) #if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID)
const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA("CMakeLists.txt")); QTemporaryFile file;
QVERIFY(file.open());
const QByteArray sourceFile = QFile::encodeName(file.fileName());
QVERIFY(!sourceFile.isEmpty()); QVERIFY(!sourceFile.isEmpty());
// Test this on Unix only // Test this on Unix only