aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:29 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:29 +0200
commitf5701f0def37fcc0c2b38ae9552eb3a896a34687 (patch)
treeaa9a7ebb39bedb6794f199d94525f5ddfb696308 /tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
parentda0aac1057552048f59075beb31861a6cc076684 (diff)
parente24effdceb3a504182ae271200408750991aa94a (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Diffstat (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp')
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 5363cc8fcb..4032a4448d 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -1943,7 +1943,8 @@ void tst_qqmlproperty::copy()
{
PropertyObject object;
- QQmlProperty *property = new QQmlProperty(&object, QLatin1String("defaultProperty"));
+ QScopedPointer<QQmlProperty> property(
+ new QQmlProperty(&object, QLatin1String("defaultProperty")));
QCOMPARE(property->name(), QString("defaultProperty"));
QCOMPARE(property->read(), QVariant(10));
QCOMPARE(property->type(), QQmlProperty::Property);
@@ -1966,7 +1967,7 @@ void tst_qqmlproperty::copy()
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
QCOMPARE(p2.propertyType(), (int)QVariant::Int);
- delete property; property = nullptr;
+ property.reset();
QCOMPARE(p1.name(), QString("defaultProperty"));
QCOMPARE(p1.read(), QVariant(10));
@@ -1979,6 +1980,16 @@ void tst_qqmlproperty::copy()
QCOMPARE(p2.type(), QQmlProperty::Property);
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+
+ p1 = QQmlProperty();
+ QQmlPropertyPrivate *p2d = QQmlPropertyPrivate::get(p2);
+ QCOMPARE(p2d->count(), 1);
+
+ // Use a pointer to avoid compiler warning about self-assignment.
+ QQmlProperty *p2p = &p2;
+ *p2p = p2;
+
+ QCOMPARE(p2d->count(), 1);
}
void tst_qqmlproperty::noContext()