Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit df8a3590 authored by Laurent Montel's avatar Laurent Montel 😁

improve autotest

parent d09d0b46
......@@ -23,6 +23,7 @@
#include <KLineEdit>
#include <QToolButton>
#include <qtest_kde.h>
#include <KABC/Addressee>
EmailEditWidgetTest::EmailEditWidgetTest(QObject *parent)
: QObject(parent)
{
......@@ -56,4 +57,37 @@ void EmailEditWidgetTest::shouldReadOnly()
QVERIFY(!toolButton->isEnabled());
}
void EmailEditWidgetTest::shouldSelectFirstEmail()
{
EmailEditWidget widget;
KLineEdit *lineedit = qFindChild<KLineEdit *>(&widget, QLatin1String("emailedit"));
KABC::Addressee addr;
KABC::Email::List lst;
const QString firstEmail(QLatin1String("foo@kde.org"));
lst << KABC::Email(firstEmail);
lst << KABC::Email(QLatin1String("foo2@kde.org"));
addr.setEmailList(lst);
widget.loadContact(addr);
QCOMPARE(lineedit->text(), firstEmail);
}
void EmailEditWidgetTest::shouldChangeEmail()
{
EmailEditWidget widget;
KLineEdit *lineedit = qFindChild<KLineEdit *>(&widget, QLatin1String("emailedit"));
KABC::Addressee addr;
KABC::Email::List lst;
const QString firstEmail(QLatin1String("foo@kde.org"));
lst << KABC::Email(firstEmail);
lst << KABC::Email(QLatin1String("foo2@kde.org"));
addr.setEmailList(lst);
widget.loadContact(addr);
const QString changedEmail(QLatin1String("foo3@kde.org"));
lineedit->setText(changedEmail);
KABC::Addressee result;
widget.storeContact(result);
QVERIFY(!result.emailList().isEmpty());
QCOMPARE(result.emailList().first().mail(), changedEmail);
}
QTEST_KDEMAIN(EmailEditWidgetTest, GUI)
......@@ -31,6 +31,8 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldReadOnly();
void shouldSelectFirstEmail();
void shouldChangeEmail();
};
#endif // EMAILEDITWIDGETTEST_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