summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-09-21 12:21:34 -0700
committerLars Knoll <lars.knoll@qt.io>2017-11-03 09:13:37 +0000
commit567b5bc67e54f496027da2e6d99aa7b39d64a606 (patch)
tree9bdb47dfba0e69e4d31c27e40bd4b25eefb624b2 /tests
parentdad8cdbac13eaf3ed33fdf4157ebc242d5c13db5 (diff)
Update to new QRandomGenerator API
Change-Id: I69f37f9304f24709a823fffd14e676c097712329 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.cpp8
-rw-r--r--tests/manual/candlesticktester/mainwidget.cpp2
-rw-r--r--tests/manual/chartviewer/model.h4
-rw-r--r--tests/manual/chartwidgettest/mainwidget.cpp4
-rw-r--r--tests/manual/openglseriestest/datasource.cpp2
-rw-r--r--tests/manual/openglseriestest/mainwindow.cpp2
-rw-r--r--tests/manual/presenterchart/chartview.cpp2
-rw-r--r--tests/manual/wavechart/wavechart.cpp2
8 files changed, 13 insertions, 13 deletions
diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp
index f55f5147..de878679 100644
--- a/tests/auto/qxyseries/tst_qxyseries.cpp
+++ b/tests/auto/qxyseries/tst_qxyseries.cpp
@@ -325,7 +325,7 @@ void tst_QXYSeries::remove_raw()
// (simulate e.g. spamming a hypothetical "remove last point"-button)
QList<QPointF> bunchOfPoints;
for (int i = 0; i < 10; i++)
- bunchOfPoints.append(QPointF(i, QRandomGenerator::getReal()));
+ bunchOfPoints.append(QPointF(i, QRandomGenerator::global()->generateDouble()));
m_series->replace(bunchOfPoints);
QCOMPARE(m_series->points(), bunchOfPoints);
QTest::qWait(1500); // Wait for append animations to be over
@@ -337,7 +337,7 @@ void tst_QXYSeries::remove_raw()
// Removal using index
for (int i = 0; i < 10; i++)
- bunchOfPoints.append(QPointF(i, QRandomGenerator::getReal()));
+ bunchOfPoints.append(QPointF(i, QRandomGenerator::global()->generateDouble()));
m_series->replace(bunchOfPoints);
m_series->remove(5);
m_series->remove(0);
@@ -350,7 +350,7 @@ void tst_QXYSeries::remove_raw()
// Multiple removal using index
for (int i = 0; i < 10; i++)
- bunchOfPoints.append(QPointF(i, QRandomGenerator::getReal()));
+ bunchOfPoints.append(QPointF(i, QRandomGenerator::global()->generateDouble()));
m_series->replace(bunchOfPoints);
m_series->removePoints(5, 2);
m_series->removePoints(0, 3);
@@ -463,7 +463,7 @@ void tst_QXYSeries::replace_raw()
// Replace all points
QList<QPointF> allPoints;
for (int i = 0; i < 10; i++)
- allPoints.append(QPointF(i, QRandomGenerator::getReal()));
+ allPoints.append(QPointF(i, QRandomGenerator::global()->generateDouble()));
m_series->replace(allPoints);
TRY_COMPARE(pointReplacedSpy.count(), points.count());
TRY_COMPARE(pointsReplacedSpy.count(), 1);
diff --git a/tests/manual/candlesticktester/mainwidget.cpp b/tests/manual/candlesticktester/mainwidget.cpp
index f45a7793..ec2d5bd8 100644
--- a/tests/manual/candlesticktester/mainwidget.cpp
+++ b/tests/manual/candlesticktester/mainwidget.cpp
@@ -286,7 +286,7 @@ qreal MainWidget::randomValue(int min, int max) const
{
if (min > max)
qSwap(min, max);
- return QRandomGenerator::bounded(min, max);
+ return QRandomGenerator::global()->bounded(min, max);
}
QCandlestickSet *MainWidget::randomSet(qreal timestamp)
diff --git a/tests/manual/chartviewer/model.h b/tests/manual/chartviewer/model.h
index 5db91e8e..a4c3aa3c 100644
--- a/tests/manual/chartviewer/model.h
+++ b/tests/manual/chartviewer/model.h
@@ -56,9 +56,9 @@ public:
DataList dataList;
qreal yValue(0.1);
for (int j(0); j < valueCount; j++) {
- yValue = yValue + QRandomGenerator::bounded(valueMax / (qreal) valueCount);
+ yValue = yValue + QRandomGenerator::global()->bounded(valueMax / (qreal) valueCount);
QPointF value(
- (j + QRandomGenerator::getReal())
+ (j + QRandomGenerator::global()->generateDouble())
* ((qreal) valueMax / (qreal) valueCount), yValue);
QString label = "Slice " + QString::number(i) + ":" + QString::number(j);
dataList << Data(value, label);
diff --git a/tests/manual/chartwidgettest/mainwidget.cpp b/tests/manual/chartwidgettest/mainwidget.cpp
index 2850de0e..3ff15810 100644
--- a/tests/manual/chartwidgettest/mainwidget.cpp
+++ b/tests/manual/chartwidgettest/mainwidget.cpp
@@ -219,9 +219,9 @@ QList<RealList> MainWidget::generateTestData(int columnCount, int rowCount, QStr
if (dataCharacteristics == "Sin") {
newColumn.append(std::abs(sin(M_PI / 50 * i) * 100));
} else if (dataCharacteristics == "Sin + random") {
- newColumn.append(std::abs(sin(M_PI / 50 * i) * 100) + QRandomGenerator::bounded(5));
+ newColumn.append(std::abs(sin(M_PI / 50 * i) * 100) + QRandomGenerator::global()->bounded(5));
} else if (dataCharacteristics == "Random") {
- newColumn.append(QRandomGenerator::bounded(11.0));
+ newColumn.append(QRandomGenerator::global()->bounded(11.0));
} else if (dataCharacteristics == "Linear") {
//newColumn.append(i * (j + 1.0));
// TODO: temporary hack to make pie work; prevent zero values:
diff --git a/tests/manual/openglseriestest/datasource.cpp b/tests/manual/openglseriestest/datasource.cpp
index 29d7e2ba..dbf6874c 100644
--- a/tests/manual/openglseriestest/datasource.cpp
+++ b/tests/manual/openglseriestest/datasource.cpp
@@ -119,7 +119,7 @@ void DataSource::generateData(int seriesIndex, int rowCount, int colCount)
qreal y(0);
// data with sin + random component
y = height + (yMultiplier * qSin(M_PI / 50 * j)
- + (yMultiplier * QRandomGenerator::getReal()));
+ + (yMultiplier * QRandomGenerator::global()->generateDouble()));
// 0.000001 added to make values logaxis compatible
x = 0.000001 + 20.0 * (qreal(j) / qreal(colCount)) + (xAdjustment * qreal(i));
points.append(QPointF(x, y));
diff --git a/tests/manual/openglseriestest/mainwindow.cpp b/tests/manual/openglseriestest/mainwindow.cpp
index 2d59f18c..1497dad8 100644
--- a/tests/manual/openglseriestest/mainwindow.cpp
+++ b/tests/manual/openglseriestest/mainwindow.cpp
@@ -549,7 +549,7 @@ void MainWindow::addSeries(bool gl)
if (m_seriesList.size() < maxSeriesCount) {
QXYSeries *series;
- if (QRandomGenerator::bounded(2)) {
+ if (QRandomGenerator::global()->bounded(2)) {
series = new QLineSeries;
series->setPen(QPen(QBrush(color), width));
} else {
diff --git a/tests/manual/presenterchart/chartview.cpp b/tests/manual/presenterchart/chartview.cpp
index 86d144ad..b7d575de 100644
--- a/tests/manual/presenterchart/chartview.cpp
+++ b/tests/manual/presenterchart/chartview.cpp
@@ -62,7 +62,7 @@ ChartView::ChartView(QChart *chart, QWidget *parent)
int numPoints = 10;
for (int x = 0; x <= numPoints; ++x) {
- qreal y = QRandomGenerator::bounded(100);
+ qreal y = QRandomGenerator::global()->bounded(100);
series0->append(x, y);
series1->append(x, y);
series2->append(x, y);
diff --git a/tests/manual/wavechart/wavechart.cpp b/tests/manual/wavechart/wavechart.cpp
index 522d2a7c..695ddc72 100644
--- a/tests/manual/wavechart/wavechart.cpp
+++ b/tests/manual/wavechart/wavechart.cpp
@@ -67,7 +67,7 @@ void WaveChart::update()
int fluctuate;
const QList<QPointF>& points = m_series->points();
for (qreal i = 0, x = 0; x <= 2 * M_PI; x += m_step, i++) {
- fluctuate = QRandomGenerator::bounded(100);
+ fluctuate = QRandomGenerator::global()->bounded(100);
m_series->replace(x,points[i].y(),x,fabs(sin(x) * fluctuate));
}