summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-08-25 08:30:39 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-08-25 10:33:39 (GMT)
commitdba66b94d255c7cd0d3c9d2717f250194e4edac9 (patch)
tree91bc0c758b70110e65a1dc613eb560a48ac916ae /src/corelib
parent46237ec0e73ce11bb55086a4917c2138ba529c58 (diff)
downloadQt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.zip
Qt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.tar.gz
Qt-dba66b94d255c7cd0d3c9d2717f250194e4edac9.tar.bz2
Add unit test for qfilesystementry
Reviewed-by: Joao
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfilesystementry.cpp11
-rw-r--r--src/corelib/io/qfilesystementry_p.h3
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;