diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-20 16:49:21 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-21 08:21:23 (GMT) |
commit | 292a37301950a64f211e3a2909ff64884b73e1cc (patch) | |
tree | cf21b0824ffc294b5ddefd5bb4dab55add5f936b /tests/auto/qfiledialog | |
parent | 7d572f0b4adf33db00352d8183b1e934cee85c39 (diff) | |
download | Qt-292a37301950a64f211e3a2909ff64884b73e1cc.zip Qt-292a37301950a64f211e3a2909ff64884b73e1cc.tar.gz Qt-292a37301950a64f211e3a2909ff64884b73e1cc.tar.bz2 |
Fix a bug in QFileDialog sidebar when the bookmark has an hidden parent
If the bookmark in the sidebar has an hidden parent and the QFileDialog
is set up to not show hidden files, then clicking on the bookmark move
the current dir to root (like if the bookmark was invalid) instead of
entering in the dir. The fix was to fetch the parent dir and the
bookmark dir when the user select it in the sidebar.
Task-number: 251321
Reviewed-by: jasplin
Diffstat (limited to 'tests/auto/qfiledialog')
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 695bfe7..981d445 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -157,6 +157,7 @@ private slots: void task228844_ensurePreviousSorting(); void task239706_editableFilterCombo(); void task218353_relativePaths(); + void task251321_sideBarHiddenEntries(); private: QByteArray userSettings; @@ -1852,5 +1853,38 @@ void tst_QFiledialog::task218353_relativePaths() appDir.rmdir("test"); } +void tst_QFiledialog::task251321_sideBarHiddenEntries() +{ + QNonNativeFileDialog fd; + + QDir current = QDir::currentPath(); + current.mkdir(".hidden"); + QDir hiddenDir = QDir(".hidden"); + hiddenDir.mkdir("subdir"); + QDir hiddenSubDir = QDir(".hidden/subdir"); + hiddenSubDir.mkdir("happy"); + hiddenSubDir.mkdir("happy2"); + + QList<QUrl> urls; + urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath()); + fd.setSidebarUrls(urls); + fd.show(); + QTest::qWait(250); + + QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar"); + sidebar->setFocus(); + sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath())); + QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center()); + QTest::qWait(250); + + QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model"); + QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2); + + hiddenSubDir.rmdir("happy2"); + hiddenSubDir.rmdir("happy"); + hiddenDir.rmdir("subdir"); + current.rmdir(".hidden"); +} + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" |