diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-15 23:09:31 (GMT) |
commit | 5aa1cbcdacd19b2e526e358eddac1b7d55a994b5 (patch) | |
tree | 4aba78405e3d98081662fcb934f673acd1b79d42 /tests/auto/qvariant/tst_qvariant.cpp | |
parent | 8592bcc80b7ec245b485fa54f8bd41c4484e93e0 (diff) | |
parent | 7e4a9187bb11b794e45d95d2e9fae026d6b0d07d (diff) | |
download | Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.zip Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.gz Qt-5aa1cbcdacd19b2e526e358eddac1b7d55a994b5.tar.bz2 |
Merge remote branch 'origin/4.8' into qa-review-master
Conflicts:
tests/auto/qaccessibility/tst_qaccessibility.cpp
tests/auto/qsslsocket/tst_qsslsocket.cpp
Diffstat (limited to 'tests/auto/qvariant/tst_qvariant.cpp')
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 8d4b056..af70c9e 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -275,6 +275,8 @@ private slots: void variantInVariant(); void colorInteger(); + + void forwardDeclare(); }; Q_DECLARE_METATYPE(QDate) @@ -2660,7 +2662,10 @@ void tst_QVariant::qvariant_cast_QObject_data() { QTest::addColumn<QVariant>("data"); QTest::addColumn<bool>("success"); - QTest::newRow("from QObject") << QVariant(QMetaType::QObjectStar, new QObject(this)) << true; + QObject *obj = new QObject(this); + obj->setObjectName(QString::fromLatin1("Hello")); + QTest::newRow("from QObject") << QVariant(QMetaType::QObjectStar, &obj) << true; + QTest::newRow("from QObject2") << QVariant::fromValue(obj) << true; QTest::newRow("from String") << QVariant(QLatin1String("1, 2, 3")) << false; QTest::newRow("from int") << QVariant((int) 123) << false; } @@ -2672,6 +2677,9 @@ void tst_QVariant::qvariant_cast_QObject() { QObject *o = qvariant_cast<QObject *>(data); QCOMPARE(o != 0, success); + if (success) { + QCOMPARE(o->objectName(), QString::fromLatin1("Hello")); + } } Q_DECLARE_METATYPE(qint8); @@ -3439,5 +3447,16 @@ void tst_QVariant::colorInteger() QCOMPARE(v.value<QColor>(), QColor(Qt::yellow)); } +class Forward; +Q_DECLARE_METATYPE(Forward*); + +void tst_QVariant::forwardDeclare() +{ + Forward *f = 0; + QVariant v = QVariant::fromValue(f); + QCOMPARE(qvariant_cast<Forward*>(v), f); +} + + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" |