diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qproperty')
-rw-r--r-- | tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index d4c5741814..cc04c2f1b5 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -67,6 +67,7 @@ private slots: void settingPropertyValueDoesRemoveBinding(); void genericPropertyBinding(); void genericPropertyBindingBool(); + void staticChangeHandler(); }; void tst_QProperty::functorBinding() @@ -658,6 +659,25 @@ void tst_QProperty::genericPropertyBindingBool() QVERIFY(property.value()); } +struct ItemType +{ + QProperty<int> x; + QVector<int> observedValues; + void xChanged() { + observedValues << x.value(); + } + QPropertyMemberChangeHandler<&ItemType::x, &ItemType::xChanged> test{this}; +}; + +void tst_QProperty::staticChangeHandler() +{ + ItemType t; + t.x = 42; + t.x = 100; + QVector<int> values{42, 100}; + QCOMPARE(t.observedValues, values); +} + QTEST_MAIN(tst_QProperty); #include "tst_qproperty.moc" |