Changeset View
Changeset View
Standalone View
Standalone View
src/tests/placesitemmodeltest.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 49 | private slots: | |||
---|---|---|---|---|---|
74 | void testHideDevices(); | 74 | void testHideDevices(); | ||
75 | void testDuplicatedEntries(); | 75 | void testDuplicatedEntries(); | ||
76 | void renameAfterCreation(); | 76 | void renameAfterCreation(); | ||
77 | 77 | | |||
78 | private: | 78 | private: | ||
79 | PlacesItemModel* m_model; | 79 | PlacesItemModel* m_model; | ||
80 | QSet<int> m_tobeRemoved; | 80 | QSet<int> m_tobeRemoved; | ||
81 | QMap<QString, QDBusInterface *> m_interfacesMap; | 81 | QMap<QString, QDBusInterface *> m_interfacesMap; | ||
82 | int m_expectedModelCount = 14; | 82 | int m_expectedModelCount = 15; | ||
83 | bool m_hasDesktopFolder = false; | 83 | bool m_hasDesktopFolder = false; | ||
84 | bool m_hasDocumentsFolder = false; | 84 | bool m_hasDocumentsFolder = false; | ||
85 | bool m_hasDownloadsFolder = false; | 85 | bool m_hasDownloadsFolder = false; | ||
86 | 86 | | |||
87 | void setBalooEnabled(bool enabled); | 87 | void setBalooEnabled(bool enabled); | ||
88 | int indexOf(const QUrl &url); | 88 | int indexOf(const QUrl &url); | ||
89 | QDBusInterface *fakeManager(); | 89 | QDBusInterface *fakeManager(); | ||
90 | QDBusInterface *fakeDevice(const QString &udi); | 90 | QDBusInterface *fakeDevice(const QString &udi); | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 161 | if (urls.isEmpty()) { | |||
171 | 171 | | |||
172 | if (m_hasDownloadsFolder) { | 172 | if (m_hasDownloadsFolder) { | ||
173 | urls << QDir::homePath() + QStringLiteral("/Downloads"); | 173 | urls << QDir::homePath() + QStringLiteral("/Downloads"); | ||
174 | } | 174 | } | ||
175 | 175 | | |||
176 | urls << QStringLiteral("trash:/") | 176 | urls << QStringLiteral("trash:/") | ||
177 | << QStringLiteral("remote:/") | 177 | << QStringLiteral("remote:/") | ||
178 | << QStringLiteral("/media/nfs") | 178 | << QStringLiteral("/media/nfs") | ||
179 | << QStringLiteral("recentlyused:/") | ||||
179 | << QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday") | 180 | << QStringLiteral("timeline:/today") << QStringLiteral("timeline:/yesterday") | ||
180 | << QStringLiteral("search:/documents") << QStringLiteral("search:/images") << QStringLiteral("search:/audio") << QStringLiteral("search:/videos") | 181 | << QStringLiteral("search:/documents") << QStringLiteral("search:/images") << QStringLiteral("search:/audio") << QStringLiteral("search:/videos") | ||
181 | << QStringLiteral("/foreign") | 182 | << QStringLiteral("/foreign") | ||
182 | << QStringLiteral("/media/floppy0") << QStringLiteral("/media/XO-Y4") << QStringLiteral("/media/cdrom"); | 183 | << QStringLiteral("/media/floppy0") << QStringLiteral("/media/XO-Y4") << QStringLiteral("/media/cdrom"); | ||
183 | } | 184 | } | ||
184 | return urls; | 185 | return urls; | ||
185 | } | 186 | } | ||
186 | 187 | | |||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 297 | { | |||
310 | 311 | | |||
311 | QCOMPARE(groups.at(0).first, 0); | 312 | QCOMPARE(groups.at(0).first, 0); | ||
312 | QCOMPARE(groups.at(0).second.toString(), QStringLiteral("Places")); | 313 | QCOMPARE(groups.at(0).second.toString(), QStringLiteral("Places")); | ||
313 | 314 | | |||
314 | QCOMPARE(groups.at(1).first, expectedRemoteIndex); | 315 | QCOMPARE(groups.at(1).first, expectedRemoteIndex); | ||
315 | QCOMPARE(groups.at(1).second.toString(), QStringLiteral("Remote")); | 316 | QCOMPARE(groups.at(1).second.toString(), QStringLiteral("Remote")); | ||
316 | 317 | | |||
317 | QCOMPARE(groups.at(2).first, expectedRemoteIndex + 2); | 318 | QCOMPARE(groups.at(2).first, expectedRemoteIndex + 2); | ||
318 | QCOMPARE(groups.at(2).second.toString(), QStringLiteral("Recently Saved")); | 319 | QCOMPARE(groups.at(2).second.toString(), QStringLiteral("Recent")); | ||
319 | 320 | | |||
320 | QCOMPARE(groups.at(3).first, expectedRemoteIndex + 4); | 321 | QCOMPARE(groups.at(3).first, expectedRemoteIndex + 5); | ||
321 | QCOMPARE(groups.at(3).second.toString(), QStringLiteral("Search For")); | 322 | QCOMPARE(groups.at(3).second.toString(), QStringLiteral("Search For")); | ||
322 | 323 | | |||
323 | QCOMPARE(groups.at(4).first, expectedRemoteIndex + 8); | 324 | QCOMPARE(groups.at(4).first, expectedRemoteIndex + 9); | ||
324 | QCOMPARE(groups.at(4).second.toString(), QStringLiteral("Devices")); | 325 | QCOMPARE(groups.at(4).second.toString(), QStringLiteral("Devices")); | ||
325 | 326 | | |||
326 | QCOMPARE(groups.at(5).first, expectedRemoteIndex + 9); | 327 | QCOMPARE(groups.at(5).first, expectedRemoteIndex + 10); | ||
327 | QCOMPARE(groups.at(5).second.toString(), QStringLiteral("Removable Devices")); | 328 | QCOMPARE(groups.at(5).second.toString(), QStringLiteral("Removable Devices")); | ||
328 | } | 329 | } | ||
329 | 330 | | |||
330 | void PlacesItemModelTest::testPlaceItem_data() | 331 | void PlacesItemModelTest::testPlaceItem_data() | ||
331 | { | 332 | { | ||
332 | QTest::addColumn<QUrl>("url"); | 333 | QTest::addColumn<QUrl>("url"); | ||
333 | QTest::addColumn<bool>("expectedIsHidden"); | 334 | QTest::addColumn<bool>("expectedIsHidden"); | ||
334 | QTest::addColumn<bool>("expectedIsSystemItem"); | 335 | QTest::addColumn<bool>("expectedIsSystemItem"); | ||
335 | QTest::addColumn<QString>("expectedGroup"); | 336 | QTest::addColumn<QString>("expectedGroup"); | ||
336 | QTest::addColumn<bool>("expectedStorageSetupNeeded"); | 337 | QTest::addColumn<bool>("expectedStorageSetupNeeded"); | ||
337 | 338 | | |||
338 | // places | 339 | // places | ||
339 | QTest::newRow("Places - Home") << QUrl::fromLocalFile(QDir::homePath()) << false << true << QStringLiteral("Places") << false; | 340 | QTest::newRow("Places - Home") << QUrl::fromLocalFile(QDir::homePath()) << false << true << QStringLiteral("Places") << false; | ||
340 | 341 | | |||
341 | // baloo -search | 342 | // baloo -search | ||
342 | QTest::newRow("Baloo - Documents") << QUrl("search:/documents") << false << true << QStringLiteral("Search For") << false; | 343 | QTest::newRow("Baloo - Documents") << QUrl("search:/documents") << false << true << QStringLiteral("Search For") << false; | ||
343 | 344 | | |||
344 | // baloo - timeline | 345 | // baloo - timeline | ||
345 | QTest::newRow("Baloo - Today") << QUrl("timeline:/today") << false << true << QStringLiteral("Recently Saved") << false; | 346 | QTest::newRow("Baloo - Today") << QUrl("timeline:/today") << false << true << QStringLiteral("Recent") << false; | ||
346 | 347 | | |||
347 | // devices | 348 | // devices | ||
348 | QTest::newRow("Devices - Floppy") << QUrl("file:///media/floppy0") << false << false << QStringLiteral("Removable Devices") << false; | 349 | QTest::newRow("Devices - Floppy") << QUrl("file:///media/floppy0") << false << false << QStringLiteral("Removable Devices") << false; | ||
349 | } | 350 | } | ||
350 | 351 | | |||
351 | void PlacesItemModelTest::testPlaceItem() | 352 | void PlacesItemModelTest::testPlaceItem() | ||
352 | { | 353 | { | ||
353 | QFETCH(QUrl, url); | 354 | QFETCH(QUrl, url); | ||
▲ Show 20 Lines • Show All 618 Lines • Show Last 20 Lines |