summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-23 03:06:22 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-23 03:06:22 (GMT)
commit23316b14f28eb1b135b6e8e90fa6fdb34dc39b59 (patch)
tree3a8d1b576c7b5b191b37ec6457aa97a243827aad
parentc151647c01dd8034ee77a00520430cfb516a6a38 (diff)
downloadQt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.zip
Qt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.tar.gz
Qt-23316b14f28eb1b135b6e8e90fa6fdb34dc39b59.tar.bz2
Fix but in QmlMetaProperty assignment operator
QTBUG-8166
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp2
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp43
2 files changed, 45 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 332d126..1742c43 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -378,7 +378,9 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
d->object = other.d->object;
d->isDefaultProperty = other.d->isDefaultProperty;
+ d->isNameCached = other.d->isNameCached;
d->core = other.d->core;
+ d->nameCache = other.d->nameCache;
d->valueType = other.d->valueType;
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"