diff options
author | axis <qt-info@nokia.com> | 2009-04-24 14:03:55 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-27 07:09:01 (GMT) |
commit | e74c8dc65e2feffb9a55d00aee5ca634fba41df8 (patch) | |
tree | 3a131f9235fb6a455793178d8313655e4fd0036e /tests/auto/qfilesystemmodel | |
parent | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (diff) | |
parent | 211bea9838bcc2acd7f54b65468fe1be2d81b1e0 (diff) | |
download | Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.zip Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.gz Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Configure.exe recompiled with MSVC6.
Conflicts:
configure.exe
examples/network/network.pro
src/gui/dialogs/qfiledialog_p.h
src/gui/dialogs/qfilesystemmodel_p.h
src/gui/kernel/qapplication.cpp
tests/auto/_Categories/qmake.txt
tests/auto/qfile/test/test.pro
tests/auto/qfile/tst_qfile.cpp
tests/auto/qlibrary/tst_qlibrary.cpp
tests/auto/qline/tst_qline.cpp
tests/auto/qstyle/tst_qstyle.cpp
tests/auto/qtextstream/tst_qtextstream.cpp
tests/auto/qtranslator/qtranslator.pro
tests/auto/qwaitcondition/tst_qwaitcondition.cpp
translations/qt_ja_JP.ts
Diffstat (limited to 'tests/auto/qfilesystemmodel')
-rw-r--r-- | tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index 6ec782d..963fccc 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -45,6 +45,7 @@ #include <QFileIconProvider> #include "../../shared/util.h" #include <QTime> +#include <QStyle> #include <QtGlobal> #if defined(Q_OS_SYMBIAN) # include <f32file.h> @@ -312,6 +313,33 @@ void tst_QFileSystemModel::readOnly() QVERIFY(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable); } +class CustomFileIconProvider : public QFileIconProvider +{ +public: + CustomFileIconProvider() : QFileIconProvider() { + mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical); + dvd = qApp->style()->standardIcon(QStyle::SP_DriveDVDIcon); + } + + virtual QIcon icon(const QFileInfo &info) const + { + if (info.isDir()) + return mb; + + return QFileIconProvider::icon(info); + } + virtual QIcon icon(IconType type) const + { + if (type == QFileIconProvider::Folder) + return dvd; + + return QFileIconProvider::icon(type); + } +private: + QIcon mb; + QIcon dvd; +}; + void tst_QFileSystemModel::iconProvider() { QVERIFY(model->iconProvider()); @@ -320,6 +348,19 @@ void tst_QFileSystemModel::iconProvider() QCOMPARE(model->iconProvider(), p); model->setIconProvider(0); delete p; + + QFileSystemModel *myModel = new QFileSystemModel(); + myModel->setRootPath(QDir::homePath()); + //Let's wait to populate the model + QTest::qWait(250); + //We change the provider, icons must me updated + CustomFileIconProvider *custom = new CustomFileIconProvider(); + myModel->setIconProvider(custom); + + QPixmap mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(50, 50); + QCOMPARE(myModel->fileIcon(myModel->index(QDir::homePath())).pixmap(50, 50), mb); + delete myModel; + delete custom; } bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir) |