diff options
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qquicklistview/randomsortmodel.cpp | 5 | ||||
-rw-r--r-- | tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.cpp | 6 |
3 files changed, 6 insertions, 7 deletions
diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp index 7affb182c0..7c4bd5111c 100644 --- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp +++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include "randomsortmodel.h" +#include <QRandomGenerator> RandomSortModel::RandomSortModel(QObject* parent): QAbstractListModel(parent) @@ -73,14 +74,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const void RandomSortModel::randomize() { - const int row = qrand() % mData.count(); + const int row = QRandomGenerator::bounded(mData.count()); int random; bool exists = false; // Make sure we won't end up with two items with the same weight, as that // would make unit-testing much harder do { exists = false; - random = qrand() % (mData.count() * 10); + random = QRandomGenerator::bounded(mData.count() * 10); QList<QPair<QString, int> >::ConstIterator iter, end; for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) { if ((*iter).second == random) { diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index adcdca4c3c..5ae82423f9 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -2668,7 +2668,6 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QQuickPointerMouseEvent pme; pme.reset(&me); - QVERIFY(pme.isValid()); QCOMPARE(pme.asMouseEvent(localPosition), &me); QVERIFY(pme.asPointerMouseEvent()); QVERIFY(!pme.asPointerTouchEvent()); @@ -2681,7 +2680,6 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QQuickPointerTouchEvent pte; pte.reset(&te); - QVERIFY(pte.isValid()); QCOMPARE(pte.asTouchEvent(), &te); QVERIFY(!pte.asPointerMouseEvent()); QVERIFY(pte.asPointerTouchEvent()); diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index cb2b8be97a..a33c5eae96 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -28,6 +28,7 @@ #include "viewtestutil.h" +#include <QtCore/QRandomGenerator> #include <QtQuick/QQuickView> #include <QtQuick/QQuickView> #include <QtGui/QScreen> @@ -356,7 +357,6 @@ QQuickViewTestUtil::StressTestModel::StressTestModel() t->setInterval(500); t->start(); - qsrand(qHash(QDateTime::currentDateTime())); connect(t, &QTimer::timeout, this, &StressTestModel::updateModel); } @@ -374,7 +374,7 @@ void QQuickViewTestUtil::StressTestModel::updateModel() { if (m_rowCount > 10) { for (int i = 0; i < 10; ++i) { - int rnum = qrand() % m_rowCount; + int rnum = QRandomGenerator::bounded(m_rowCount); beginRemoveRows(QModelIndex(), rnum, rnum); m_rowCount--; endRemoveRows(); @@ -382,7 +382,7 @@ void QQuickViewTestUtil::StressTestModel::updateModel() } if (m_rowCount < 20) { for (int i = 0; i < 10; ++i) { - int rnum = qrand() % m_rowCount; + int rnum = QRandomGenerator::bounded(m_rowCount); beginInsertRows(QModelIndex(), rnum, rnum); m_rowCount++; endInsertRows(); |