Fix tst_qfilesystementry in unity build

Previous setup of the test was failing in minimal static build if built
using  the unity build because of the explicit inclusion of the qtcore
source files. By removing them, it surfaced that QFileSystemEntry
doesn't export all its necessary symbols for testing. So this patch does
that, as well as removing the qtcore sources from the test. It also
makes sense to make the test private.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Icdabe32485b7ce4ed6049bcc24918f531406b4bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Amir Masoud Abdol 2023-03-09 15:09:46 +01:00
parent 2f3f3eb0d4
commit 11ae4b70a1
4 changed files with 27 additions and 25 deletions

View File

@ -303,6 +303,11 @@ bool QFileSystemEntry::isRoot() const
return isRootPath(m_filePath); return isRootPath(m_filePath);
} }
bool QFileSystemEntry::isEmpty() const
{
return m_filePath.isEmpty() && m_nativeFilePath.isEmpty();
}
// private methods // private methods
void QFileSystemEntry::findLastSeparator() const void QFileSystemEntry::findLastSeparator() const

View File

@ -33,36 +33,34 @@ public:
struct FromNativePath{}; struct FromNativePath{};
struct FromInternalPath{}; struct FromInternalPath{};
QFileSystemEntry(); Q_AUTOTEST_EXPORT QFileSystemEntry();
explicit QFileSystemEntry(const QString &filePath); Q_AUTOTEST_EXPORT explicit QFileSystemEntry(const QString &filePath);
QFileSystemEntry(const QString &filePath, FromInternalPath dummy); Q_AUTOTEST_EXPORT QFileSystemEntry(const QString &filePath, FromInternalPath dummy);
QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath dummy); Q_AUTOTEST_EXPORT QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath dummy);
QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath); Q_AUTOTEST_EXPORT QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath);
QString filePath() const; Q_AUTOTEST_EXPORT QString filePath() const;
QString fileName() const; Q_AUTOTEST_EXPORT QString fileName() const;
QString path() const; Q_AUTOTEST_EXPORT QString path() const;
NativePath nativeFilePath() const; Q_AUTOTEST_EXPORT NativePath nativeFilePath() const;
QString baseName() const; Q_AUTOTEST_EXPORT QString baseName() const;
QString completeBaseName() const; Q_AUTOTEST_EXPORT QString completeBaseName() const;
QString suffix() const; Q_AUTOTEST_EXPORT QString suffix() const;
QString completeSuffix() const; Q_AUTOTEST_EXPORT QString completeSuffix() const;
bool isAbsolute() const; Q_AUTOTEST_EXPORT bool isAbsolute() const;
bool isRelative() const; Q_AUTOTEST_EXPORT bool isRelative() const;
bool isClean() const; Q_AUTOTEST_EXPORT bool isClean() const;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
bool isDriveRoot() const; Q_AUTOTEST_EXPORT bool isDriveRoot() const;
static bool isDriveRootPath(const QString &path); static bool isDriveRootPath(const QString &path);
static QString removeUncOrLongPathPrefix(QString path); static QString removeUncOrLongPathPrefix(QString path);
#endif #endif
bool isRoot() const; Q_AUTOTEST_EXPORT bool isRoot() const;
Q_AUTOTEST_EXPORT bool isEmpty() const;
bool isEmpty() const
{
return m_filePath.isEmpty() && m_nativeFilePath.isEmpty();
}
void clear() void clear()
{ {
*this = QFileSystemEntry(); *this = QFileSystemEntry();

View File

@ -42,7 +42,7 @@ if(NOT ANDROID)
add_subdirectory(qdir) add_subdirectory(qdir)
add_subdirectory(qresourceengine) add_subdirectory(qresourceengine)
endif() endif()
if(QT_FEATURE_private_tests OR UNIX) if(QT_FEATURE_private_tests)
add_subdirectory(qfilesystementry) add_subdirectory(qfilesystementry)
endif() endif()
# QTBUG-88508 # QTBUG-88508

View File

@ -7,9 +7,8 @@
qt_internal_add_test(tst_qfilesystementry qt_internal_add_test(tst_qfilesystementry
SOURCES SOURCES
../../../../../src/corelib/io/qfilesystementry.cpp
../../../../../src/corelib/io/qfilesystementry_p.h
tst_qfilesystementry.cpp tst_qfilesystementry.cpp
LIBRARIES LIBRARIES
Qt::CorePrivate Qt::CorePrivate
Qt::TestPrivate
) )