diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-29 11:18:36 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-30 09:27:50 +0200 |
commit | 8572f8446763116e4c28c6906c914e2d9b269147 (patch) | |
tree | f5d59b1ed3f6472e55cc4cbef952537a226da0c6 /tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | |
parent | d90647b26a95d88b57fa9e3fec3a821efb226de2 (diff) |
Fix ChangeHandler notification for eager properties
ChangeHandler's evaluated the binding to detect if the value actually
changed. This is a valid strategy for lazy bindings, but eager bindings
were already evaluated at that point, and thus the change would not be
detected.
Change the binding loop test, so that there isn't a fixpoint in the
binding loop, and we can still detect it. Changing the binding loop
detection code to deal with this case is left as an exercise for the
future.
Change-Id: Ia5d9ce2cd98a5780e69c993b5824024eb186c154
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 565916b781..344ced9101 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -432,7 +432,7 @@ class BindingLoopTester : public QObject public: BindingLoopTester(QProperty<int> *i, QObject *parent = nullptr) : QObject(parent) { eagerData.setBinding(Qt::makePropertyBinding([&](){ return eagerData2.value() + i->value(); } ) ); - eagerData2.setBinding(Qt::makePropertyBinding([&](){ return eagerData.value(); } ) ); + eagerData2.setBinding(Qt::makePropertyBinding([&](){ return eagerData.value() + 1; } ) ); i->setValue(42); } @@ -532,7 +532,6 @@ void tst_QProperty::realloc() tester.bindableProp3().setBinding([&](){return tester.prop5();}); tester.bindableProp4().setBinding([&](){return tester.prop5();}); tester.bindableProp5().setBinding([&]() -> int{return 42;}); - QEXPECT_FAIL("", "ChangeHandler bug with eager properties", Continue); QCOMPARE(modificationCount, 2); } }; |