Add sizeLessWindow test case.

Verify that QOpenGLContext works with QWindows that
do not have an explicit size set.

Task-number: QTBUG-35342

Change-Id: I91be7beb0062c5825fc58273c701c396b6423256
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Morten Johan Sørvig 2014-02-17 13:06:11 +01:00 committed by The Qt Project
parent 0300f56133
commit 7bd7699e17

View File

@ -78,6 +78,7 @@ private slots:
void openGLPaintDevice_data();
void openGLPaintDevice();
void aboutToBeDestroyed();
void sizeLessWindow();
void QTBUG15621_triangulatingStrokerDivZero();
void textureblitterFullSourceRectTransform();
void textureblitterPartOriginBottomLeftSourceRectTransform();
@ -645,6 +646,43 @@ void tst_QOpenGL::aboutToBeDestroyed()
QCOMPARE(spy.size(), 1);
}
// Verify that QOpenGLContext works with QWindows that do
// not have an explicit size set.
void tst_QOpenGL::sizeLessWindow()
{
// top-level window
{
QWindow window;
window.setSurfaceType(QWindow::OpenGLSurface);
QOpenGLContext context;
QVERIFY(context.create());
window.show();
QVERIFY(context.makeCurrent(&window));
QVERIFY(QOpenGLContext::currentContext());
}
QVERIFY(!QOpenGLContext::currentContext());
// child window
{
QWindow parent;
QWindow window(&parent);
window.setSurfaceType(QWindow::OpenGLSurface);
QOpenGLContext context;
QVERIFY(context.create());
parent.show();
window.show();
QVERIFY(context.makeCurrent(&window));
QVERIFY(QOpenGLContext::currentContext());
}
QVERIFY(!QOpenGLContext::currentContext());
}
void tst_QOpenGL::QTBUG15621_triangulatingStrokerDivZero()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(__x86_64__)