diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-08-25 08:30:39 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-08-25 10:33:39 (GMT) |
commit | dba66b94d255c7cd0d3c9d2717f250194e4edac9 (patch) | |
tree | 91bc0c758b70110e65a1dc613eb560a48ac916ae /src | |
parent | 46237ec0e73ce11bb55086a4917c2138ba529c58 (diff) | |
download | Qt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.zip Qt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.tar.gz Qt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.tar.bz2 |
Add unit test for qfilesystementry
Reviewed-by: Joao
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystementry.cpp | 11 | ||||
-rw-r--r-- | src/corelib/io/qfilesystementry_p.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index 3e8b8b2..d3b3225 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -73,7 +73,7 @@ QString QFileSystemEntry::filePath() const return m_filePath; } -QByteArray QFileSystemEntry::nativeFileName() const +QByteArray QFileSystemEntry::nativeFilePath() const { resolveNativeFilePath(); return m_nativeFilePath; @@ -106,7 +106,7 @@ QString QFileSystemEntry::suffix() const if (m_lastDotInFileName == -1) return QString(); - return m_filePath.mid(m_lastSeparator + m_lastDotInFileName + 1); + return m_filePath.mid(m_lastSeparator + m_firstDotInFileName + m_lastDotInFileName + 1); } QString QFileSystemEntry::completeSuffix() const @@ -180,6 +180,11 @@ void QFileSystemEntry::findFileNameSeparators() const m_lastSeparator = lastSeparator; m_firstDotInFileName = firstDotInFileName == -1 ? -1 : firstDotInFileName - lastSeparator; - m_lastDotInFileName = lastDotInFileName == -1 ? -1 : lastDotInFileName - firstDotInFileName - lastSeparator; + if (lastDotInFileName == -1) + m_lastDotInFileName = -1; + else if (firstDotInFileName == lastDotInFileName) + m_lastDotInFileName = 0; + else + m_lastDotInFileName = firstDotInFileName - lastSeparator; } } diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h index 1812b9f..68af24d 100644 --- a/src/corelib/io/qfilesystementry_p.h +++ b/src/corelib/io/qfilesystementry_p.h @@ -60,13 +60,14 @@ QT_BEGIN_NAMESPACE class QFileSystemEntry { +public: QFileSystemEntry(const QString &filePath); QFileSystemEntry(const QByteArray &nativeFilePath); QFileSystemEntry(const QByteArray &nativeFilePath, const QString &filePath); QString filePath() const; QString fileName() const; - QByteArray nativeFileName() const; + QByteArray nativeFilePath() const; QString suffix() const; QString completeSuffix() const; bool isAbsolute() const; |