aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qv4mm/tst_qv4mm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qv4mm/tst_qv4mm.cpp')
-rw-r--r--tests/auto/qml/qv4mm/tst_qv4mm.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/auto/qml/qv4mm/tst_qv4mm.cpp b/tests/auto/qml/qv4mm/tst_qv4mm.cpp
index d8f4ed12e8..578a47d5fa 100644
--- a/tests/auto/qml/qv4mm/tst_qv4mm.cpp
+++ b/tests/auto/qml/qv4mm/tst_qv4mm.cpp
@@ -29,16 +29,23 @@
#include <qtest.h>
#include <QQmlEngine>
#include <QLoggingCategory>
+#include <QQmlComponent>
+
#include <private/qv4mm_p.h>
#include <private/qv4qobjectwrapper_p.h>
-class tst_qv4mm : public QObject
+#include "../../shared/util.h"
+
+#include <memory>
+
+class tst_qv4mm : public QQmlDataTest
{
Q_OBJECT
private slots:
void gcStats();
void multiWrappedQObjects();
+ void accessParentOnDestruction();
};
void tst_qv4mm::gcStats()
@@ -86,6 +93,21 @@ void tst_qv4mm::multiWrappedQObjects()
QCOMPARE(engine2.memoryManager->m_pendingFreedObjectWrapperValue.size(), 0);
}
+void tst_qv4mm::accessParentOnDestruction()
+{
+ QLoggingCategory::setFilterRules("qt.qml.gc.*=false");
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createdestroy.qml"));
+ std::unique_ptr<QObject> obj(component.create());
+ QVERIFY(obj);
+ QPointer<QObject> timer = qvariant_cast<QObject *>(obj->property("timer"));
+ QVERIFY(timer);
+ QTRY_VERIFY(!timer->property("running").toBool());
+ QCOMPARE(obj->property("iterations").toInt(), 100);
+ QCOMPARE(obj->property("creations").toInt(), 100);
+ QCOMPARE(obj->property("destructions").toInt(), 100);
+}
+
QTEST_MAIN(tst_qv4mm)
#include "tst_qv4mm.moc"