diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-11-29 22:58:27 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-11-29 22:58:27 (GMT) |
commit | 1fe08312164a8eef87b3efe9b77452b86224999f (patch) | |
tree | 65d3147ae69860d9031ffaa86dcdd28f5d5fca21 /tests/auto/qspinbox/tst_qspinbox.cpp | |
parent | 10b5653ad4f25c6f37d640facf4a5ef01fe25926 (diff) | |
parent | c2c31f30830a4e1e455a13321dd7bae6ac8b360f (diff) | |
download | Qt-1fe08312164a8eef87b3efe9b77452b86224999f.zip Qt-1fe08312164a8eef87b3efe9b77452b86224999f.tar.gz Qt-1fe08312164a8eef87b3efe9b77452b86224999f.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto/qspinbox/tst_qspinbox.cpp')
-rw-r--r-- | tests/auto/qspinbox/tst_qspinbox.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 2389060..655de15 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -146,6 +146,8 @@ private slots: void sizeHint(); + void taskQTBUG_5008_textFromValueAndValidate(); + public slots: void valueChangedHelper(const QString &); void valueChangedHelper(int); @@ -1004,5 +1006,38 @@ void tst_QSpinBox::sizeHint() delete widget; } +void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() +{ + class DecoratedSpinBox : public QSpinBox + { + public: + DecoratedSpinBox() + { + setLocale(QLocale::French); + setMaximum(100000000); + setValue(1000000); + } + + //we use the French delimiters here + QString textFromValue (int value) const + { + return locale().toString(value); + } + + using QSpinBox::lineEdit; + } spinbox; + spinbox.show(); + spinbox.activateWindow(); + spinbox.setFocus(); + QTest::qWaitForWindowShown(&spinbox); + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); + spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator + QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QCOMPARE(spinbox.value(), 10000000); //it's been multiplied by 10 + spinbox.clearFocus(); //make sure the value is correctly formatted + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); +} + + QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" |