diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2013-12-02 13:08:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-05 23:57:53 +0100 |
commit | b9c8073230dfd90962188a24f78d4f4157f9eaad (patch) | |
tree | 63bedf8b1778417cf1088d1343db3814c686296b /tests/auto/widgets/widgets/qspinbox | |
parent | eb7b140d6d2d1aba9459fd717f5abe5794acba68 (diff) |
QSpinBox: allow positive values to be entered with the '+' prefix.
The code was there to do it, but it was using minimumValue instead of
maximumValue to test if the '+' should be allowed.
Task-number: QTBUG-20691
[ChangeLog][QtWidgets][QSpinBox] Entering positive values with the '+'
prefix is now allowed.
Change-Id: Iff62d073e350dc9a33b7e06e4b492048c74437c4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/widgets/widgets/qspinbox')
-rw-r--r-- | tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 004fdda5ef..a21f2d70a0 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -142,6 +142,8 @@ private slots: void taskQTBUG_5008_textFromValueAndValidate(); void lineEditReturnPressed(); + + void positiveSign(); public slots: void valueChangedHelper(const QString &); void valueChangedHelper(int); @@ -1111,5 +1113,20 @@ void tst_QSpinBox::lineEditReturnPressed() QCOMPARE(spyCurrentChanged.count(), 1); } +void tst_QSpinBox::positiveSign() +{ + QSpinBox spinBox; + spinBox.setRange(-20, 20); + spinBox.setValue(-20); + spinBox.show(); + QVERIFY(QTest::qWaitForWindowActive(&spinBox)); + + QTest::keyClick(&spinBox, Qt::Key_End, Qt::ShiftModifier); + QTest::keyClick(&spinBox, Qt::Key_Plus, Qt::ShiftModifier); + QTest::keyClick(&spinBox, Qt::Key_2); + QTest::keyClick(&spinBox, Qt::Key_0); + QCOMPARE(spinBox.text(), QLatin1String("+20")); +} + QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" |