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

Method numberSpinBoxScrollingNegToPos

tests/commonfrontend/widgets/SpinBoxTest.cpp:1055–1073  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1053}
1054
1055void SpinBoxTest::numberSpinBoxScrollingNegToPos() {
1056 NumberSpinBox sb;
1057 sb.setMinimum(-10);
1058 sb.setValue(-1.01);
1059 QCOMPARE(sb.lineEdit()->text(), QStringLiteral("-1.01"));
1060
1061 sb.lineEdit()->setCursorPosition(2);
1062 QKeyEvent upEvent(QKeyEvent::Type::KeyPress, Qt::Key_Up, Qt::KeyboardModifier::NoModifier);
1063 sb.keyPressEvent(&upEvent);
1064
1065 QCOMPARE(sb.lineEdit()->text(), QStringLiteral("-0.01"));
1066 QCOMPARE(sb.lineEdit()->cursorPosition(), 2); // cursor should not be at position of the comma but behind the 0
1067
1068 QKeyEvent downEvent(QKeyEvent::Type::KeyPress, Qt::Key_Down, Qt::KeyboardModifier::NoModifier);
1069 sb.keyPressEvent(&downEvent);
1070
1071 QCOMPARE(sb.lineEdit()->text(), QStringLiteral("-1.01"));
1072 QCOMPARE(sb.lineEdit()->cursorPosition(), 2); // cursor should not be at position of the minus but behind the 1
1073}
1074
1075void SpinBoxTest::numberSpinBoxScrollingNegToPos2() {
1076 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