diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-10 10:32:26 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-10 10:32:26 (GMT) |
commit | fdf5fd0cc63c20579250087905331eb76385d528 (patch) | |
tree | 34719d275d42131cb92e9e86b3385dc9ce021338 /tests/auto | |
parent | f9128d973f60e225045bebb97a19d292395b865d (diff) | |
download | Qt-fdf5fd0cc63c20579250087905331eb76385d528.zip Qt-fdf5fd0cc63c20579250087905331eb76385d528.tar.gz Qt-fdf5fd0cc63c20579250087905331eb76385d528.tar.bz2 |
QFileDialog: the side urls are now always cleaned when they are local
Task-number: 257579
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 8bb81e7..50cab0e 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -160,6 +160,7 @@ private slots: void task251321_sideBarHiddenEntries(); void task251341_sideBarRemoveEntries(); void task254490_selectFileMultipleTimes(); + void task257579_sideBarWithNonCleanUrls(); private: QByteArray userSettings; @@ -2026,5 +2027,25 @@ void tst_QFiledialog::task254490_selectFileMultipleTimes() t->deleteLater(); } +void tst_QFiledialog::task257579_sideBarWithNonCleanUrls() +{ + QDir tempDir = QDir::temp(); + QLatin1String dirname("autotest_task257579"); + tempDir.rmdir(dirname); //makes sure it doesn't exist any more + QVERIFY(tempDir.mkdir(dirname)); + QString url = QString::fromLatin1("%1/%2/..").arg(tempDir.absolutePath()).arg(dirname); + QNonNativeFileDialog fd; + fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url)); + QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar"); + QCOMPARE(sidebar->urls().count(), 1); + QVERIFY(sidebar->urls().first().toLocalFile() != url); + QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url)); + QCOMPARE(sidebar->model()->index(0,0).data().toString(), tempDir.dirName()); + + //all tests are finished, we can remove the temporary dir + QVERIFY(tempDir.rmdir(dirname)); +} + + QTEST_MAIN(tst_QFiledialog) #include "tst_qfiledialog.moc" |