summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <[email protected]>2015-08-03 23:21:21 +0200
committerAlbert Astals Cid <[email protected]>2015-08-03 23:21:21 +0200
commit66a3273d283cd628f4ad5f0d278399332b3ed9d8 (patch)
treeeedc3dd83dfaf39c871470d301f51419f70ab515
parent7a4a47727a7263f48acb2667d50ac9cacd99ce3d (diff)
Make PlaceTreeModelTest pass
Test was old/bad
-rw-r--r--tests/auto/placetreemodeltest.cpp11
-rw-r--r--tests/auto/testutils.cpp5
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/placetreemodeltest.cpp b/tests/auto/placetreemodeltest.cpp
index 4804015..f693146 100644
--- a/tests/auto/placetreemodeltest.cpp
+++ b/tests/auto/placetreemodeltest.cpp
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// KDE
#include <QDebug>
#include <KStandardDirs>
+#include <QStandardPaths>
#include <qtest.h>
// Local
@@ -96,16 +97,20 @@ void PlaceTreeModelTest::initTestCase()
void PlaceTreeModelTest::init()
{
+ QStandardPaths::setTestModeEnabled(true);
+
TestUtils::purgeUserConfiguration();
- QFile bookmark(KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml"));
+ const QString confDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+ QDir().mkpath(confDir);
+ QFile bookmark(confDir + "/user-places.xbel");
const bool bookmarkOpened = bookmark.open(QIODevice::WriteOnly);
Q_ASSERT(bookmarkOpened);
Q_UNUSED(bookmarkOpened);
QString xml = QString(BOOKMARKS_XML)
- .arg(mUrl1.toLocalFile())
- .arg(mUrl2.toLocalFile())
+ .arg(mUrl1.url())
+ .arg(mUrl2.url())
;
bookmark.write(xml.toUtf8());
diff --git a/tests/auto/testutils.cpp b/tests/auto/testutils.cpp
index d517047..12a5710 100644
--- a/tests/auto/testutils.cpp
+++ b/tests/auto/testutils.cpp
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <KDebug>
#include <KIO/NetAccess>
#include <KStandardDirs>
+#include <QStandardPaths>
QUrl setUpRemoteTestDir(const QString& testFile)
{
@@ -86,8 +87,8 @@ namespace TestUtils
void purgeUserConfiguration()
{
- QString confDir = qgetenv("KDEHOME");
- QVERIFY(confDir.endsWith(".kde-unit-test")); // Better safe than sorry
+ QString confDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+ QVERIFY(confDir.endsWith(".qttest/share")); // Better safe than sorry
if (QFileInfo(confDir).isDir()) {
bool ok = KIO::NetAccess::del(QUrl::fromLocalFile(confDir), 0);
QVERIFY(ok);