diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
commit | f6dbdd9c16166f345fd5743886229192c97c2c4f (patch) | |
tree | 05e5e7b806dd627be4e3ba6fc9a32f115847acb0 /tests/auto/corelib/kernel/qobject/tst_qobject.cpp | |
parent | b8084618545570a8832d344a2e9586e1226cc697 (diff) | |
parent | 47efa9213d92a4366e03bd6d056837cd5bbadb1e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/sql/drivers/sqlite/qsql_sqlite.cpp
Change-Id: Ia7cffd2c99ae3d5eea6b5740683c06e921336dcd
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 38 |
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 e4804e6079..a7edbc1665 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -153,6 +153,7 @@ private slots: void connectBase(); void qmlConnect(); void exceptions(); + void noDeclarativeParentChangedOnDestruction(); }; struct QObjectCreatedOnShutdown @@ -6282,6 +6283,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); |