summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-09-09 10:06:45 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-09-10 13:36:27 +0200
commit2f96fb1beec5251e27381c09d0ad810c6e829c37 (patch)
tree4e7cd85d7e1175657a0d91c1e0076ef156b71c68 /tests
parent162010441f876788428aaacf9a00312d3175d150 (diff)
Add an option to share between TLWs
Task-number: QTBUG-41191 Change-Id: I510d1631926ed0d9e371703d22229aed92432aa6 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 2ce9dca153..1d6df973ed 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -53,6 +53,8 @@
#include <QOpenGLContext>
#endif
+#include <QtGui/private/qopenglcontext_p.h>
+
#include <QDebug>
#include "tst_qcoreapplication.h"
@@ -79,6 +81,7 @@ private slots:
void quitOnLastWindowClosed();
void genericPluginsAndWindowSystemEvents();
void layoutDirection();
+ void globalShareContext();
};
void tst_QGuiApplication::cleanup()
@@ -915,4 +918,28 @@ void tst_QGuiApplication::layoutDirection()
QCOMPARE(signalSpy.count(), 1);
}
+void tst_QGuiApplication::globalShareContext()
+{
+#ifndef QT_NO_OPENGL
+ // Test that there is a global share context when requested.
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
+ int argc = 1;
+ char *argv[] = { const_cast<char*>("tst_qguiapplication") };
+ QScopedPointer<QGuiApplication> app(new QGuiApplication(argc, argv));
+ QOpenGLContext *ctx = qt_gl_global_share_context();
+ QVERIFY(ctx);
+ app.reset();
+ ctx = qt_gl_global_share_context();
+ QVERIFY(!ctx);
+
+ // Test that there is no global share context by default.
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, false);
+ app.reset(new QGuiApplication(argc, argv));
+ ctx = qt_gl_global_share_context();
+ QVERIFY(!ctx);
+#else
+ QSKIP("No OpenGL support");
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_QGuiApplication)