#include "panels/places/placesitemmodel.h"
#include "panels/places/placesitem.h"
#include "views/viewproperties.h"
#include "panels/places/placesitemmodel.h"
#include "panels/places/placesitem.h"
#include "views/viewproperties.h"
static QString bookmarksFile()
{
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/user-places.xbel";
static QString bookmarksFile()
{
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/user-places.xbel";
PlacesItemModel* m_model;
QSet<int> m_tobeRemoved;
QMap<QString, QDBusInterface *> m_interfacesMap;
PlacesItemModel* m_model;
QSet<int> m_tobeRemoved;
QMap<QString, QDBusInterface *> m_interfacesMap;
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);
<< QStringLiteral("remote:/")
<< QStringLiteral("/media/nfs")
<< QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday")
<< QStringLiteral("remote:/")
<< QStringLiteral("/media/nfs")
<< QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday")
-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());
- }
-}
-
if (QDir(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).exists()) {
m_hasDownloadsFolder = true;
m_expectedModelCount++;
if (QDir(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).exists()) {
m_hasDownloadsFolder = true;
m_expectedModelCount++;
QCOMPARE(groups.at(0).first, 0);
QCOMPARE(groups.at(0).second.toString(), QStringLiteral("Places"));
QCOMPARE(groups.at(0).first, 0);
QCOMPARE(groups.at(0).second.toString(), QStringLiteral("Places"));
QFETCH(bool, expectedPreviewShow);
QFETCH(QList<QByteArray>, expectedVisibleRole);
QFETCH(bool, expectedPreviewShow);
QFETCH(QList<QByteArray>, expectedVisibleRole);
ViewProperties properties(KFilePlacesModel::convertedUrl(url));
QCOMPARE(properties.viewMode(), expectedViewMode);
QCOMPARE(properties.previewsShown(), expectedPreviewShow);
QCOMPARE(properties.visibleRoles(), expectedVisibleRole);
ViewProperties properties(KFilePlacesModel::convertedUrl(url));
QCOMPARE(properties.viewMode(), expectedViewMode);
QCOMPARE(properties.previewsShown(), expectedPreviewShow);
QCOMPARE(properties.visibleRoles(), expectedVisibleRole);
createPlaceItem(QStringLiteral("Temporary Dir"), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)), QString());
// make sure that the new item will be removed later
createPlaceItem(QStringLiteral("Temporary Dir"), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)), QString());
// make sure that the new item will be removed later
QTRY_COMPARE(model->count(), m_model->count());
// make sure that the new item will be removed later
QTRY_COMPARE(model->count(), m_model->count());
// make sure that the new item will be removed later
QTRY_COMPARE(model->count(), m_model->count());
// make sure that the new item will be removed later
QTRY_COMPARE(model->count(), m_model->count());
// make sure that the new item will be removed later
QSignalSpy itemsInsertedSpy(m_model, &PlacesItemModel::itemsInserted);
QSignalSpy itemsRemovedSpy(m_model, &PlacesItemModel::itemsRemoved);
QSignalSpy itemsInsertedSpy(m_model, &PlacesItemModel::itemsInserted);
QSignalSpy itemsRemovedSpy(m_model, &PlacesItemModel::itemsRemoved);