X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fd1a078cc4f5375c856ec49e05c0a33099db8861..d2f044b32d34023fbf4755b95dcafe71ed00b55f:/src/tests/kitemsettest.cpp diff --git a/src/tests/kitemsettest.cpp b/src/tests/kitemsettest.cpp index 27f8413a7..d19752c33 100644 --- a/src/tests/kitemsettest.cpp +++ b/src/tests/kitemsettest.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2013 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: 2013 Frank Reininghaus + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemviews/kitemset.h" @@ -29,7 +16,7 @@ Q_DECLARE_METATYPE(KItemRangeList) KItemSet KItemRangeList2KItemSet(const KItemRangeList& itemRanges) { KItemSet result; - foreach (const KItemRange& range, itemRanges) { + for (const KItemRange& range : itemRanges) { for (int i = range.index; i < range.index + range.count; ++i) { result.insert(i); } @@ -43,7 +30,7 @@ KItemSet KItemRangeList2KItemSet(const KItemRangeList& itemRanges) QSet KItemRangeList2QSet(const KItemRangeList& itemRanges) { QSet result; - foreach (const KItemRange& range, itemRanges) { + for (const KItemRange& range : itemRanges) { for (int i = range.index; i < range.index + range.count; ++i) { result.insert(i); } @@ -57,7 +44,7 @@ QSet KItemRangeList2QSet(const KItemRangeList& itemRanges) QVector KItemRangeList2QVector(const KItemRangeList& itemRanges) { QVector result; - foreach (const KItemRange& range, itemRanges) { + for (const KItemRange& range : itemRanges) { for (int i = range.index; i < range.index + range.count; ++i) { result.append(i); } @@ -78,11 +65,11 @@ static QSet KItemSet2QSet(const KItemSet& itemSet) // Check that the conversion was successful. Q_ASSERT(itemSet.count() == result.count()); - for (int i : itemSet) { + for (int i : qAsConst(itemSet)) { Q_ASSERT(result.contains(i)); } - foreach (int i, result) { + for (int i : qAsConst(result)) { Q_ASSERT(itemSet.contains(i)); } @@ -203,7 +190,7 @@ void KItemSetTest::testIterators() QVERIFY(itemSet.isValid()); QVERIFY(itemSet.count() == itemsQVector.count()); - if (itemSet.count() == 0) { + if (itemSet.isEmpty()) { QVERIFY(itemSet.isEmpty()); QVERIFY(itemSet.begin() == itemSet.end()); QVERIFY(itemSet.constBegin() == itemSet.constEnd()); @@ -342,7 +329,7 @@ void KItemSetTest::testFind() int min; int max; - if (itemSet.count() == 0) { + if (itemSet.isEmpty()) { // Use some arbitrary values for the upcoming tests. min = 0; max = 5; @@ -401,7 +388,7 @@ void KItemSetTest::testChangingOneItem() int min; int max; - if (itemSet.count() == 0) { + if (itemSet.isEmpty()) { // Use some arbitrary values for the upcoming tests. min = 0; max = 5;