diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-07 06:16:59 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-07 06:16:59 (GMT) |
commit | cbec6d9481bf8f55834eafac4eca53f85206b240 (patch) | |
tree | 9875b3dd5a87c0274ee0d57f541f836598936f2b /tests/auto/qfiledialog | |
parent | be8b6047ccd43df1127beb4c602c58408ff9b612 (diff) | |
parent | 939623b2bc8e441618ee1a1886cc656880bee62b (diff) | |
download | Qt-cbec6d9481bf8f55834eafac4eca53f85206b240.zip Qt-cbec6d9481bf8f55834eafac4eca53f85206b240.tar.gz Qt-cbec6d9481bf8f55834eafac4eca53f85206b240.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'tests/auto/qfiledialog')
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index b03d459..bade586 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1526,6 +1526,42 @@ private: }; +class sortProxy : public QSortFilterProxyModel +{ +public: + sortProxy(QObject *parent) : QSortFilterProxyModel(parent) + { + } +protected: + virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const + { + QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel()); + const QFileInfo leftInfo(model->fileInfo(left)); + const QFileInfo rightInfo(model->fileInfo(right)); + + if (leftInfo.isDir() == rightInfo.isDir()) + return(leftInfo.filePath().compare(rightInfo.filePath(),Qt::CaseInsensitive) < 0); + else if (leftInfo.isDir()) + return(false); + else + return(true); + } +}; + +class CrashDialog : public QNonNativeFileDialog +{ + Q_OBJECT + +public: + CrashDialog(QWidget *parent, const QString &caption, const +QString &dir, const QString &filter) + : QNonNativeFileDialog(parent, caption, dir, filter) + { + sortProxy *proxyModel = new sortProxy(this); + setProxyModel(proxyModel); + } +}; + void tst_QFiledialog::task227304_proxyOnFileDialog() { QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0); @@ -1537,6 +1573,17 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() QTest::keyClick(edit, Qt::Key_S); QTest::qWait(200); QTest::keyClick(edit->completer()->popup(), Qt::Key_Down); + + CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") ); + dialog->setFileMode(QFileDialog::ExistingFile); + dialog->show(); + + QListView *list = qFindChild<QListView*>(dialog, "listView"); + QTest::qWait(200); + QTest::keyClick(list, Qt::Key_Down); + QTest::keyClick(list, Qt::Key_Return); + QTest::qWait(200); + } void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() |