Commit 161b6c42 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QRandomGenerator

Summary: Port to QRandomGenerator

Test Plan: autotest ok

Reviewers: dfaure, apol

Reviewed By: apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26189
parent 3f2fab73
#include "graphicssignalplotterbenchmark.h"
#include "signalplotter/kgraphicssignalplotter.h"
#include <QRandomGenerator>
#include <QtTestGui>
#include <QGraphicsView>
#include <QGraphicsScene>
......@@ -31,8 +32,10 @@ void BenchmarkGraphicsSignalPlotter::addData()
s->setMaxAxisTextWidth(5);
QVERIFY(QTest::qWaitForWindowExposed(view));
auto *generator = QRandomGenerator::global();
QBENCHMARK {
s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
s->addSample(QList<qreal>() << generator->bounded(10) << generator->bounded(10) << generator->bounded(10) << generator->bounded(10));
qApp->processEvents();
}
......@@ -44,9 +47,10 @@ void BenchmarkGraphicsSignalPlotter::addDataWhenHidden()
s->addBeam(Qt::green);
s->addBeam(Qt::red);
s->addBeam(Qt::yellow);
auto *generator = QRandomGenerator::global();
QBENCHMARK {
s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
s->addSample(QList<qreal>() << generator->bounded(10) << generator->bounded(10) << generator->bounded(10) << generator->bounded(10));
qApp->processEvents();
}
......
#include "signalplotterbenchmark.h"
#include "signalplotter/ksignalplotter.h"
#include <QRandomGenerator>
#include <QtTestGui>
#include <QtGui>
#include <limits>
......@@ -25,8 +26,9 @@ void BenchmarkSignalPlotter::addData()
s->resize(1000,500);
QVERIFY(QTest::qWaitForWindowExposed(s));
auto *generator = QRandomGenerator::global();
QBENCHMARK {
s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
s->addSample(QList<qreal>() << generator->bounded(10) << generator->bounded(10) << generator->bounded(10) << generator->bounded(10));
qApp->processEvents();
}
......@@ -43,8 +45,9 @@ void BenchmarkSignalPlotter::stackedData()
s->resize(1000,500);
QVERIFY(QTest::qWaitForWindowExposed(s));
auto *generator = QRandomGenerator::global();
QBENCHMARK {
s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
s->addSample(QList<qreal>() << generator->bounded(10) << generator->bounded(10) << generator->bounded(10) << generator->bounded(10));
qApp->processEvents();
}
......@@ -56,8 +59,9 @@ void BenchmarkSignalPlotter::addDataWhenHidden()
s->addBeam(Qt::red);
s->addBeam(Qt::yellow);
auto *generator = QRandomGenerator::global();
QBENCHMARK {
s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
s->addSample(QList<qreal>() << generator->bounded(10) << generator->bounded(10) << generator->bounded(10) << generator->bounded(10));
qApp->processEvents();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment