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 a8566101 authored by Laurent Montel's avatar Laurent Montel 😁

Fix enable/disable search button

parent 28dbee50
......@@ -44,4 +44,23 @@ void GravatarCreateWidgetTest::shouldHaveDefaultValue()
QVERIFY(searchGravatar);
}
void GravatarCreateWidgetTest::shouldEnableDisableSearchButton()
{
KABGravatar::GravatarCreateWidget widget;
QPushButton *searchGravatar = widget.findChild<QPushButton *>(QLatin1String("search"));
QVERIFY(!searchGravatar->isEnabled());
widget.setEmail(QLatin1String("foo"));
QVERIFY(searchGravatar->isEnabled());
widget.setEmail(QString());
QVERIFY(!searchGravatar->isEnabled());
widget.setEmail(QLatin1String("s"));
QVERIFY(searchGravatar->isEnabled());
widget.setEmail(QLatin1String(" "));
QVERIFY(!searchGravatar->isEnabled());
}
QTEST_KDEMAIN(GravatarCreateWidgetTest, GUI)
......@@ -30,6 +30,7 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldEnableDisableSearchButton();
};
#endif // GRAVATARCREATEWIDGETTEST_H
......@@ -59,7 +59,7 @@ void GravatarCreateWidget::setEmail(const QString &email)
if (mEmail != email) {
mEmail = email;
mEmailLab->setText(mEmail);
mSearchGravatar->setEnabled(!mEmail.isEmpty());
mSearchGravatar->setEnabled(!mEmail.trimmed().isEmpty());
}
}
......
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