diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-09-30 17:17:49 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-12 04:38:36 +0200 |
commit | b3f9f53ff12d7fd5fc5b667c6a58169d5de06939 (patch) | |
tree | f7a4cd5e3ad60e23955ecea351fa99bebd6c1173 /tests/auto/declarative/qsgtextinput | |
parent | fee823ed6adc77db563468539b47b9d10e02e5c8 (diff) |
Provide a context when constructing a TextInput cursor delegate.
Without a context the delegate won't be able to refer to any external
properties.
Task-number: QTBUG-21780
Change-Id: I7171787e677ce67466b311796693ed88bcacb718
Reviewed-on: http://codereview.qt-project.org/5837
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qsgtextinput')
-rw-r--r-- | tests/auto/declarative/qsgtextinput/data/cursorTest.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsgtextinput/data/cursorTest.qml b/tests/auto/declarative/qsgtextinput/data/cursorTest.qml index 01858fba77..71a420ee7c 100644 --- a/tests/auto/declarative/qsgtextinput/data/cursorTest.qml +++ b/tests/auto/declarative/qsgtextinput/data/cursorTest.qml @@ -1,8 +1,9 @@ import QtQuick 2.0 -Rectangle { width: 300; height: 300; color: "white" +Rectangle { id:rect; width: 300; height: 300; color: "white" + property string contextualProperty: "Hello" TextInput { text: "Hello world!"; id: textInputObject; objectName: "textInputObject" - resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance";} } ] + resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance"; property string localProperty: contextualProperty } } ] cursorDelegate: cursor } } diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 26638c14aa..b2960dd4c4 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -1742,6 +1742,7 @@ void tst_qsgtextinput::cursorDelegate() textInputObject->setFocus(true); QSGItem* delegateObject = textInputObject->findChild<QSGItem*>("cursorInstance"); QVERIFY(delegateObject); + QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved for(int i=0; i<= textInputObject->text().length(); i++){ textInputObject->setCursorPosition(i); |