Exemplo n.º 1
0
void TextGoToLineWidgetTest::shouldSetFocusWhenWeRecallGotToLine()
{
    KPIMTextEdit::TextGoToLineWidget edit;
    edit.show();
    QTest::qWaitForWindowExposed(&edit);
    QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
    QVERIFY(line->hasFocus());
    edit.setFocus();
    QVERIFY(!line->hasFocus());
    edit.goToLine();
    QVERIFY(line->hasFocus());
}
Exemplo n.º 2
0
void TextGoToLineWidgetTest::shouldHasFocusEachTimeThatItShown()
{
    KPIMTextEdit::TextGoToLineWidget edit;
    edit.show();
    QTest::qWaitForWindowExposed(&edit);
    QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
    QVERIFY(line);
    QVERIFY(line->hasFocus());
    edit.hide();
    QVERIFY(!line->hasFocus());
    edit.show();
    QTest::qWaitForWindowExposed(&edit);
    //FIXME QVERIFY(line->hasFocus());
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
void TextGoToLineWidgetTest::shouldHaveDefaultValuesOnCreation()
{
    KPIMTextEdit::TextGoToLineWidget edit;
    edit.show();
    QTest::qWaitForWindowExposed(&edit);
    QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
    QVERIFY(line);
    QCOMPARE(line->minimum(), 1);
    QPushButton *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
    QVERIFY(gotolinebutton);
    QToolButton *closebutton = edit.findChild<QToolButton *>(QStringLiteral("closebutton"));
    QVERIFY(closebutton);
    QVERIFY(line->hasFocus());
}