Commit 95a5490a authored by Laurent Montel's avatar Laurent Montel 😁

Improve autotest

parent a660fa10
......@@ -64,3 +64,35 @@ void VacationMailActionWidgetTest::shouldHaveDefaultValue()
QVERIFY(w.mailActionRecipient().isEmpty());
}
void VacationMailActionWidgetTest::shouldSwitchComponents()
{
KSieveUi::VacationMailActionWidget w;
QStackedWidget *mStackedWidget = w.findChild<QStackedWidget *>(QStringLiteral("stackedWidget"));
QWidget *mMailActionRecipient = mStackedWidget->widget(0);
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>(mMailActionRecipient);
QWidget *mMoveImapFolderWidget = mStackedWidget->widget(1);
KSieveUi::AbstractMoveImapFolderWidget *abstractMoveImapFolderWidget = dynamic_cast<KSieveUi::AbstractMoveImapFolderWidget *>(mMoveImapFolderWidget);
w.mailActionChanged(KSieveUi::VacationUtils::Keep);
QCOMPARE(mStackedWidget->currentIndex(), 0);
QVERIFY(w.mailActionRecipient().isEmpty());
QVERIFY(!w.isEnabled());
w.mailActionChanged(KSieveUi::VacationUtils::CopyTo);
QCOMPARE(mStackedWidget->currentIndex(), 1);
QVERIFY(w.mailActionRecipient().isEmpty());
QVERIFY(w.isEnabled());
w.mailActionChanged(KSieveUi::VacationUtils::Discard);
QCOMPARE(mStackedWidget->currentIndex(), 0);
QVERIFY(w.mailActionRecipient().isEmpty());
QVERIFY(!w.isEnabled());
w.mailActionChanged(KSieveUi::VacationUtils::Sendto);
QCOMPARE(mStackedWidget->currentIndex(), 0);
QVERIFY(w.mailActionRecipient().isEmpty());
QVERIFY(w.isEnabled());
}
......@@ -30,6 +30,7 @@ public:
~VacationMailActionWidgetTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldSwitchComponents();
};
#endif // VACATIONMAILACTIONWIDGETTEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment