summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-26 12:21:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-31 18:36:46 +0200
commit3d6d6594b0dd2a8860b8fddd5a58f86c4ebd255c (patch)
tree5a9959d433425d8ff1a1d78d1b2506a1fd147770 /tests
parent3512a6cfe07cb7108485b3e39d586612aa5ed3d8 (diff)
Centralize OpenGL initialization
We now require the user to use QWebEngine::initialize() in main (preferably) and print out an error message if this wasn't set up accordingly. This limits the use of private scene graph API to inside QWebEngine and offers public API for users of the API. Change-Id: I787c176a85ab7784dbc8787d9876960b4872959e Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
-rw-r--r--tests/auto/quick/qquickwebviewgraphics/tst_qquickwebviewgraphics.cpp10
-rw-r--r--tests/auto/quick/shared/qt_webengine_quicktest.h7
-rw-r--r--tests/auto/quick/tests.pri3
-rw-r--r--tests/quicktestbrowser/main.cpp9
-rw-r--r--tests/quicktestbrowser/quicktestbrowser.pro3
6 files changed, 9 insertions, 24 deletions
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index 5883574d3..98d836a10 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -1,7 +1,6 @@
include(../tests.pri)
QT += qmltest
-QT_PRIVATE += quick-private
IMPORTPATH += $$PWD/data
diff --git a/tests/auto/quick/qquickwebviewgraphics/tst_qquickwebviewgraphics.cpp b/tests/auto/quick/qquickwebviewgraphics/tst_qquickwebviewgraphics.cpp
index 4411107c4..213420b13 100644
--- a/tests/auto/quick/qquickwebviewgraphics/tst_qquickwebviewgraphics.cpp
+++ b/tests/auto/quick/qquickwebviewgraphics/tst_qquickwebviewgraphics.cpp
@@ -43,7 +43,8 @@
#include <QQmlContext>
#include <QQuickView>
#include <QQuickItem>
-#include <QtQuick/private/qsgcontext_p.h>
+#include <QPainter>
+#include <qtwebengineglobal.h>
class TestView : public QQuickView {
Q_OBJECT
@@ -111,12 +112,7 @@ void tst_QQuickWebViewGraphics::initTestCase()
#if defined(TST_QQUICKWEBVIEWGRAPHICS_SOFTWARE)
qApp->setProperty("QQuickWebEngineView_DisableHardwareAcceleration", QVariant(true));
#else
- // This is currently needed by all QtWebEngine application using the HW accelerated QQuickWebView.
- // It enables sharing between the QOpenGLContext of all QQuickWindows of the application.
- // We have to do so until we expose a public API for it, or chose enable it by default in Qt 5.3.0.
- QOpenGLContext *shareContext = new QOpenGLContext;
- shareContext->create();
- QSGContext::setSharedOpenGLContext(shareContext);
+ QWebEngine::initialize();
#endif
}
diff --git a/tests/auto/quick/shared/qt_webengine_quicktest.h b/tests/auto/quick/shared/qt_webengine_quicktest.h
index 92e9889ef..275e40dd2 100644
--- a/tests/auto/quick/shared/qt_webengine_quicktest.h
+++ b/tests/auto/quick/shared/qt_webengine_quicktest.h
@@ -51,7 +51,7 @@
#endif
#include "qopenglcontext.h"
-#include <QtQuick/private/qsgcontext_p.h>
+#include <qtwebengineglobal.h>
QT_BEGIN_NAMESPACE
@@ -72,11 +72,8 @@ QT_BEGIN_NAMESPACE
qputenv("QTWEBENGINEPROCESS_PATH", QWP_PATH); \
if (!QCoreApplication::instance()) \
app = new Application(argc, argv); \
- QOpenGLContext *shareContext = new QOpenGLContext(); \
- shareContext->create(); \
- QSGContext::setSharedOpenGLContext(shareContext); \
+ QWebEngine::initialize(); \
int i = quick_test_main(argc, argv, #name, QUICK_TEST_SOURCE_DIR); \
- delete shareContext; \
delete app; \
return i; \
}
diff --git a/tests/auto/quick/tests.pri b/tests/auto/quick/tests.pri
index c2e47c653..932407e66 100644
--- a/tests/auto/quick/tests.pri
+++ b/tests/auto/quick/tests.pri
@@ -9,8 +9,7 @@ TARGET = tst_$$TARGET
SOURCES += $${TARGET}.cpp
INCLUDEPATH += $$PWD
-QT += testlib network quick
-QT_PRIVATE += quick-private gui-private core-private
+QT += testlib network quick webengine
macx: CONFIG -= app_bundle
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp
index 6c2f91de6..1e592f3e1 100644
--- a/tests/quicktestbrowser/main.cpp
+++ b/tests/quicktestbrowser/main.cpp
@@ -47,18 +47,13 @@ typedef QApplication Application;
#include <QtGui/QGuiApplication>
typedef QGuiApplication Application;
#endif
-#include <QtQuick/private/qsgcontext_p.h>
+#include <qtwebengineglobal.h>
int main(int argc, char **argv)
{
Application app(argc, argv);
- // This is currently needed by all QtWebEngine application using the HW accelerated QQuickWebView.
- // It enables sharing between the QOpenGLContext of all QQuickWindows of the application.
- // We have to do so until we expose a public API for it, or chose enable it by default in Qt 5.3.0.
- QOpenGLContext shareContext;
- shareContext.create();
- QSGContext::setSharedOpenGLContext(&shareContext);
+ QWebEngine::initialize();
ApplicationEngine appEngine;
diff --git a/tests/quicktestbrowser/quicktestbrowser.pro b/tests/quicktestbrowser/quicktestbrowser.pro
index 83baa73f1..b0146a689 100644
--- a/tests/quicktestbrowser/quicktestbrowser.pro
+++ b/tests/quicktestbrowser/quicktestbrowser.pro
@@ -13,8 +13,7 @@ OTHER_FILES += ContextMenuExtras.qml \
RESOURCES += resources.qrc
-QT += qml quick
-QT_PRIVATE += quick-private gui-private core-private
+QT += qml quick webengine
qtHaveModule(widgets) {
QT += widgets # QApplication is required to get native styling with QtQuickControls