MCPcopy Create free account
hub / github.com/KDE/labplot / numberSpinBoxScrollingNegToPos2

Method numberSpinBoxScrollingNegToPos2

tests/commonfrontend/widgets/SpinBoxTest.cpp:1075–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073}
1074
1075void 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
1100void SpinBoxTest::numberSpinBoxScrollingNegativeValues() {
1101 NumberSpinBox sb;

Callers

nothing calls this directly

Calls 6

setMinimumMethod · 0.80
lineEditMethod · 0.80
setCursorPositionMethod · 0.80
setValueMethod · 0.45
textMethod · 0.45
keyPressEventMethod · 0.45

Tested by

no test coverage detected