diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-01 01:11:22 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-01 01:11:22 (GMT) |
commit | b8cca95c0395369cdfb17c198aff085badcddd94 (patch) | |
tree | 2cfe9d363b0c272c81de5b9fa871c9aa69b1b9a7 /tests/auto/declarative/qdeclarativelanguage | |
parent | 62c23329fd61b016edbdc8dba758ca785a56fca7 (diff) | |
download | Qt-b8cca95c0395369cdfb17c198aff085badcddd94.zip Qt-b8cca95c0395369cdfb17c198aff085badcddd94.tar.gz Qt-b8cca95c0395369cdfb17c198aff085badcddd94.tar.bz2 |
Only emit change signal when variant properties actually change
QTBUG-12601
Diffstat (limited to 'tests/auto/declarative/qdeclarativelanguage')
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 16 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml new file mode 100644 index 0000000..e7aaf16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml @@ -0,0 +1,13 @@ +import Qt 4.7 + +QtObject { + property int notifyCount: 0 + + property variant foo + onFooChanged: notifyCount++ + + Component.onCompleted: { + foo = 1; + foo = 1; + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index fc78663..dc00e16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -142,8 +142,8 @@ private slots: void importsOrder(); void qmlAttachedPropertiesObjectMethod(); - void customOnProperty(); + void variantNotify(); // regression tests for crashes void crash1(); @@ -1685,6 +1685,20 @@ void tst_qdeclarativelanguage::customOnProperty() delete object; } +// QTBUG-12601 +void tst_qdeclarativelanguage::variantNotify() +{ + QDeclarativeComponent component(&engine, TEST_FILE("variantNotify.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("notifyCount").toInt(), 1); + + delete object; +} + void tst_qdeclarativelanguage::initTestCase() { registerTypes(); |