summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-15 13:00:15 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-15 13:00:15 (GMT)
commit514191218cee42f6c2a9e9e3d00b66a2e537a323 (patch)
tree1144201e7f96bd0703c5ec4b7737031639ef3e19
parent8e2f230ebb062643a5cb1e734d73ad345793a9eb (diff)
Improve test apps
-rw-r--r--webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp1
-rw-r--r--webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h1
-rw-r--r--webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp22
-rw-r--r--webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h10
4 files changed, 27 insertions, 7 deletions
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
index 7143fd1..752541e 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
@@ -143,6 +143,7 @@ void CreatePhishingUrlDataBaseJob::setDataBaseDownloadNeeded(CreatePhishingUrlDa
void CreatePhishingUrlDataBaseJob::slotCheckUrlFinished(QNetworkReply *reply)
{
+ Q_EMIT debugJsonResult(reply->readAll());
reply->deleteLater();
deleteLater();
}
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
index 3cc7d42..dbcc54b 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
@@ -49,6 +49,7 @@ public:
Q_SIGNALS:
void finished();
+ void debugJsonResult(const QByteArray &ba);
private:
QString apiKey() const;
diff --git a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
index 3ba629e..8259c4e 100644
--- a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.cpp
@@ -18,6 +18,7 @@
*/
#include "createphishingurldatabasegui.h"
+#include "../createphishingurldatabasejob.h"
#include <QApplication>
#include <QStandardPaths>
@@ -27,28 +28,43 @@
#include <QLabel>
#include <QVBoxLayout>
-CreatePhisingUrlDataBaseGuioi::CreatePhisingUrlDataBaseGuioi(QWidget *parent)
+CreatePhisingUrlDataBaseGui::CreatePhisingUrlDataBaseGui(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
+
mResult = new QTextEdit(this);
mResult->setReadOnly(true);
mResult->setAcceptRichText(false);
layout->addWidget(mResult);
+ QPushButton *button = new QPushButton(QStringLiteral("DownLoad full database"), this);
+ connect(button, &QPushButton::clicked, this, &CreatePhisingUrlDataBaseGui::slotDownloadFullDatabase);
+ layout->addWidget(button);
+}
+
+CreatePhisingUrlDataBaseGui::~CreatePhisingUrlDataBaseGui()
+{
}
-CreatePhisingUrlDataBaseGuioi::~CreatePhisingUrlDataBaseGuioi()
+void CreatePhisingUrlDataBaseGui::slotDownloadFullDatabase()
{
+ WebEngineViewer::CreatePhishingUrlDataBaseJob *job = new WebEngineViewer::CreatePhishingUrlDataBaseJob(this);
+ connect(job, &WebEngineViewer::CreatePhishingUrlDataBaseJob::debugJsonResult, this, &CreatePhisingUrlDataBaseGui::slotResult);
+ job->start();
+}
+void CreatePhisingUrlDataBaseGui::slotResult(const QByteArray &data)
+{
+ mResult->setText(QString::fromLatin1(data));
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QStandardPaths::setTestModeEnabled(true);
- CreatePhisingUrlDataBaseGuioi *w = new CreatePhisingUrlDataBaseGuioi;
+ CreatePhisingUrlDataBaseGui *w = new CreatePhisingUrlDataBaseGui;
w->show();
app.exec();
diff --git a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
index 32d4c65..6591b2f 100644
--- a/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
+++ b/webengineviewer/src/checkphishingurl/tests/createphishingurldatabasegui.h
@@ -21,14 +21,16 @@
#define CREATEPHISHINGURLDATABASEGUI_H
#include <QWidget>
-#include "../createphishingurldatabasejob.h"
class QTextEdit;
-class CreatePhisingUrlDataBaseGuioi : public QWidget
+class CreatePhisingUrlDataBaseGui : public QWidget
{
Q_OBJECT
public:
- explicit CreatePhisingUrlDataBaseGuioi(QWidget *parent = Q_NULLPTR);
- ~CreatePhisingUrlDataBaseGuioi();
+ explicit CreatePhisingUrlDataBaseGui(QWidget *parent = Q_NULLPTR);
+ ~CreatePhisingUrlDataBaseGui();
+private Q_SLOTS:
+ void slotResult(const QByteArray &data);
+ void slotDownloadFullDatabase();
private:
QTextEdit *mResult;
};