From 168fe50106b20b250cdc5499e17f48907bd00f53 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 15 Aug 2011 13:43:45 +0200 Subject: Make QThread::sleep/msleep/usleep public. Merge-request: 43 Reviewed-by: olivier Reviewed-by: Frederik Gladhorn Change-Id: Ic5e3ce8f49daf83665865f89fa9fd3488cc5b349 Reviewed-on: http://codereview.qt.nokia.com/2959 Reviewed-by: Frederik Gladhorn Reviewed-by: Qt Sanity Bot --- tests/auto/qglthreads/tst_qglthreads.cpp | 37 +++++---------------------- tests/manual/qgraphicslayout/flicker/window.h | 15 +---------- 2 files changed, 7 insertions(+), 45 deletions(-) (limited to 'tests') diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp index 859f47f000..472379ab7a 100644 --- a/tests/auto/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/qglthreads/tst_qglthreads.cpp @@ -46,7 +46,6 @@ #include "tst_qglthreads.h" #ifdef Q_OS_SYMBIAN -#include // for usleep #define RUNNING_TIME 2000 // save GPU mem by running shorter time. #else #define RUNNING_TIME 5000 @@ -467,11 +466,7 @@ void tst_QGLThreads::renderInThread() qApp->processEvents(); value = -value; -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!thread.failure); @@ -574,11 +569,7 @@ public slots: p.drawText(rect.center(), "This is a piece of text"); p.end(); rotAngle += 2; -#ifdef Q_WS_WIN - Sleep(20); -#else - usleep(20 * 1000); -#endif + QThread::msleep(20); } fail = beginFailed; @@ -670,11 +661,7 @@ void tst_QGLThreads::painterOnGLWidgetInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -693,11 +680,7 @@ void tst_QGLThreads::painterOnPixmapInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -726,11 +709,7 @@ void tst_QGLThreads::painterOnPboInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } @@ -760,11 +739,7 @@ void tst_QGLThreads::painterOnFboInThread() while (painterThreads.areRunning()) { qApp->processEvents(); -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif + QThread::msleep(100); } QVERIFY(!painterThreads.failed()); } diff --git a/tests/manual/qgraphicslayout/flicker/window.h b/tests/manual/qgraphicslayout/flicker/window.h index 5d5a9c1fd3..26a8f2ab5e 100644 --- a/tests/manual/qgraphicslayout/flicker/window.h +++ b/tests/manual/qgraphicslayout/flicker/window.h @@ -45,19 +45,6 @@ #include -static void qSleep(int msec) -{ - - struct Thread : public QThread - { - static void wait(int msec) - { - QThread::msleep(msec); - } - }; - Thread::wait(msec); -} - struct Statistics { Statistics() : output(0), setGeometryCount(0), currentBenchmarkIteration(0), relayoutClicked(false), sleepMsecs(0) @@ -70,7 +57,7 @@ struct Statistics { QLabel *output; void sleep() { - qSleep(sleepMsecs); + QThread::msleep(sleepMsecs); } int currentBenchmarkIteration; bool relayoutClicked; -- cgit v1.2.3