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

Continue to implement job for getting list of languages

parent b6d85b28
......@@ -31,4 +31,16 @@ void LanguageToolGetListOfLanguageJobTest::shouldHaveDefaultValues()
LanguageToolGetListOfLanguageJob w;
QVERIFY(!w.canStart());
QVERIFY(w.listOfLanguagePath().isEmpty());
QVERIFY(w.url().isEmpty());
}
void LanguageToolGetListOfLanguageJobTest::shouldBeAbleToStart()
{
LanguageToolGetListOfLanguageJob job;
QVERIFY(!job.canStart());
job.setUrl(QStringLiteral("foo"));
QVERIFY(!job.canStart());
QNetworkAccessManager network;
job.setNetworkAccessManager(&network);
QVERIFY(job.canStart());
}
......@@ -30,6 +30,8 @@ public:
~LanguageToolGetListOfLanguageJobTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
void shouldBeAbleToStart();
};
#endif // LANGUAGETOOLGETLISTOFLANGUAGEJOBTEST_H
......@@ -31,7 +31,7 @@ LanguageToolGetListOfLanguageJob::~LanguageToolGetListOfLanguageJob()
bool LanguageToolGetListOfLanguageJob::canStart() const
{
if (!mNetworkAccessManager) {
if (!mNetworkAccessManager || mUrl.isEmpty()) {
return false;
}
return true;
......@@ -66,3 +66,13 @@ void LanguageToolGetListOfLanguageJob::setNetworkAccessManager(QNetworkAccessMan
{
mNetworkAccessManager = networkAccessManager;
}
QString LanguageToolGetListOfLanguageJob::url() const
{
return mUrl;
}
void LanguageToolGetListOfLanguageJob::setUrl(const QString &url)
{
mUrl = url;
}
......@@ -39,11 +39,15 @@ public:
QNetworkAccessManager *networkAccessManager() const;
void setNetworkAccessManager(QNetworkAccessManager *networkAccessManager);
Q_REQUIRED_RESULT QString url() const;
void setUrl(const QString &url);
private:
Q_DISABLE_COPY(LanguageToolGetListOfLanguageJob)
QString mListOfLanguagePath;
QNetworkAccessManager *mNetworkAccessManager = nullptr;
QString mUrl;
};
#endif // LANGUAGETOOLGETLISTOFLANGUAGEJOB_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