diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-27 15:57:23 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-27 15:58:43 (GMT) |
commit | f93097671f512f38790ba2d56bd5b1e037810266 (patch) | |
tree | a4dd9aa09a8ca658bb9a46da26472ee0c5f317da /tests/auto/qspinbox | |
parent | 19d0a365dd99dc1a108e58949f7d0f49bac72623 (diff) | |
parent | 583b1529894aca5e9ffa353f0547dfb4b8b0ab21 (diff) | |
download | Qt-f93097671f512f38790ba2d56bd5b1e037810266.zip Qt-f93097671f512f38790ba2d56bd5b1e037810266.tar.gz Qt-f93097671f512f38790ba2d56bd5b1e037810266.tar.bz2 |
Merge commit oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'tests/auto/qspinbox')
-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" |