diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qproperty')
-rw-r--r-- | tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 488ecacb8d..8894260988 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -68,6 +68,7 @@ private slots: void genericPropertyBinding(); void genericPropertyBindingBool(); void staticChangeHandler(); + void setBindingFunctor(); }; void tst_QProperty::functorBinding() @@ -674,6 +675,17 @@ void tst_QProperty::staticChangeHandler() QCOMPARE(t.observedValues, values); } +void tst_QProperty::setBindingFunctor() +{ + QProperty<int> property; + QProperty<int> injectedValue(100); + // Make sure that this picks the setBinding overload that takes a functor and + // moves it correctly. + property.setBinding([&injectedValue]() { return injectedValue.value(); }); + injectedValue = 200; + QCOMPARE(property.value(), 200); +} + QTEST_MAIN(tst_QProperty); #include "tst_qproperty.moc" |