From a01146aac104b05dcf5c7ddbe7b79a897e8bf414 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Tue, 19 Jan 2016 14:22:28 +0100 Subject: Use QFileInfo::exists(f) instead of QFileInfo(f).exists() QFileInfo::exists(f) is somewhat faster than the version which creates an temporary object. Change-Id: I5f931a86d9dfad57d99efe04ca115422de43def9 Reviewed-by: Thiago Macieira --- src/testlib/qtestcase.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 286da52be2..36eff6ac98 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -3219,7 +3219,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co QString testsPath = QLibraryInfo::location(QLibraryInfo::TestsPath); QString candidate = QString::fromLatin1("%1/%2/%3") .arg(testsPath, QFile::decodeName(testObjectName).toLower(), base); - if (QFileInfo(candidate).exists()) { + if (QFileInfo::exists(candidate)) { found = candidate; } else if (QTestLog::verboseLevel() >= 2) { @@ -3244,7 +3244,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co } QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath(), base); - if (QFileInfo(candidate).exists()) { + if (QFileInfo::exists(candidate)) { found = candidate; } else if (QTestLog::verboseLevel() >= 2) { @@ -3258,21 +3258,21 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co // 4. Try resources if (found.isEmpty()) { QString candidate = QString::fromLatin1(":/%1").arg(base); - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } // 5. Try current directory if (found.isEmpty()) { QString candidate = QString::fromLatin1("%1/%2").arg(QDir::currentPath()).arg(base); - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } // 6. Try main source directory if (found.isEmpty()) { QString candidate = QTest::mainSourcePath % QLatin1Char('/') % base; - if (QFileInfo(candidate).exists()) + if (QFileInfo::exists(candidate)) found = candidate; } -- cgit v1.2.3