summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-11-29 11:37:30 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2013-11-29 11:38:28 +0100
commit8e04691543ae3906e011f47d446ac7a94034259e (patch)
tree9cf166dcef514bbc965d570121d0b3022aad27da /tests/auto/corelib
parentad684ff2a7d91a948ad9d2f3765dd08c78d81020 (diff)
parent7d5448d9e2ae4d2d10c0cff867cf34b315336feb (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'tests/auto/corelib')
-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);