X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/da6f8fe0862585287153f0d90e19eab0b34bfbef..2e942237c9:/src/tests/placesitemmodeltest.cpp diff --git a/src/tests/placesitemmodeltest.cpp b/src/tests/placesitemmodeltest.cpp index 7c4cf308b..ef24292ed 100644 --- a/src/tests/placesitemmodeltest.cpp +++ b/src/tests/placesitemmodeltest.cpp @@ -82,6 +82,7 @@ private slots: void testIcons_data(); void testIcons(); void testDragAndDrop(); + void testHideDevices(); private: PlacesItemModel* m_model; @@ -758,6 +759,29 @@ void PlacesItemModelTest::testDragAndDrop() CHECK_PLACES_URLS(urls); } +void PlacesItemModelTest::testHideDevices() +{ + QSignalSpy itemsRemoved(m_model, &PlacesItemModel::itemsRemoved); + QStringList urls = initialUrls(); + + m_model->setGroupHidden(KFilePlacesModel::RemovableDevicesType, true); + QTRY_VERIFY(m_model->isGroupHidden(KFilePlacesModel::RemovableDevicesType)); + QTRY_COMPARE(itemsRemoved.count(), 3); + + // remove removable-devices + urls.removeOne(QStringLiteral("/media/floppy0")); + urls.removeOne(QStringLiteral("/media/XO-Y4")); + urls.removeOne(QStringLiteral("/media/cdrom")); + + // check if the correct urls was removed + CHECK_PLACES_URLS(urls); + + delete m_model; + m_model = new PlacesItemModel(); + QTRY_COMPARE(m_model->count(), urls.count()); + CHECK_PLACES_URLS(urls); +} + QTEST_MAIN(PlacesItemModelTest) #include "placesitemmodeltest.moc"