X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/0c8ef2977e2285676fb4c2ee1fdcb1e641c1acd7..c68f1f6f8d6c24123c9c5df4d2e91a9d2462ceb6:/src/tests/kitemlistselectionmanagertest.cpp diff --git a/src/tests/kitemlistselectionmanagertest.cpp b/src/tests/kitemlistselectionmanagertest.cpp index 48e8dce04..7f87fdcc8 100644 --- a/src/tests/kitemlistselectionmanagertest.cpp +++ b/src/tests/kitemlistselectionmanagertest.cpp @@ -1,28 +1,16 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz * - * Copyright (C) 2011 by Frank Reininghaus * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz + * SPDX-FileCopyrightText: 2011 Frank Reininghaus + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemviews/kitemmodelbase.h" #include "kitemviews/kitemlistselectionmanager.h" #include #include +#include class DummyModel : public KItemModelBase { @@ -30,8 +18,8 @@ class DummyModel : public KItemModelBase public: DummyModel(); void setCount(int count); - int count() const Q_DECL_OVERRIDE; - QHash data(int index) const Q_DECL_OVERRIDE; + int count() const override; + QHash data(int index) const override; private: int m_count; @@ -55,7 +43,7 @@ int DummyModel::count() const QHash DummyModel::data(int index) const { - Q_UNUSED(index); + Q_UNUSED(index) return QHash(); } @@ -64,7 +52,8 @@ class KItemListSelectionManagerTest : public QObject { Q_OBJECT -private slots: +private Q_SLOTS: + void initTestCase(); void init(); void cleanup(); @@ -89,6 +78,11 @@ private: DummyModel* m_model; }; +void KItemListSelectionManagerTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); +} + void KItemListSelectionManagerTest::init() { m_model = new DummyModel(); @@ -99,10 +93,10 @@ void KItemListSelectionManagerTest::init() void KItemListSelectionManagerTest::cleanup() { delete m_selectionManager; - m_selectionManager = 0; + m_selectionManager = nullptr; delete m_model; - m_model = 0; + m_model = nullptr; } void KItemListSelectionManagerTest::testConstructor() @@ -115,7 +109,7 @@ void KItemListSelectionManagerTest::testConstructor() void KItemListSelectionManagerTest::testCurrentItemAnchorItem() { - QSignalSpy spyCurrent(m_selectionManager, SIGNAL(currentChanged(int,int))); + QSignalSpy spyCurrent(m_selectionManager, &KItemListSelectionManager::currentChanged); // Set current item and check that the selection manager emits the currentChanged(int,int) signal correctly. m_selectionManager->setCurrentItem(4); @@ -445,13 +439,13 @@ void KItemListSelectionManagerTest::testChangeSelection() QFETCH(QList, data); QFETCH(KItemSet, finalSelection); - QSignalSpy spySelectionChanged(m_selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet))); + QSignalSpy spySelectionChanged(m_selectionManager, &KItemListSelectionManager::selectionChanged); // Initial selection should be empty QVERIFY(!m_selectionManager->hasSelection()); QVERIFY(m_selectionManager->selectedItems().isEmpty()); - // Perform the initial selectiion + // Perform the initial selection m_selectionManager->setSelectedItems(initialSelection); verifySelectionChange(spySelectionChanged, initialSelection, KItemSet());