diff options
author | Liang QI <liang.qi@nokia.com> | 2009-10-14 12:56:41 (GMT) |
---|---|---|
committer | Liang QI <liang.qi@nokia.com> | 2009-10-14 12:56:41 (GMT) |
commit | d5f794c5c0552e651e3ca558eeb311c96d41860f (patch) | |
tree | 212e10b200dbcffe76db4127df7a5814818385cf /tests/auto/qsidebar | |
parent | 8a208c7043222c6fd7282ed9ca4bf3cd9ea7205c (diff) | |
download | Qt-d5f794c5c0552e651e3ca558eeb311c96d41860f.zip Qt-d5f794c5c0552e651e3ca558eeb311c96d41860f.tar.gz Qt-d5f794c5c0552e651e3ca558eeb311c96d41860f.tar.bz2 |
Fix tst_QSidebar::addUrls() on Symbian.
On Symbian, QDir::rootPath() and QDir::home() are same.
RevBy: Janne Anttila
Diffstat (limited to 'tests/auto/qsidebar')
-rw-r--r-- | tests/auto/qsidebar/tst_qsidebar.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp index 7b157f6..b810305 100644 --- a/tests/auto/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/qsidebar/tst_qsidebar.cpp @@ -122,6 +122,12 @@ void tst_QSidebar::addUrls() QSidebar qsidebar; qsidebar.init(&fsmodel, emptyUrls); QAbstractItemModel *model = qsidebar.model(); +#if defined(Q_OS_SYMBIAN) + // On Symbian, QDir::rootPath() and QDir::home() are same. + QDir testDir = QDir::currentPath(); +#else + QDir testDir = QDir::home(); +#endif // default QCOMPARE(model->rowCount(), 0); @@ -146,13 +152,13 @@ void tst_QSidebar::addUrls() // test inserting with already existing rows QList<QUrl> moreUrls; - moreUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + moreUrls << QUrl::fromLocalFile(testDir.absolutePath()); qsidebar.addUrls(moreUrls, -1); QCOMPARE(model->rowCount(), 3); // make sure invalid urls are still added QList<QUrl> badUrls; - badUrls << QUrl::fromLocalFile(QDir::home().absolutePath() + "/I used to exist"); + badUrls << QUrl::fromLocalFile(testDir.absolutePath() + "/I used to exist"); qsidebar.addUrls(badUrls, 0); QCOMPARE(model->rowCount(), 4); @@ -179,30 +185,30 @@ void tst_QSidebar::addUrls() QList<QUrl> doubleUrls; //tow exact same paths, we have only one entry - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 1); // Two paths that are effectively pointing to the same location - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath() + "/."); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.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()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.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()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath().toUpper()); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 2); |