diff options
Diffstat (limited to 'tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp')
-rw-r--r-- | tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index cb4bee0d3a..d9cb6673df 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -71,6 +71,7 @@ private slots: void outerContextObject(); void contextObjectHierarchy(); + void destroyContextProperty(); private: QQmlEngine engine; @@ -892,6 +893,20 @@ void tst_qqmlcontext::contextObjectHierarchy() }); } +void tst_qqmlcontext::destroyContextProperty() +{ + QQmlEngine engine; + QQmlContext context(&engine); + + { + QObject object; + context.setContextProperty(QLatin1String("a"), &object); + QCOMPARE(qvariant_cast<QObject *>(context.contextProperty(QLatin1String("a"))), &object); + } + + QCOMPARE(qvariant_cast<QObject *>(context.contextProperty(QLatin1String("a"))), nullptr); +} + QTEST_MAIN(tst_qqmlcontext) #include "tst_qqmlcontext.moc" |