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

Improve it

parent 7c0720ce
......@@ -6,5 +6,5 @@ include(AkonadiMacros)
set(KDEPIMLIBS_RUN_ISOLATED_TESTS TRUE)
set(KDEPIMLIBS_RUN_SQLITE_ISOLATED_TESTS TRUE)
add_akonadi_isolated_test_advanced( gravatarcreatejobtest.cpp "" "")
add_akonadi_isolated_test_advanced( gravatarupdatejobtest.cpp "" "")
add_akonadi_isolated_test_advanced( gravatarcreatejobtest.cpp "../gravatarcreatejob.cpp" "kaddressbookprivate")
add_akonadi_isolated_test_advanced( gravatarupdatejobtest.cpp "../gravatarupdatejob.cpp" "kaddressbookprivate")
......@@ -20,6 +20,7 @@
#include "gravatarcreatejobtest.h"
#include <qtest_kde.h>
#include "../gravatarcreatejob.h"
GravatarCreateJobTest::GravatarCreateJobTest(QObject *parent)
: QObject(parent)
......@@ -32,4 +33,10 @@ GravatarCreateJobTest::~GravatarCreateJobTest()
}
void GravatarCreateJobTest::shouldHaveDefaultValue()
{
KABGravatar::GravatarCreateJob job;
QVERIFY(job.email().isEmpty());
}
QTEST_KDEMAIN(GravatarCreateJobTest, NoGUI)
......@@ -30,6 +30,9 @@ class GravatarCreateJobTest : public QObject
public:
explicit GravatarCreateJobTest(QObject *parent = 0);
~GravatarCreateJobTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // GRAVATARCREATEJOBTEST_H
......@@ -19,6 +19,7 @@
*/
#include "gravatarupdatejobtest.h"
#include "../gravatarupdatejob.h"
#include <qtest_kde.h>
GravatarUpdateJobTest::GravatarUpdateJobTest(QObject *parent)
......@@ -32,4 +33,11 @@ GravatarUpdateJobTest::~GravatarUpdateJobTest()
}
void GravatarUpdateJobTest::shouldHaveDefaultValue()
{
KABGravatar::GravatarUpdateJob job;
QVERIFY(job.email().isEmpty());
QVERIFY(!job.item().isValid());
}
QTEST_KDEMAIN(GravatarUpdateJobTest, NoGUI)
......@@ -30,6 +30,8 @@ public:
explicit GravatarUpdateJobTest(QObject *parent = 0);
~GravatarUpdateJobTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // GRAVATARUPDATEJOBTEST_H
......@@ -33,8 +33,24 @@ GravatarCreateJob::~GravatarCreateJob()
}
bool GravatarCreateJob::canStart()
{
return !mEmail.trimmed().isEmpty();
}
void GravatarCreateJob::start()
{
}
QString GravatarCreateJob::email() const
{
return mEmail;
}
void GravatarCreateJob::setEmail(const QString &email)
{
mEmail = email;
}
......@@ -31,8 +31,14 @@ public:
explicit GravatarCreateJob(QObject *parent = 0);
~GravatarCreateJob();
bool canStart();
void start();
QString email() const;
void setEmail(const QString &email);
private:
QString mEmail;
};
}
......
......@@ -39,3 +39,28 @@ void GravatarUpdateJob::start()
}
bool GravatarUpdateJob::canStart() const
{
return !mEmail.trimmed().isEmpty() && mItem.isValid();
}
QString GravatarUpdateJob::email() const
{
return mEmail;
}
void GravatarUpdateJob::setEmail(const QString &email)
{
mEmail = email;
}
Akonadi::Item GravatarUpdateJob::item() const
{
return mItem;
}
void GravatarUpdateJob::setItem(const Akonadi::Item &item)
{
mItem = item;
}
......@@ -23,6 +23,7 @@
#define GRAVATARUPDATEJOB_H
#include <QObject>
#include <Akonadi/Item>
namespace KABGravatar {
class GravatarUpdateJob : public QObject
......@@ -33,6 +34,17 @@ public:
~GravatarUpdateJob();
void start();
bool canStart() const;
QString email() const;
void setEmail(const QString &email);
Akonadi::Item item() const;
void setItem(const Akonadi::Item &item);
private:
QString mEmail;
Akonadi::Item mItem;
};
}
......
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