summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-10-26 13:30:32 +0200
committerMontel Laurent <[email protected]>2017-10-26 13:30:32 +0200
commit95a5490a5b05656760946b6843433d939317d799 (patch)
tree03e7e757935c4582c2b26ed79d1f6e1ebad9612e
parenta660fa104b64d22b0b18f83bde9f46871d90fc1b (diff)
Improve autotest
-rw-r--r--src/ksieveui/vacation/autotests/vacationmailactionwidgettest.cpp32
-rw-r--r--src/ksieveui/vacation/autotests/vacationmailactionwidgettest.h1
2 files changed, 33 insertions, 0 deletions
diff --git a/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.cpp b/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.cpp
index 34605b5..a34324c 100644
--- a/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.cpp
+++ b/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.cpp
@@ -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());
+}
diff --git a/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.h b/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.h
index 003ff2c..dbdb8dc 100644
--- a/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.h
+++ b/src/ksieveui/vacation/autotests/vacationmailactionwidgettest.h
@@ -30,6 +30,7 @@ public:
~VacationMailActionWidgetTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
+ void shouldSwitchComponents();
};
#endif // VACATIONMAILACTIONWIDGETTEST_H