summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-10-01 19:02:26 +0300
committerKatja Marttila <katja.marttila@qt.io>2020-11-04 10:08:08 +0300
commit839679e4ec9667b2c36daab1fe0d499673228d50 (patch)
tree217016adf9bb38235feacd9139fb6f38626286fb /tests/auto
parentd3cae4df15598bf4797cd7fc03aced50bb5a25a1 (diff)
Replace obsolete qrand() with QRandomGenerator
Change-Id: Ie61b192bcf047cc70f728ea15370ff50e7a41769 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/installer/registerfiletypeoperation/tst_registerfiletypeoperation.cpp3
-rw-r--r--tests/auto/installer/replaceoperation/tst_replaceoperation.cpp3
2 files changed, 4 insertions, 2 deletions
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 <QTextStream>
#include <QSettings>
#include <QtGlobal>
+#include <QRandomGenerator>
#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 <QDir>
#include <QFile>
#include <QTest>
+#include <QRandomGenerator>
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()