summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-07 01:42:26 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-07 01:42:26 (GMT)
commit9409897cfb5e8add609164c250395529fef95086 (patch)
tree1477850a5e248a79447b40f8df547ad470cc987b /tests
parentf7d87c5fd47724025885522aadcab5a256690941 (diff)
downloadQt-9409897cfb5e8add609164c250395529fef95086.zip
Qt-9409897cfb5e8add609164c250395529fef95086.tar.gz
Qt-9409897cfb5e8add609164c250395529fef95086.tar.bz2
Unit tests for QGLFormat::defaultFormat and ::defaultOverlayFormat()
Reviewed-by: trustme
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgl/tst_qgl.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index d0f45b5..e7d1367 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -500,6 +500,47 @@ void tst_QGL::getSetCheck()
QCOMPARE(format1.redBufferSize(), 8);
QCOMPARE(format1.plane(), 8);
+ // The default format should be the same as QGLFormat().
+ QVERIFY(QGLFormat::defaultFormat() == QGLFormat());
+
+ // Modify the default format and check that it was changed.
+ QGLFormat::setDefaultFormat(format1);
+ QVERIFY(QGLFormat::defaultFormat() == format1);
+
+ // Restore the default format.
+ QGLFormat::setDefaultFormat(QGLFormat());
+ QVERIFY(QGLFormat::defaultFormat() == QGLFormat());
+
+ // Check the default overlay format's expected values.
+ QGLFormat overlay(QGLFormat::defaultOverlayFormat());
+ QCOMPARE(overlay.depthBufferSize(), -1);
+ QCOMPARE(overlay.accumBufferSize(), -1);
+ QCOMPARE(overlay.redBufferSize(), -1);
+ QCOMPARE(overlay.greenBufferSize(), -1);
+ QCOMPARE(overlay.blueBufferSize(), -1);
+ QCOMPARE(overlay.alphaBufferSize(), -1);
+ QCOMPARE(overlay.samples(), -1);
+ QCOMPARE(overlay.swapInterval(), -1);
+ QCOMPARE(overlay.plane(), 1);
+ QVERIFY(!overlay.sampleBuffers());
+ QVERIFY(!overlay.doubleBuffer());
+ QVERIFY(!overlay.depth());
+ QVERIFY(!overlay.rgba());
+ QVERIFY(!overlay.alpha());
+ QVERIFY(!overlay.accum());
+ QVERIFY(!overlay.stencil());
+ QVERIFY(!overlay.stereo());
+ QVERIFY(overlay.directRendering()); // Only option that should be on.
+ QVERIFY(!overlay.hasOverlay()); // Overlay doesn't need an overlay!
+
+ // Modify the default overlay format and check that it was changed.
+ QGLFormat::setDefaultOverlayFormat(format1);
+ QVERIFY(QGLFormat::defaultOverlayFormat() == format1);
+
+ // Restore the default overlay format.
+ QGLFormat::setDefaultOverlayFormat(overlay);
+ QVERIFY(QGLFormat::defaultOverlayFormat() == overlay);
+
MyGLContext obj2(obj1);
// bool QGLContext::windowCreated()
// void QGLContext::setWindowCreated(bool)