diff options
author | Sergio Ahumada <sahumada@blackberry.com> | 2014-03-13 15:57:03 +0100 |
---|---|---|
committer | Sergio Ahumada <sahumada@blackberry.com> | 2014-03-13 15:57:11 +0100 |
commit | 27016b89ae49da091527548af0ca9022ec4d7902 (patch) | |
tree | de408d49d52dd6a73e75a612ef51342d6ee44638 /tests/auto/opengl/qglthreads/tst_qglthreads.cpp | |
parent | 3683bc97d2ebc0de3272fc09656b90a88f5eb326 (diff) | |
parent | fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Idec54e19963e8d88c711cb179cffc81596323899
Diffstat (limited to 'tests/auto/opengl/qglthreads/tst_qglthreads.cpp')
-rw-r--r-- | tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 765dc221dc..999761e3f0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -216,6 +216,11 @@ public: { m_gl = new QGLWidget(0, shareWidget); moveToThread(this); + + } + + void moveContextToThread() + { m_gl->context()->moveToThread(this); } @@ -307,6 +312,7 @@ void tst_QGLThreads::textureUploadInThread() display.show(); QVERIFY(QTest::qWaitForWindowActive(&display)); + thread.moveContextToThread(); thread.start(); while (thread.isRunning()) { @@ -333,7 +339,7 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { QGLFunctions funcs(QGLContext::currentContext()); Q_UNUSED(w); Q_UNUSED(h); @@ -630,6 +636,12 @@ class PaintThreadManager public: PaintThreadManager(int count) : numThreads(count) { + for (int i=0; i<numThreads; ++i) + devices.append(new T); + // Wait until resize events are processed on the internal + // QGLWidgets of the buffers to suppress errors + // about makeCurrent() from the wrong thread. + QCoreApplication::processEvents(); for (int i=0; i<numThreads; ++i) { devices.append(new T); threads.append(new QThread); |