summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-29 15:09:56 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-29 15:09:56 +0100
commit7079f1121325cedfb59c753870bd227a897ce6c7 (patch)
tree5b294835464ed6b00aa3eb59854cbae5a50c2e76 /tests
parentaf1dbfd2239c7834187f3a702fb2029dc78d4526 (diff)
parent8e04691543ae3906e011f47d446ac7a94034259e (diff)
Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index ece88d47e3..f1e04511cd 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -152,6 +152,7 @@ private slots:
void connectBase();
void qmlConnect();
void exceptions();
+ void noDeclarativeParentChangedOnDestruction();
};
struct QObjectCreatedOnShutdown
@@ -6233,6 +6234,43 @@ void tst_QObject::exceptions()
#endif
}
+#ifdef QT_BUILD_INTERNAL
+static bool parentChangeCalled = false;
+
+static void testParentChanged(QAbstractDeclarativeData *, QObject *, QObject *)
+{
+ parentChangeCalled = true;
+}
+#endif
+
+void tst_QObject::noDeclarativeParentChangedOnDestruction()
+{
+#ifdef QT_BUILD_INTERNAL
+ typedef void (*ParentChangedCallback)(QAbstractDeclarativeData *, QObject *, QObject *);
+ QScopedValueRollback<ParentChangedCallback> rollback(QAbstractDeclarativeData::parentChanged);
+ QAbstractDeclarativeData::parentChanged = testParentChanged;
+
+ QObject *parent = new QObject;
+ QObject *child = new QObject;
+
+ QAbstractDeclarativeData dummy;
+ QObjectPrivate::get(child)->declarativeData = &dummy;
+
+ parentChangeCalled = false;
+ child->setParent(parent);
+
+ QVERIFY(parentChangeCalled);
+ parentChangeCalled = false;
+
+ delete child;
+ QVERIFY(!parentChangeCalled);
+
+ delete parent;
+#else
+ QSKIP("Needs QT_BUILD_INTERNAL");
+#endif
+}
+
// Test for QtPrivate::HasQ_OBJECT_Macro
Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);