summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-24 05:06:56 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-24 05:06:56 (GMT)
commita2a8cea2835ef24104fe784b6ce0f508cc5637c0 (patch)
tree80f6ad699172cb436c0d159472f8203fd5430ad4 /tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
parent7c76abb0dc4204043bec9b6fa315f9753a7986ae (diff)
downloadQt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.zip
Qt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.tar.gz
Qt-a2a8cea2835ef24104fe784b6ce0f508cc5637c0.tar.bz2
Automatically connect to a notify signal if the requested signal is
in the "onFooChanged" form, even if the notify signal is not called "fooChanged". Task-number: QT-2783
Diffstat (limited to 'tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index cb59f47..b177636 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -88,6 +88,7 @@ private slots:
void rootAsQmlComponent();
void inlineQmlComponents();
void idProperty();
+ void autoNotifyConnection();
void assignSignal();
void dynamicProperties();
void dynamicPropertiesNested();
@@ -511,6 +512,22 @@ void tst_qmllanguage::idProperty()
QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child));
}
+// Tests automatic connection to notify signals if "onBlahChanged" syntax is used
+// even if the notify signal for "blah" is not called "blahChanged"
+void tst_qmllanguage::autoNotifyConnection()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("autoNotifyConnection.qml"));
+ VERIFY_ERRORS(0);
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify"));
+ QVERIFY(prop.isValid());
+
+ QCOMPARE(prop.read(object), QVariant::fromValue(false));
+ object->setPropertyWithNotify(1);
+ QCOMPARE(prop.read(object), QVariant::fromValue(true));
+}
+
// Tests that signals can be assigned to
void tst_qmllanguage::assignSignal()
{