]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/kfileitemmodeltest.cpp
Set initial size corectly
[dolphin.git] / src / tests / kfileitemmodeltest.cpp
index 0c38f02bfd8de7b642ae6bf61ad6a8f87b3ee25c..558a00ab592475fb2b30a6a295967d2913221943 100644 (file)
@@ -1,25 +1,14 @@
-/***************************************************************************
- *   Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>             *
- *   Copyright (C) 2011 by Frank Reininghaus <frank78ac@googlemail.com>    *
- *                                                                         *
- *   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 <peter.penz19@gmail.com>
+ * SPDX-FileCopyrightText: 2011 Frank Reininghaus <frank78ac@googlemail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
+#include <QRandomGenerator>
 #include <QTest>
 #include <QSignalSpy>
+#include <QStandardPaths>
 #include <QTimer>
 #include <QMimeData>
 
@@ -57,8 +46,9 @@ class KFileItemModelTest : public QObject
 {
     Q_OBJECT
 
-private slots:
+private Q_SLOTS:
     void init();
+    void initTestCase();
     void cleanup();
 
     void testDefaultRoles();
@@ -105,6 +95,11 @@ private:
     TestDir* m_testDir;
 };
 
+void KFileItemModelTest::initTestCase()
+{
+    QStandardPaths::setTestModeEnabled(true);
+}
+
 void KFileItemModelTest::init()
 {
     // The item-model tests result in a huge number of debugging
@@ -450,9 +445,9 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
         itemsInsertedSpy.clear();
 
         for (int j = 0; j < 10; ++j) {
-            int itemName = qrand();
+            int itemName = QRandomGenerator::global()->generate();
             while (insertedItems.contains(itemName)) {
-                itemName = qrand();
+                itemName = QRandomGenerator::global()->generate();
             }
             insertedItems.insert(itemName);