aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-06-21 16:44:30 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-04 03:35:18 +0200
commita1ea8f59e650c6be3e14274b36b1197245e96067 (patch)
tree6672ec00f4a5ca00588a7cd054189ccfe979f482 /tests
parentf18b66ac6cfc734d217ec9d44876774f25e5d900 (diff)
Refresh the TextInput.acceptableInput property when validator changes.
Task-number: QTBUG-26260 Change-Id: I404640d9a2f000976887dcc2119f971c17a71c7e Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 73cf2d3aaa..d2d8d5ad14 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -2031,6 +2031,16 @@ void tst_qquicktextinput::validators()
QCOMPARE(dblInput->hasAcceptableInput(), true);
QCOMPARE(dblSpy.count(), 3);
+ // Changing the validator properties will re-evaluate whether the input is acceptable.
+ intValidator->setTop(10);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblSpy.count(), 4);
+ intValidator->setTop(12);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblSpy.count(), 5);
+
QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(canvas.rootObject()->property("strInput")));
QVERIFY(strInput);
QSignalSpy strSpy(strInput, SIGNAL(acceptableInputChanged()));