diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-23 03:06:22 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-23 03:06:22 (GMT) |
commit | 23316b14f28eb1b135b6e8e90fa6fdb34dc39b59 (patch) | |
tree | 3a8d1b576c7b5b191b37ec6457aa97a243827aad /tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp | |
parent | c151647c01dd8034ee77a00520430cfb516a6a38 (diff) | |
download | Qt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.zip Qt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.tar.gz Qt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.tar.bz2 |
Fix but in QmlMetaProperty assignment operator
QTBUG-8166
Diffstat (limited to 'tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp')
-rw-r--r-- | tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index b763b6e..c289641 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -121,6 +121,7 @@ private slots: // Bugs void crashOnValueProperty(); + void copy(); private: QmlEngine engine; }; @@ -1131,6 +1132,48 @@ void tst_qmlmetaproperty::crashOnValueProperty() QCOMPARE(p.read(), QVariant(20)); } +void tst_qmlmetaproperty::copy() +{ + PropertyObject object; + + QmlMetaProperty *property = new QmlMetaProperty(&object, QLatin1String("defaultProperty")); + QCOMPARE(property->name(), QString("defaultProperty")); + QCOMPARE(property->read(), QVariant(10)); + QCOMPARE(property->type(), QmlMetaProperty::Property); + QCOMPARE(property->propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(property->propertyType(), (int)QVariant::Int); + + QmlMetaProperty p1(*property); + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QmlMetaProperty::Property); + QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QmlMetaProperty p2(&object, QLatin1String("url")); + QCOMPARE(p2.name(), QString("url")); + p2 = *property; + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QmlMetaProperty::Property); + QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); + + delete property; property = 0; + + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QmlMetaProperty::Property); + QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QmlMetaProperty::Property); + QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); +} + QTEST_MAIN(tst_qmlmetaproperty) #include "tst_qmlmetaproperty.moc" |