diff options
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r-- | tests/auto/qfilesystemmodel/qfilesystemmodel.pro | 9 | ||||
-rw-r--r-- | tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 47 |
2 files changed, 51 insertions, 5 deletions
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index 89f3541..e9d7272 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -6,4 +6,11 @@ include(../../../../modeltest/modeltest.pri) SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel - +symbian: { + HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h + + # need to deploy something to create the private directory + dummyDeploy.sources = tst_qfilesystemmodel.cpp + dummyDeploy.path = . + DEPLOYMENT += dummyDeploy +} diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index e415b02..c41f1d1 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -48,7 +48,9 @@ #include <QTime> #include <QStyle> #include <QtGlobal> - +#if defined(Q_OS_SYMBIAN) +# include <f32file.h> +#endif //TESTED_CLASS= //TESTED_FILES= @@ -64,6 +66,23 @@ } \ } while(0) +#if defined(Q_OS_SYMBIAN) +static HBufC* qt_QString2HBufCNewL(const QString& aString) +{ + HBufC *buffer; +#ifdef QT_NO_UNICODE + TPtrC8 ptr(reinterpret_cast<const TUint8*>(aString.toLocal8Bit().constData())); + buffer = HBufC8::NewL(ptr.Length()); + buffer->Des().Copy(ptr); +#else + TPtrC16 ptr(reinterpret_cast<const TUint16*>(aString.utf16())); + buffer = HBufC16::NewL(ptr.Length()); + buffer->Des().Copy(ptr); +#endif + return buffer; +} +#endif + class tst_QFileSystemModel : public QObject { Q_OBJECT @@ -123,6 +142,9 @@ protected: private: QFileSystemModel *model; QString flatDirTestPath; +#if defined(Q_OS_SYMBIAN) + RFs rfs; +#endif }; tst_QFileSystemModel::tst_QFileSystemModel() : model(0) @@ -133,10 +155,16 @@ tst_QFileSystemModel::tst_QFileSystemModel() : model(0) qsrand(midnight.secsTo(QTime::currentTime())); // generating unique temporary directory name flatDirTestPath = QDir::temp().path() + '/' + QString("flatdirtest.") + QString::number(qrand()); +#if defined(Q_OS_SYMBIAN) + rfs.Connect(); +#endif } tst_QFileSystemModel::~tst_QFileSystemModel() { +#if defined(Q_OS_SYMBIAN) + rfs.Close(); +#endif QString tmp = flatDirTestPath; QDir dir(tmp); if (dir.exists() && !dir.rmdir(tmp)) @@ -176,7 +204,7 @@ void tst_QFileSystemModel::cleanup() void tst_QFileSystemModel::indexPath() { -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) int depth = QDir::currentPath().count('/'); model->setRootPath(QDir::currentPath()); QTest::qWait(WAITTIME); @@ -378,6 +406,12 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (initial_files.at(i)[0] == '.') QProcess::execute(QString("attrib +h %1").arg(file.fileName())); +#elif defined(Q_OS_SYMBIAN) + if (initial_files.at(i)[0] == '.') { + HBufC* buffer = qt_QString2HBufCNewL(QDir::toNativeSeparators(file.fileName())); + rfs.SetAtt(*buffer, KEntryAttHidden, 0); + delete buffer; + } #endif //qDebug() << test_path + '/' + initial_files.at(i) << (QFile::exists(test_path + '/' + initial_files.at(i))); } @@ -566,7 +600,7 @@ void tst_QFileSystemModel::filters_data() QTest::addColumn<int>("dirFilters"); QTest::addColumn<QStringList>("nameFilters"); QTest::addColumn<int>("rowCount"); -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2; QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1; QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 3; @@ -591,7 +625,12 @@ void tst_QFileSystemModel::filters_data() QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 0; QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 3; +#if defined(Q_OS_SYMBIAN) + // Some symbian envs have a bug that causes "A" and ".A" to be considered same name in file system. + QTest::newRow("dir+file+hid-dot .D") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".D") << +#else QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") << +#endif (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4; QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") << (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2; @@ -908,7 +947,7 @@ void tst_QFileSystemModel::dirsBeforeFiles() #endif } } - + QTEST_MAIN(tst_QFileSystemModel) #include "tst_qfilesystemmodel.moc" |