summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgl
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-01-04 09:44:03 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-01-04 09:50:10 (GMT)
commit81d06f72cb84485847f963ba1dfea662e51096e4 (patch)
tree991cda4786f2a50275f3780492a06f08205fe336 /tests/auto/qgl
parent5356d3717a9355830a13dfa0c8726f86a5f1c522 (diff)
downloadQt-81d06f72cb84485847f963ba1dfea662e51096e4.zip
Qt-81d06f72cb84485847f963ba1dfea662e51096e4.tar.gz
Qt-81d06f72cb84485847f963ba1dfea662e51096e4.tar.bz2
Fixed QGLFormat::operator== to handle new fields.
When I added new fields to QGLFormat in commit 592dc597, I forgot to update operator==. It has now been fixed and the auto-test updated. Reviewed-by: Trond
Diffstat (limited to 'tests/auto/qgl')
-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 532e550..7cda35d 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -425,6 +425,26 @@ void tst_QGL::getSetCheck()
obj1.setPlane(TEST_INT_MAX);
QCOMPARE(TEST_INT_MAX, obj1.plane());
+ // int QGLFormat::major/minorVersion()
+ // void QGLFormat::setVersion(int, int)
+ QCOMPARE(obj1.majorVersion(), 1);
+ QCOMPARE(obj1.minorVersion(), 0);
+ obj1.setVersion(3, 2);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setVersion: Cannot set zero or negative version number 0.1");
+ obj1.setVersion(0, 1);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setVersion: Cannot set zero or negative version number 3.-1");
+ obj1.setVersion(3, -1);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ obj1.setVersion(TEST_INT_MAX, TEST_INT_MAX - 1);
+ QCOMPARE(obj1.majorVersion(), TEST_INT_MAX);
+ QCOMPARE(obj1.minorVersion(), TEST_INT_MAX - 1);
+
+
// operator== and operator!= for QGLFormat
QGLFormat format1;
QGLFormat format2;
@@ -508,6 +528,27 @@ void tst_QGL::getSetCheck()
QVERIFY(format1 == format2);
QVERIFY(!(format1 != format2));
+ format1.setVersion(3, 2);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setVersion(3, 2);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
+ format1.setProfile(QGLFormat::CoreProfile);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setProfile(QGLFormat::CoreProfile);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
+ format1.setOption(QGL::NoDeprecatedFunctions);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setOption(QGL::NoDeprecatedFunctions);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
// Copy constructor and assignment for QGLFormat.
QGLFormat format3(format1);
QGLFormat format4;