aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-08-01 18:26:57 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-02 04:55:55 +0200
commitaa0448cf1882ddb6e4a959718a6fcc399c36990b (patch)
treea8153bc3786f0eca518d9807e61a52618a83fefd /tests
parent0412055322cf44c1127246ff817ab7a75b735680 (diff)
Allow custom parser types to still get signal handlers generated
Specifically, QDeclarativeListModelParser ought to have this behaviour. Task-number: QTBUG-19763 Change-Id: I9d6ee07d1e17a027b254b87d20d1a93795c55744 Reviewed-on: http://codereview.qt.nokia.com/2431 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml8
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp13
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml b/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml
new file mode 100644
index 0000000000..750d99c5a3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/signalhandlers.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+ListModel{
+ property bool ok: false
+ property int foo: 5
+ onFooChanged: ok = true
+ Component.onCompleted: foo = 6
+}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index fd68933997..946a3a5692 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -107,6 +107,7 @@ private slots:
void property_changes_worker();
void property_changes_worker_data();
void clear();
+ void signal_handlers();
};
int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName)
@@ -1192,6 +1193,18 @@ void tst_qdeclarativelistmodel::clear()
QCOMPARE(model.toString(roles[2]), QString("propertyC"));
}
+void tst_qdeclarativelistmodel::signal_handlers()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/signalhandlers.qml"));
+ QObject *model = component.create();
+ QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
+ QVERIFY(model != 0);
+ QVERIFY(model->property("ok").toBool());
+
+ delete model;
+}
+
QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"