summaryrefslogtreecommitdiff
path: root/tests/auto/qfileinfo
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-13 09:24:47 +0200
committerJason Barron <jbarron@trolltech.com>2009-08-13 10:27:51 +0200
commit13cbcc0ddca0fdd5be9ede09052d31785c1e4d55 (patch)
treeb647be5699145ccae1545096aba5c495d96f8eb5 /tests/auto/qfileinfo
parent081078137a6fbc85d6be1437f6afc1d60e4f75f9 (diff)
parentde088b5a7f7b57e568399334667b14bfc9e7b893 (diff)
downloadqt4-tools-13cbcc0ddca0fdd5be9ede09052d31785c1e4d55.tar.gz
Merge commit 'qt/master'
Conflicts: examples/opengl/samplebuffers/glwidget.cpp src/corelib/io/qfsfileengine_unix.cpp src/corelib/kernel/qobject.cpp src/corelib/tools/qsharedpointer.cpp src/gui/gui.pro tests/auto/qhttp/tst_qhttp.cpp tests/auto/qkeyevent/tst_qkeyevent.cpp
Diffstat (limited to 'tests/auto/qfileinfo')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 078ea07fea..c53c86c7c1 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
+** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -147,6 +147,9 @@ private slots:
void isBundle_data();
void isBundle();
+ void isLocalFs_data();
+ void isLocalFs();
+
void refresh();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
@@ -997,6 +1000,22 @@ void tst_QFileInfo::isHidden_data()
foreach (const QFileInfo& info, QDir::drives()) {
QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false;
}
+
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ QTest::newRow("C:/RECYCLER") << QString::fromLatin1("C:/RECYCLER") << true;
+ QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << false;
+ QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << false;
+#endif
+#if defined(Q_OS_UNIX)
+ QTest::newRow("~/.qt") << QDir::homePath() + QString("/.qt") << true;
+ QTest::newRow("~/.qt/.") << QDir::homePath() + QString("/.qt/.") << false;
+ QTest::newRow("~/.qt/..") << QDir::homePath() + QString("/.qt/..") << false;
+#endif
+
+#if !defined(Q_OS_WIN)
+ QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << false;
+#endif
+
#ifdef Q_OS_MAC
QTest::newRow("mac_etc") << QString::fromLatin1("/etc") << true;
QTest::newRow("mac_private_etc") << QString::fromLatin1("/private/etc") << false;
@@ -1031,6 +1050,29 @@ void tst_QFileInfo::isBundle()
QCOMPARE(fi.isBundle(), isBundle);
}
+void tst_QFileInfo::isLocalFs_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("isLocalFs");
+
+ QTest::newRow("local root") << QString::fromLatin1("/") << true;
+ QTest::newRow("local non-existent file") << QString::fromLatin1("/abrakadabra.boo") << true;
+
+ QTest::newRow("qresource root") << QString::fromLatin1(":/") << false;
+}
+
+void tst_QFileInfo::isLocalFs()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, isLocalFs);
+
+ QFileInfo info(path);
+ QFileInfoPrivate *privateInfo = getPrivate(info);
+ QVERIFY(privateInfo->data->fileEngine);
+ QCOMPARE(bool(privateInfo->data->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag)
+ & QAbstractFileEngine::LocalDiskFlag), isLocalFs);
+}
+
void tst_QFileInfo::refresh()
{
#if defined(Q_OS_WINCE)