diff options
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r-- | tests/auto/qfilesystemmodel/qfilesystemmodel.pro | 12 | ||||
-rw-r--r-- | tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 49 |
2 files changed, 54 insertions, 7 deletions
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index 89f3541..eac16ee 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -1,9 +1,15 @@ CONFIG += qttest_p4 -include(../../src/qfiledialog.pri) -include(../../../../modeltest/modeltest.pri) +QT = core gui -SOURCES += tst_qfilesystemmodel.cpp +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 3a8a952..0100e93 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); @@ -254,6 +282,7 @@ void tst_QFileSystemModel::naturalCompare_data() void tst_QFileSystemModel::naturalCompare() { +#ifdef QT_BUILD_INTERNAL QFETCH(QString, s1); QFETCH(QString, s2); QFETCH(int, caseSensitive); @@ -271,6 +300,7 @@ void tst_QFileSystemModel::naturalCompare() // created. The scheduler takes its time to recognize ended threads. QTest::qWait(300); #endif +#endif } void tst_QFileSystemModel::readOnly() @@ -378,6 +408,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 +602,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 +627,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 +949,7 @@ void tst_QFileSystemModel::dirsBeforeFiles() #endif } } - + QTEST_MAIN(tst_QFileSystemModel) #include "tst_qfilesystemmodel.moc" |