From b9c8073230dfd90962188a24f78d4f4157f9eaad Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 2 Dec 2013 13:08:37 +0100 Subject: 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 --- tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') 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" -- cgit v1.2.3