Changeset View
Changeset View
Standalone View
Standalone View
autotests/kfileplacesmodeltest.cpp
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 57 | private Q_SLOTS: | |||
---|---|---|---|---|---|
66 | void testMove(); | 66 | void testMove(); | ||
67 | void testPlacesLifecycle(); | 67 | void testPlacesLifecycle(); | ||
68 | void testDevicePlugging(); | 68 | void testDevicePlugging(); | ||
69 | void testDragAndDrop(); | 69 | void testDragAndDrop(); | ||
70 | void testDeviceSetupTeardown(); | 70 | void testDeviceSetupTeardown(); | ||
71 | void testEnableBaloo(); | 71 | void testEnableBaloo(); | ||
72 | void testRemoteUrls_data(); | 72 | void testRemoteUrls_data(); | ||
73 | void testRemoteUrls(); | 73 | void testRemoteUrls(); | ||
74 | void testRefresh(); | ||||
74 | void testConvertedUrl_data(); | 75 | void testConvertedUrl_data(); | ||
75 | void testConvertedUrl(); | 76 | void testConvertedUrl(); | ||
76 | 77 | | |||
77 | private: | 78 | private: | ||
78 | QStringList placesUrls() const; | 79 | QStringList placesUrls() const; | ||
79 | QDBusInterface *fakeManager(); | 80 | QDBusInterface *fakeManager(); | ||
80 | QDBusInterface *fakeDevice(const QString &udi); | 81 | QDBusInterface *fakeDevice(const QString &udi); | ||
81 | 82 | | |||
▲ Show 20 Lines • Show All 738 Lines • ▼ Show 20 Line(s) | 796 | { | |||
820 | 821 | | |||
821 | // check if the new url has the right group "Remote" | 822 | // check if the new url has the right group "Remote" | ||
822 | const QModelIndex index = m_places->index(expectedRow, 0); | 823 | const QModelIndex index = m_places->index(expectedRow, 0); | ||
823 | QCOMPARE(index.data(KFilePlacesModel::GroupRole).toString(), expectedGroup); | 824 | QCOMPARE(index.data(KFilePlacesModel::GroupRole).toString(), expectedGroup); | ||
824 | 825 | | |||
825 | m_places->removePlace(index); | 826 | m_places->removePlace(index); | ||
826 | } | 827 | } | ||
827 | 828 | | |||
829 | void KFilePlacesModelTest::testRefresh() | ||||
830 | { | ||||
831 | KBookmarkManager *bookmarkManager = KBookmarkManager::managerForFile(bookmarksFile(), QStringLiteral("kfilePlaces")); | ||||
832 | KBookmarkGroup root = bookmarkManager->root(); | ||||
833 | KBookmark homePlace = root.first(); | ||||
834 | const QModelIndex homePlaceIndex = m_places->index(0, 0); | ||||
835 | | ||||
836 | QCOMPARE(m_places->text(homePlaceIndex), homePlace.fullText()); | ||||
837 | | ||||
838 | // modify bookmark | ||||
839 | homePlace.setFullText("Test change the text"); | ||||
840 | QVERIFY(m_places->text(homePlaceIndex) != homePlace.fullText()); | ||||
841 | | ||||
842 | // reload bookmark data | ||||
843 | m_places->refresh(); | ||||
844 | QCOMPARE(m_places->text(homePlaceIndex), homePlace.fullText()); | ||||
845 | } | ||||
846 | | ||||
828 | void KFilePlacesModelTest::testConvertedUrl_data() | 847 | void KFilePlacesModelTest::testConvertedUrl_data() | ||
829 | { | 848 | { | ||
830 | QTest::addColumn<QUrl>("url"); | 849 | QTest::addColumn<QUrl>("url"); | ||
831 | QTest::addColumn<QUrl>("expectedUrl"); | 850 | QTest::addColumn<QUrl>("expectedUrl"); | ||
832 | 851 | | |||
833 | // places | 852 | // places | ||
834 | QTest::newRow("Places - Home") << QUrl::fromLocalFile(QDir::homePath()) | 853 | QTest::newRow("Places - Home") << QUrl::fromLocalFile(QDir::homePath()) | ||
835 | << QUrl::fromLocalFile(QDir::homePath()); | 854 | << QUrl::fromLocalFile(QDir::homePath()); | ||
Show All 40 Lines |