| 1073 | } |
| 1074 | |
| 1075 | void SpinBoxTest::numberSpinBoxScrollingNegToPos2() { |
| 1076 | NumberSpinBox sb; |
| 1077 | sb.setMinimum(-10); |
| 1078 | sb.setValue(0.13); |
| 1079 | QCOMPARE(sb.lineEdit()->text(), QStringLiteral("0.13")); |
| 1080 | |
| 1081 | sb.lineEdit()->setCursorPosition(1); |
| 1082 | QKeyEvent downEvent(QKeyEvent::Type::KeyPress, Qt::Key_Down, Qt::KeyboardModifier::NoModifier); |
| 1083 | sb.keyPressEvent(&downEvent); |
| 1084 | |
| 1085 | QCOMPARE(sb.lineEdit()->text(), QStringLiteral("-1.13")); // The first number should change not (0.13-1 = -0.87) |
| 1086 | QCOMPARE(sb.lineEdit()->cursorPosition(), 2); |
| 1087 | |
| 1088 | QKeyEvent upEvent(QKeyEvent::Type::KeyPress, Qt::Key_Up, Qt::KeyboardModifier::NoModifier); |
| 1089 | sb.keyPressEvent(&upEvent); |
| 1090 | |
| 1091 | QCOMPARE(sb.lineEdit()->text(), QStringLiteral("-0.13")); |
| 1092 | QCOMPARE(sb.lineEdit()->cursorPosition(), 2); |
| 1093 | |
| 1094 | sb.keyPressEvent(&upEvent); |
| 1095 | |
| 1096 | QCOMPARE(sb.lineEdit()->text(), QStringLiteral("1.13")); |
| 1097 | QCOMPARE(sb.lineEdit()->cursorPosition(), 1); |
| 1098 | } |
| 1099 | |
| 1100 | void SpinBoxTest::numberSpinBoxScrollingNegativeValues() { |
| 1101 | NumberSpinBox sb; |
nothing calls this directly
no test coverage detected