Instead of listing the user tags (as tried in D21017), the test should not have
access to the user's baloo DB in the first place.
To do so, we use a QTemporaryDir as $HOME for the test process and for
its ioslave children (by setting KDE_FORK_SLAVES=yes).
While at it, drop the no-op removeTestUserData() function.
void createPlaceItem(const QString &text, const QUrl &url, const QString &icon);
void schedulePlaceRemoval(int index);
void cancelPlaceRemoval(int index);
void createPlaceItem(const QString &text, const QUrl &url, const QString &icon);
void schedulePlaceRemoval(int index);
void cancelPlaceRemoval(int index);
- void removeTestUserData();
QMimeData *createMimeData(const QList<int> &indexes) const;
QMimeData *createMimeData(const QList<int> &indexes) const;
+ QTemporaryDir m_tempHomeDir;
};
#define CHECK_PLACES_URLS(urls) \
};
#define CHECK_PLACES_URLS(urls) \
m_tobeRemoved.remove(index);
}
m_tobeRemoved.remove(index);
}
-void PlacesItemModelTest::removeTestUserData()
-{
- // user hardcoded path to avoid removal of any user personal data
- QDir dir(QStringLiteral("/home/renato/.qttest/share/placesitemmodeltest"));
- if (dir.exists()) {
- QVERIFY(dir.removeRecursively());
- }
-}
-
QMimeData *PlacesItemModelTest::createMimeData(const QList<int> &indexes) const
{
QByteArray itemData;
QMimeData *PlacesItemModelTest::createMimeData(const QList<int> &indexes) const
{
QByteArray itemData;
m_tobeRemoved.clear();
delete m_model;
m_model = nullptr;
m_tobeRemoved.clear();
delete m_model;
m_model = nullptr;
}
void PlacesItemModelTest::initTestCase()
{
}
void PlacesItemModelTest::initTestCase()
{
+ QVERIFY(m_tempHomeDir.isValid());
+ QVERIFY(qputenv("HOME", m_tempHomeDir.path().toUtf8()));
+ QVERIFY(qputenv("KDE_FORK_SLAVES", "yes"));
+
QStandardPaths::setTestModeEnabled(true);
QStandardPaths::setTestModeEnabled(true);
- // remove test user data
- removeTestUserData();
const QString fakeHw = QFINDTESTDATA("data/fakecomputer.xml");
QVERIFY(!fakeHw.isEmpty());
const QString fakeHw = QFINDTESTDATA("data/fakecomputer.xml");
QVERIFY(!fakeHw.isEmpty());
{
qDeleteAll(m_interfacesMap);
QFile::remove(bookmarksFile());
{
qDeleteAll(m_interfacesMap);
QFile::remove(bookmarksFile());
-
- // Remove any previous properties file
- removeTestUserData();
}
void PlacesItemModelTest::testModelSort()
}
void PlacesItemModelTest::testModelSort()