summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-01-18 13:04:21 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-25 00:58:12 +0100
commitc0d30db45ca0af9c3010097d8cd8b1ae92cf83ea (patch)
treec59524151ae121b13fd8995c7dc2016babfa96d4 /tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
parent4830b790fed26ce6b8f410c7fd068596eb81791a (diff)
Add a changed() signal to QValidator.
This provides a general notification of changes that may change the validity of previously validated input. Change-Id: I5ec6f127af60fdca68605fee903a08758bc01360 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp')
-rw-r--r--tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp b/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
index 1094f1a1b5..27ded409a5 100644
--- a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
+++ b/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
@@ -231,33 +231,53 @@ void tst_QIntValidator::validate()
void tst_QIntValidator::notifySignals()
{
+ QLocale::setDefault(QLocale("C"));
+
QIntValidator iv(0, 10, 0);
QSignalSpy topSpy(&iv, SIGNAL(topChanged(int)));
QSignalSpy bottomSpy(&iv, SIGNAL(bottomChanged(int)));
+ QSignalSpy changedSpy(&iv, SIGNAL(changed()));
+
iv.setTop(9);
QCOMPARE(topSpy.count(), 1);
+ QCOMPARE(changedSpy.count(), 1);
QVERIFY(iv.top() == 9);
iv.setBottom(1);
QCOMPARE(bottomSpy.count(), 1);
+ QCOMPARE(changedSpy.count(), 2);
QVERIFY(iv.bottom() == 1);
iv.setRange(1, 8);
QCOMPARE(topSpy.count(), 2);
QCOMPARE(bottomSpy.count(), 1);
+ QCOMPARE(changedSpy.count(), 3);
QVERIFY(iv.top() == 8);
QVERIFY(iv.bottom() == 1);
iv.setRange(2, 8);
QCOMPARE(topSpy.count(), 2);
QCOMPARE(bottomSpy.count(), 2);
+ QCOMPARE(changedSpy.count(), 4);
QVERIFY(iv.top() == 8);
QVERIFY(iv.bottom() == 2);
iv.setRange(3, 7);
QCOMPARE(topSpy.count(), 3);
QCOMPARE(bottomSpy.count(), 3);
+ QCOMPARE(changedSpy.count(), 5);
QVERIFY(iv.top() == 7);
QVERIFY(iv.bottom() == 3);
+
+ iv.setRange(3, 7);
+ QCOMPARE(topSpy.count(), 3);
+ QCOMPARE(bottomSpy.count(), 3);
+ QCOMPARE(changedSpy.count(), 5);
+
+ iv.setLocale(QLocale("C"));
+ QCOMPARE(changedSpy.count(), 5);
+
+ iv.setLocale(QLocale("en"));
+ QCOMPARE(changedSpy.count(), 6);
}
QTEST_MAIN(tst_QIntValidator)