diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-06 03:40:25 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-06 03:40:25 (GMT) |
commit | 63711cb855114b879c6bad192708bf6a19c31f32 (patch) | |
tree | 02a0cba8fdceb031afa39a93c18970884aa80bf2 /tests | |
parent | 7acefef29430532a95c5fe7a11578c03bb820fae (diff) | |
parent | 5203b315aae66ada8ced60fbce3064ad92551848 (diff) | |
download | Qt-63711cb855114b879c6bad192708bf6a19c31f32.zip Qt-63711cb855114b879c6bad192708bf6a19c31f32.tar.gz Qt-63711cb855114b879c6bad192708bf6a19c31f32.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
tst_qsharedpointer.cpp: fix compilation
Fix compilation with QT_NO_DEBUG_STREAM
QImage::fill() overloads that take QColor and Qt::GlobalColor
qmake: qmakeDeleteCacheClear() function can be template now
It is no longer necessary to check for QT_NO_MEMBER_TEMPLATES
It is no longer necessary to check for QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION
Fix MS Visual C++ 6.0 references in the documentation
Remove obsolete code & workarounds for unsupported versions of MS Visual C++
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/collections/tst_collections.cpp | 11 | ||||
-rw-r--r-- | tests/auto/qimage/tst_qimage.cpp | 113 | ||||
-rw-r--r-- | tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qobject/tst_qobject.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 28 |
7 files changed, 116 insertions, 54 deletions
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index d092c34..4ecd392 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -3447,27 +3447,16 @@ void tst_Collections::containerTypedefs() testSetContainerTypedefs(QSet<int>()); } -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) -class Key1 -{}; -class T1 -{}; -class T2 -{}; -#else class Key1; class T1; class T2; -#endif void tst_Collections::forwardDeclared() { { typedef QHash<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) } { typedef QMultiHash<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) } -#if !defined(Q_CC_MSVC_NET) || _MSC_VER >= 1310 { typedef QMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) } { typedef QMultiMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) } -#endif #if !defined(Q_CC_RVCT) // RVCT can't handle forward declared template parameters if those are used to declare // class members inside templated class. diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 517c1816..63320b2 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -59,6 +59,7 @@ #endif Q_DECLARE_METATYPE(QImage::Format) +Q_DECLARE_METATYPE(Qt::GlobalColor) class tst_QImage : public QObject { @@ -139,6 +140,11 @@ private slots: void premultipliedAlphaConsistency(); void compareIndexed(); + + void fillColor_data(); + void fillColor(); + + void fillColorWithAlpha(); }; tst_QImage::tst_QImage() @@ -1820,5 +1826,112 @@ void tst_QImage::compareIndexed() QCOMPARE(img, imgInverted); } +void tst_QImage::fillColor_data() +{ + QTest::addColumn<QImage::Format>("format"); + QTest::addColumn<Qt::GlobalColor>("color"); + QTest::addColumn<uint>("pixelValue"); + + QTest::newRow("Mono, color0") << QImage::Format_Mono << Qt::color0 << 0u; + QTest::newRow("Mono, color1") << QImage::Format_Mono << Qt::color1 << 1u; + + QTest::newRow("MonoLSB, color0") << QImage::Format_MonoLSB << Qt::color0 << 0u; + QTest::newRow("MonoLSB, color1") << QImage::Format_MonoLSB << Qt::color1 << 1u; + + const char *names[] = { + "Indexed8", + "RGB32", + "ARGB32", + "ARGB32pm", + "RGB16", + "ARGB8565pm", + "RGB666", + "ARGB6666pm", + "RGB555", + "ARGB8555pm", + "RGB888", + "RGB444", + "ARGB4444pm", + 0 + }; + + QImage::Format formats[] = { + QImage::Format_Indexed8, + QImage::Format_RGB32, + QImage::Format_ARGB32, + QImage::Format_ARGB32_Premultiplied, + QImage::Format_RGB16, + QImage::Format_ARGB8565_Premultiplied, + QImage::Format_RGB666, + QImage::Format_ARGB6666_Premultiplied, + QImage::Format_RGB555, + QImage::Format_ARGB8555_Premultiplied, + QImage::Format_RGB888, + QImage::Format_RGB444, + QImage::Format_ARGB4444_Premultiplied + }; + + for (int i=0; names[i] != 0; ++i) { + QByteArray name; + name.append(names[i]).append(", "); + + QTest::newRow(QByteArray(name).append("black").constData()) << formats[i] << Qt::black << 0xff000000; + QTest::newRow(QByteArray(name).append("white").constData()) << formats[i] << Qt::white << 0xffffffff; + QTest::newRow(QByteArray(name).append("red").constData()) << formats[i] << Qt::red << 0xffff0000; + QTest::newRow(QByteArray(name).append("green").constData()) << formats[i] << Qt::green << 0xff00ff00; + QTest::newRow(QByteArray(name).append("blue").constData()) << formats[i] << Qt::blue << 0xff0000ff; + } + + QTest::newRow("RGB16, transparent") << QImage::Format_RGB16 << Qt::transparent << 0xff000000; + QTest::newRow("RGB32, transparent") << QImage::Format_RGB32 << Qt::transparent << 0xff000000; + QTest::newRow("ARGB32, transparent") << QImage::Format_ARGB32 << Qt::transparent << 0x00000000u; + QTest::newRow("ARGB32pm, transparent") << QImage::Format_ARGB32_Premultiplied << Qt::transparent << 0x00000000u; +} + +void tst_QImage::fillColor() +{ + QFETCH(QImage::Format, format); + QFETCH(Qt::GlobalColor, color); + QFETCH(uint, pixelValue); + + QImage image(1, 1, format); + + if (image.depth() == 8) { + QVector<QRgb> table; + table << 0xff000000; + table << 0xffffffff; + table << 0xffff0000; + table << 0xff00ff00; + table << 0xff0000ff; + image.setColorTable(table); + } + + image.fill(color); + if (image.depth() == 1) { + QCOMPARE(image.pixelIndex(0, 0), (int) pixelValue); + } else { + QCOMPARE(image.pixel(0, 0), pixelValue); + } + + image.fill(QColor(color)); + if (image.depth() == 1) { + QCOMPARE(image.pixelIndex(0, 0), (int) pixelValue); + } else { + QCOMPARE(image.pixel(0, 0), pixelValue); + } +} + +void tst_QImage::fillColorWithAlpha() +{ + QImage argb32(1, 1, QImage::Format_ARGB32); + argb32.fill(QColor(255, 0, 0, 127)); + QCOMPARE(argb32.pixel(0, 0), qRgba(255, 0, 0, 127)); + + QImage argb32pm(1, 1, QImage::Format_ARGB32_Premultiplied); + argb32pm.fill(QColor(255, 0, 0, 127)); + QCOMPARE(argb32pm.pixel(0, 0), 0x7f7f0000u); +} + + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp index 5709196..22c679a 100644 --- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp @@ -2822,10 +2822,9 @@ void tst_QMatrixNxN::convertGeneric() 9.0f, 10.0f, 11.0f, 12.0f, 0.0f, 0.0f, 0.0f, 1.0f }; -#if !defined(QT_NO_MEMBER_TEMPLATES) QMatrix4x4 m4(m1); QVERIFY(isSame(m4, unique4x4)); -#endif + QMatrix4x4 m5 = qGenericMatrixToMatrix4x4(m1); QVERIFY(isSame(m5, unique4x4)); @@ -2835,10 +2834,9 @@ void tst_QMatrixNxN::convertGeneric() 9.0f, 10.0f, 11.0f, 12.0f }; QMatrix4x4 m9(uniqueValues4); -#if !defined(QT_NO_MEMBER_TEMPLATES) + QMatrix4x3 m10 = m9.toGenericMatrix<4, 3>(); QVERIFY(isSame(m10, conv4x4)); -#endif QMatrix4x3 m11 = qGenericMatrixFromMatrix4x4<4, 3>(m9); QVERIFY(isSame(m11, conv4x4)); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 5caac15..fc38a84 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -669,11 +669,9 @@ void tst_QObject::findChildren() l = qFindChildren<QObject*>(&o, "unnamed"); QCOMPARE(l.size(), 0); -#ifndef QT_NO_MEMBER_TEMPLATES tl = o.findChildren<QTimer *>("t1"); QCOMPARE(tl.size(), 1); QCOMPARE(tl.at(0), &t1); -#endif } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 81fb749..04b2627 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1909,7 +1909,6 @@ void tst_QScriptEngine::valueConversion() QString snum = qScriptValueToValue<QString>(num); QCOMPARE(snum, QLatin1String("123")); } -#ifndef QT_NO_MEMBER_TEMPLATES { QScriptValue num = eng.toScriptValue(123); QCOMPARE(num.isNumber(), true); @@ -1921,7 +1920,6 @@ void tst_QScriptEngine::valueConversion() QString snum = eng.fromScriptValue<QString>(num); QCOMPARE(snum, QLatin1String("123")); } -#endif { QScriptValue num(&eng, 123); QCOMPARE(qScriptValueToValue<char>(num), char(123)); diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 6b4904f..5e624e4 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -732,7 +732,6 @@ void tst_QSharedPointer::objectCast() ptr = baseptr.objectCast<OtherObject>(); QVERIFY(ptr == data); -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION // again: ptr = qobject_cast<OtherObject *>(baseptr); QVERIFY(ptr == data); @@ -740,7 +739,6 @@ void tst_QSharedPointer::objectCast() // again: ptr = qobject_cast<QSharedPointer<OtherObject> >(baseptr); QVERIFY(ptr == data); -#endif } check(); @@ -760,7 +758,6 @@ void tst_QSharedPointer::objectCast() ptr = baseptr.objectCast<const OtherObject>(); QVERIFY(ptr == data); -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION // again: ptr = qobject_cast<const OtherObject *>(baseptr); QVERIFY(ptr == data); @@ -768,7 +765,6 @@ void tst_QSharedPointer::objectCast() // again: ptr = qobject_cast<QSharedPointer<const OtherObject> >(baseptr); QVERIFY(ptr == data); -#endif } check(); @@ -802,7 +798,6 @@ void tst_QSharedPointer::objectCast() QSharedPointer<OtherObject> otherptr = qSharedPointerObjectCast<OtherObject>(weakptr); QVERIFY(otherptr.isNull()); -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION // again: otherptr = qobject_cast<OtherObject *>(weakptr); QVERIFY(otherptr.isNull()); @@ -810,7 +805,6 @@ void tst_QSharedPointer::objectCast() // again: otherptr = qobject_cast<QSharedPointer<OtherObject> >(weakptr); QVERIFY(otherptr.isNull()); -#endif } check(); } @@ -1736,12 +1730,10 @@ void tst_QSharedPointer::invalidConstructs_data() << &QTest::QExternalTest::tryCompileFail << "QSharedPointer<const QObject> baseptr = QSharedPointer<const QObject>(new QObject);\n" "qSharedPointerObjectCast<QCoreApplication>(baseptr);"; -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION QTest::newRow("const-dropping-object-cast2") << &QTest::QExternalTest::tryCompileFail << "QSharedPointer<const QObject> baseptr = QSharedPointer<const QObject>(new QObject);\n" "qobject_cast<QCoreApplication *>(baseptr);"; -#endif // arithmethics through automatic cast operators QTest::newRow("arithmethic1") diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f722f89..2413888 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -456,23 +456,15 @@ void tst_QWidget::getSetCheck() QCOMPARE(obj1.minimumWidth(), 0); // A widgets width can never be less than 0 obj1.setMinimumWidth(INT_MAX); #ifndef Q_WS_QWS //QWS doesn't allow toplevels to be bigger than the screen -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)obj1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#else QCOMPARE(obj1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium #endif -#endif child1.setMinimumWidth(0); QCOMPARE(child1.minimumWidth(), 0); child1.setMinimumWidth(INT_MIN); QCOMPARE(child1.minimumWidth(), 0); // A widgets width can never be less than 0 child1.setMinimumWidth(INT_MAX); -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)child1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#else QCOMPARE(child1.minimumWidth(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#endif // int QWidget::minimumHeight() // void QWidget::setMinimumHeight(int) @@ -482,38 +474,24 @@ void tst_QWidget::getSetCheck() QCOMPARE(obj1.minimumHeight(), 0); // A widgets height can never be less than 0 obj1.setMinimumHeight(INT_MAX); #ifndef Q_WS_QWS //QWS doesn't allow toplevels to be bigger than the screen -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)obj1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#else QCOMPARE(obj1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium #endif -#endif child1.setMinimumHeight(0); QCOMPARE(child1.minimumHeight(), 0); child1.setMinimumHeight(INT_MIN); QCOMPARE(child1.minimumHeight(), 0); // A widgets height can never be less than 0 child1.setMinimumHeight(INT_MAX); -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)child1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#else QCOMPARE(child1.minimumHeight(), QWIDGETSIZE_MAX); // The largest minimum size should only be as big as the maximium -#endif - - -// int QWidget::maximumWidth() + // int QWidget::maximumWidth() // void QWidget::setMaximumWidth(int) obj1.setMaximumWidth(0); QCOMPARE(obj1.maximumWidth(), 0); obj1.setMaximumWidth(INT_MIN); QCOMPARE(obj1.maximumWidth(), 0); // A widgets width can never be less than 0 obj1.setMaximumWidth(INT_MAX); -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)obj1.maximumWidth(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX -#else QCOMPARE(obj1.maximumWidth(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX -#endif // int QWidget::maximumHeight() // void QWidget::setMaximumHeight(int) @@ -522,11 +500,7 @@ void tst_QWidget::getSetCheck() obj1.setMaximumHeight(INT_MIN); QCOMPARE(obj1.maximumHeight(), 0); // A widgets height can never be less than 0 obj1.setMaximumHeight(INT_MAX); -#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - QCOMPARE((long)obj1.maximumHeight(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX -#else QCOMPARE(obj1.maximumHeight(), QWIDGETSIZE_MAX); // QWIDGETSIZE_MAX is the abs max, not INT_MAX -#endif // back to normal obj1.setMinimumWidth(0); |