diff options
| author | Renato Araujo Oliveira Filho <[email protected]> | 2018-01-19 13:37:09 -0300 |
|---|---|---|
| committer | Renato Araujo Oliveira Filho <[email protected]> | 2018-01-26 11:14:30 -0300 |
| commit | a8a3fa51a0649ffc43b0d740c268e39a6dd6672b (patch) | |
| tree | f89bb52f464dd19733cc546e18a4551c9eb9fa1d /src/tests | |
| parent | 3bf68fd71492f02bffb6cf040e9471c5e997180e (diff) | |
Fix place item edit after creation
Summary:
Make sure that the place can be edited after the creation.
Depends on D9333
BUG: 389147
Test Plan:
Create an item in dolphin places panel, make sure that you
can rename it
Reviewers: #dolphin, ngraham
Reviewed By: ngraham
Subscribers: michaelh, elvisangelaccio, lbeltrame, ngraham, #dolphin
Differential Revision: https://phabricator.kde.org/D9985
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/placesitemmodeltest.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index 8fb01676a..a74b3ea6c 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -84,6 +84,7 @@ private slots: void testDragAndDrop(); void testHideDevices(); void testDuplicatedEntries(); + void renameAfterCreation(); private: PlacesItemModel* m_model; @@ -808,6 +809,42 @@ void PlacesItemModelTest::testDuplicatedEntries() delete newModel; } +void PlacesItemModelTest::renameAfterCreation() +{ + const QUrl tempUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); + QStringList urls = initialUrls(); + PlacesItemModel *model = new PlacesItemModel(); + + CHECK_PLACES_URLS(urls); + QTRY_COMPARE(model->count(), m_model->count()); + + // create a new place + createPlaceItem(QStringLiteral("Temporary Dir"), tempUrl, QString()); + urls.insert(3, tempUrl.toLocalFile()); + + // make sure that the new item will be removed later + removePlaceAfter(3); + + CHECK_PLACES_URLS(urls); + QCOMPARE(model->count(), m_model->count()); + + + // modify place text + QSignalSpy changedSpy(m_model, &PlacesItemModel::itemsChanged); + + PlacesItem *item = m_model->placesItem(3); + item->setText(QStringLiteral("New Temporary Dir")); + item->setUrl(item->url()); + item->setIcon(item->icon()); + m_model->refresh(); + + QTRY_COMPARE(changedSpy.count(), 1); + + // check if the place was modified in both models + QTRY_COMPARE(m_model->placesItem(3)->text(), QStringLiteral("New Temporary Dir")); + QTRY_COMPARE(model->placesItem(3)->text(), QStringLiteral("New Temporary Dir")); +} + QTEST_MAIN(PlacesItemModelTest) #include "placesitemmodeltest.moc" |
