void TextGoToLineWidgetTest::shouldEmitGoToLineSignalWhenSpinboxHasFocusAndWePressEnter() { KPIMTextEdit::TextGoToLineWidget edit; edit.show(); QTest::qWaitForWindowExposed(&edit); QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line")); line->setFocus(); QVERIFY(line->hasFocus()); line->setValue(5); QSignalSpy spy(&edit, SIGNAL(moveToLine(int))); QTest::keyPress(line, Qt::Key_Enter); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toInt(), 5); }