Skip to content

Commit

Permalink
Fix the remaining two unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vkrause committed Sep 17, 2017
1 parent 7f2618b commit 1e9fa3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -37,7 +37,7 @@ void AutoCorrectionPluginEditorInterfaceTest::shouldHaveDefaultValue()
interface.createAction(new KActionCollection(this));
MessageComposer::ActionType type = interface.actionType();
QVERIFY(type.action());
QCOMPARE(type.type(), MessageComposer::ActionType::Edit);
QCOMPARE(type.type(), MessageComposer::ActionType::Tools);
}

QTEST_MAIN(AutoCorrectionPluginEditorInterfaceTest)
8 changes: 8 additions & 0 deletions plugins/messageviewerplugins/autotests/todoedittest.cpp
Expand Up @@ -142,6 +142,7 @@ void TodoEditTest::shouldHaveASubject()
QString subject = QStringLiteral("Test Note");
msg->subject(true)->fromUnicodeString(subject, "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();

QCOMPARE(noteedit->text(), QStringLiteral("Reply to \"%1\"").arg(subject));
}
Expand Down Expand Up @@ -178,6 +179,7 @@ void TodoEditTest::shouldSelectLineWhenPutMessage()
QString subject = QStringLiteral("Test Note");
msg->subject(true)->fromUnicodeString(subject, "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();
QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
QVERIFY(noteedit->hasSelectedText());
const QString selectedText = noteedit->selectedText();
Expand Down Expand Up @@ -226,6 +228,7 @@ void TodoEditTest::shouldEmitTodoWhenPressEnter()
QString subject = QStringLiteral("Test Note");
msg->subject(true)->fromUnicodeString(subject, "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();
QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
QSignalSpy spy(&edit, SIGNAL(createTodo(KCalCore::Todo::Ptr,Akonadi::Collection)));
QTest::keyClick(noteedit, Qt::Key_Enter);
Expand All @@ -239,6 +242,7 @@ void TodoEditTest::shouldTodoHasCorrectSubject()
QString subject = QStringLiteral("Test Note");
msg->subject(true)->fromUnicodeString(subject, "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();
QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
QSignalSpy spy(&edit, SIGNAL(createTodo(KCalCore::Todo::Ptr,Akonadi::Collection)));
QTest::keyClick(noteedit, Qt::Key_Enter);
Expand Down Expand Up @@ -286,6 +290,7 @@ void TodoEditTest::shouldEmitCorrectCollection()
QString subject = QStringLiteral("Test Note");
msg->subject(true)->fromUnicodeString(subject, "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();
akonadicombobox->setCurrentIndex(3);
Akonadi::Collection col = akonadicombobox->currentCollection();
QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
Expand Down Expand Up @@ -466,6 +471,7 @@ void TodoEditTest::shouldHideMessageWidgetWhenAddNewMessage()
KMime::Message::Ptr msg(new KMime::Message);
msg->subject(true)->fromUnicodeString(QStringLiteral("Test note"), "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();
QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
noteedit->setText(QStringLiteral("Test Note"));
KMessageWidget *msgwidget = edit.findChild<KMessageWidget *>(QStringLiteral("msgwidget"));
Expand All @@ -475,6 +481,7 @@ void TodoEditTest::shouldHideMessageWidgetWhenAddNewMessage()
KMime::Message::Ptr msg2(new KMime::Message);
msg2->subject(true)->fromUnicodeString(QStringLiteral("Test note 2"), "us-ascii");
edit.setMessage(msg2);
edit.showToDoWidget();
QCOMPARE(msgwidget->isVisible(), false);
}

Expand Down Expand Up @@ -503,6 +510,7 @@ void TodoEditTest::shouldEnabledSaveOpenEditorButton()
KMime::Message::Ptr msg(new KMime::Message);
msg->subject(true)->fromUnicodeString(QStringLiteral("Test note"), "us-ascii");
edit.setMessage(msg);
edit.showToDoWidget();

QLineEdit *noteedit = edit.findChild<QLineEdit *>(QStringLiteral("noteedit"));
QPushButton *openEditor = edit.findChild<QPushButton *>(QStringLiteral("open-editor-button"));
Expand Down

0 comments on commit 1e9fa3c

Please sign in to comment.