summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporaryfile
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-09 14:25:26 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-10 07:07:30 +0200
commit72024fd50cdead8d890886dba32fd81ac54ff3ae (patch)
tree15a8e2183babb6ba22938622fa1c4300ee054599 /tests/auto/corelib/io/qtemporaryfile
parent745448d3eaa178ff1b7b75bdd577ad31e9177cd6 (diff)
Reduce repetitive invocations of QFINDTESTDATA.
Store the file names in variables instead. Task-number: QTBUG-38890 Change-Id: I65f28bb62674f14aa099e935a9d7a4e9e6e90ba9 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/corelib/io/qtemporaryfile')
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index edf4dd2f00..74220d7f97 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -446,13 +446,15 @@ void tst_QTemporaryFile::rename()
void tst_QTemporaryFile::renameFdLeak()
{
#ifdef Q_OS_UNIX
+ const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__));
+ QVERIFY(!sourceFile.isEmpty());
// Test this on Unix only
// Open a bunch of files to force the fd count to go up
static const int count = 10;
int bunch_of_files[count];
for (int i = 0; i < count; ++i) {
- bunch_of_files[i] = ::open(qPrintable(QFINDTESTDATA("tst_qtemporaryfile.cpp")), O_RDONLY);
+ bunch_of_files[i] = ::open(sourceFile.constData(), O_RDONLY);
QVERIFY(bunch_of_files[i] != -1);
}
@@ -647,8 +649,10 @@ void tst_QTemporaryFile::createNativeFile_data()
QTest::addColumn<bool>("valid");
QTest::addColumn<QByteArray>("content");
- QTest::newRow("nativeFile") << QFINDTESTDATA("resources/test.txt") << (qint64)-1 << false << QByteArray();
- QTest::newRow("nativeFileWithPos") << QFINDTESTDATA("resources/test.txt") << (qint64)5 << false << QByteArray();
+ const QString nativeFilePath = QFINDTESTDATA("resources/test.txt");
+
+ QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray();
+ QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray();
QTest::newRow("resourceFile") << ":/resources/test.txt" << (qint64)-1 << true << QByteArray("This is a test");
QTest::newRow("resourceFileWithPos") << ":/resources/test.txt" << (qint64)5 << true << QByteArray("This is a test");
}