summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"