diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-22 07:30:00 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-22 07:33:38 (GMT) |
commit | 9792ddf1e5d3f5e6713765b53ea031fa4e6eff4e (patch) | |
tree | 377258e0cb0d36fbf83890577ce7e78f15a7cf50 /tests/auto/qsidebar | |
parent | e5fa2cf55c8370ca58f82ba1ef37a54649bd42c8 (diff) | |
download | Qt-9792ddf1e5d3f5e6713765b53ea031fa4e6eff4e.zip Qt-9792ddf1e5d3f5e6713765b53ea031fa4e6eff4e.tar.gz Qt-9792ddf1e5d3f5e6713765b53ea031fa4e6eff4e.tar.bz2 |
Fix double entries in the sidebar of QFileDialog
The problem is QUrl == operator is case sensitive. On Windows we don't
want double entries for C:\dev or c:\dev so i convert the url in lower
case and compare them (on Windows only) to avoid duplicate entries.
Task-number:226483
Reviewed-by:jasplin
Diffstat (limited to 'tests/auto/qsidebar')
-rw-r--r-- | tests/auto/qsidebar/tst_qsidebar.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp index 7a262e6..705e222 100644 --- a/tests/auto/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/qsidebar/tst_qsidebar.cpp @@ -176,6 +176,32 @@ void tst_QSidebar::addUrls() qsidebar.addUrls(urls, -1); qsidebar.addUrls(moreUrls, -1); QCOMPARE(qsidebar.urls()[0], urls[0]); + + QList<QUrl> doubleUrls; + //tow exact same paths, we have only one entry + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + qsidebar.setUrls(emptyUrls); + qsidebar.addUrls(doubleUrls, 1); + QCOMPARE(qsidebar.urls().size(), 1); + +#if defined(Q_OS_WIN) + //Windows is case insensitive so no duplicate entries in that case + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper()); + qsidebar.setUrls(emptyUrls); + qsidebar.addUrls(doubleUrls, 1); + QCOMPARE(qsidebar.urls().size(), 1); +#else + //Two different paths we should have two entries + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper()); + qsidebar.setUrls(emptyUrls); + qsidebar.addUrls(doubleUrls, 1); + QCOMPARE(qsidebar.urls().size(), 2); +#endif + + } void tst_QSidebar::goToUrl() |