From 672c533bde2899baad3eb29b6a807870abb8bf25 Mon Sep 17 00:00:00 2001 From: Alex Montgomery Date: Fri, 15 Aug 2014 09:41:56 -0700 Subject: Fix setContextObject to re-evaluate bindings Fix QQmlContext::setContextObject to reevaluate bindings as the documentation says that it should. Task-number: QTBUG-40798 Change-Id: Ifbd97c7a07a5432f4948937da863370b05705206 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 147887109f..e9c031a894 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -401,6 +401,18 @@ void tst_qqmlcontext::setContextObject() delete obj; } + + // Change of context object + ctxt.setContextProperty("c", QVariant(30)); + TestObject to2; + to2.setA(10); + to2.setB(20); + to2.setC(40); + ctxt.setContextObject(&to2); + + TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(10)); + TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(20)); + TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(30)); } void tst_qqmlcontext::destruction() -- cgit v1.2.3