summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2009-08-11 16:11:30 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 16:22:16 (GMT)
commit53576b4d3c3e7325d01efba6c4da80299492f2db (patch)
tree6089bb66a4a8ce6f4d62378c833604c1574a9729 /tests/auto
parentf36fb8b2b63b3734cc2bd66b329ca4fef1204845 (diff)
downloadQt-53576b4d3c3e7325d01efba6c4da80299492f2db.zip
Qt-53576b4d3c3e7325d01efba6c4da80299492f2db.tar.gz
Qt-53576b4d3c3e7325d01efba6c4da80299492f2db.tar.bz2
QFSFileEngine must set LocalDiskFlag regardless file exists or not
LocalDiskFlag actually means "Local File Engine" and can be effectively used for testing file path for target storage type (local/network/virtual and so on) Merge-request: 1176 Reviewed-by: Joerg Bornemann <joerg.bornemann@trolltech.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index fa2bd6e..306ca49 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -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)
@@ -1024,6 +1027,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)