From 839679e4ec9667b2c36daab1fe0d499673228d50 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Thu, 1 Oct 2020 19:02:26 +0300 Subject: Replace obsolete qrand() with QRandomGenerator Change-Id: Ie61b192bcf047cc70f728ea15370ff50e7a41769 Reviewed-by: Iikka Eklund --- .../registerfiletypeoperation/tst_registerfiletypeoperation.cpp | 3 ++- tests/auto/installer/replaceoperation/tst_replaceoperation.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp b/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp index bbe391a0a..4d14a2753 100644 --- a/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp +++ b/tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include "qsettingswrapper.h" @@ -73,7 +74,7 @@ private slots: const QString possible = "abcdefghijklmnopqrstuvwxyz0123456789"; qsrand(QTime::currentTime().msec()); for (int i = 0; i < 5; i++) { - int index = qrand() % possible.length(); + int index = QRandomGenerator::global()->generate() % possible.length(); QChar nextChar = possible.at(index); randomString.append(nextChar); diff --git a/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp b/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp index 88dc2011b..33bd2b6c1 100644 --- a/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp +++ b/tests/auto/installer/replaceoperation/tst_replaceoperation.cpp @@ -34,6 +34,7 @@ #include #include #include +#include using namespace KDUpdater; using namespace QInstaller; @@ -46,7 +47,7 @@ private slots: void initTestCase() { m_testDirectory = QInstaller::generateTemporaryFileName(); - m_testFilePath = m_testDirectory + "/test." + QString::number(qrand() % 1000); + m_testFilePath = m_testDirectory + "/test." + QString::number(QRandomGenerator::global()->generate() % 1000); } void testWrongArguments() -- cgit v1.2.3