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

improve test

parent 39ee1c54
......@@ -6,13 +6,13 @@ ecm_add_test(adblockmanagertest.cpp
)
set( adblockpluginurlinterceptortest_SRCS adblockpluginurlinterceptortest.cpp ../adblockpluginurlinterceptor.cpp ../adblockinterceptorinterface.cpp ../adblockpluginurlinterceptorconfigurewidget.cpp)
set( adblockpluginurlinterceptortest_SRCS adblockpluginurlinterceptortest.cpp ../adblockblockableitemsdialog.cpp ../adblockblockableitemswidget.cpp ../adblockpluginurlinterceptor.cpp ../adblockinterceptorinterface.cpp ../adblockpluginurlinterceptorconfigurewidget.cpp)
add_executable( adblockpluginurlinterceptortest ${adblockpluginurlinterceptortest_SRCS})
add_test(adblockpluginurlinterceptortest adblockpluginurlinterceptortest)
ecm_mark_as_test(adblockpluginurlinterceptortest)
target_link_libraries( adblockpluginurlinterceptortest Qt5::Test Qt5::Widgets adblocklibprivate KF5::MessageViewer Qt5::WebEngine Qt5::WebEngineWidgets KF5::ItemViews KF5::KIOWidgets KF5::XmlGui)
set( adblockpluginurlinterceptorconfigurewidgettest_SRCS adblockpluginurlinterceptorconfigurewidgettest.cpp ../adblockpluginurlinterceptorconfigurewidget.cpp)
set( adblockpluginurlinterceptorconfigurewidgettest_SRCS adblockpluginurlinterceptorconfigurewidgettest.cpp ../adblockpluginurlinterceptorconfigurewidget.cpp )
add_executable( adblockpluginurlinterceptorconfigurewidgettest ${adblockpluginurlinterceptorconfigurewidgettest_SRCS})
add_test(adblockpluginurlinterceptorconfigurewidgettest adblockpluginurlinterceptorconfigurewidgettest)
ecm_mark_as_test(adblockpluginurlinterceptorconfigurewidgettest)
......
set(adblockblockableelementgui_SRCS adblockblockableelementgui.cpp)
set(adblockblockableelementgui_SRCS adblockblockableelementgui.cpp ../adblockblockableitemsdialog.cpp ../adblockblockableitemswidget.cpp)
add_executable(adblockblockableelementgui ${adblockblockableelementgui_SRCS})
target_link_libraries(adblockblockableelementgui
KF5::MessageViewer Qt5::WebEngine Qt5::WebEngineWidgets
KF5::MessageViewer Qt5::WebEngine Qt5::WebEngineWidgets KF5::ItemViews KF5::KIOWidgets
)
......@@ -17,6 +17,7 @@
#include "adblockblockableelementgui.h"
#include "../adblockblockableitemsdialog.h"
#include <QVBoxLayout>
#include <QPushButton>
#include <QWebEngineView>
......@@ -28,6 +29,13 @@ AdblockBlockableElementGui::AdblockBlockableElementGui(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
mWebEngineView = new QWebEngineView(this);
mWebEngineView->load(QUrl(QStringLiteral("http://www.kde.org")));
vbox->addWidget(mWebEngineView);
QPushButton *button = new QPushButton(QStringLiteral("search adblock"), this);
connect(button, &QPushButton::clicked, this, &AdblockBlockableElementGui::slotSearchAdblock);
vbox->addWidget(button);
}
AdblockBlockableElementGui::~AdblockBlockableElementGui()
......@@ -35,6 +43,13 @@ AdblockBlockableElementGui::~AdblockBlockableElementGui()
}
void AdblockBlockableElementGui::slotSearchAdblock()
{
AdBlockBlockableItemsDialog dlg(this);
dlg.setWebEngineView(mWebEngineView);
dlg.exec();
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
......
......@@ -19,13 +19,19 @@
#define ADBLOCKBLOCKABLEELEMENTGUI_H
#include <QWidget>
class QWebEngineView;
class AdblockBlockableElementGui : public QWidget
{
Q_OBJECT
public:
explicit AdblockBlockableElementGui(QWidget *parent = Q_NULLPTR);
~AdblockBlockableElementGui();
public Q_SLOTS:
void slotSearchAdblock();
private:
QWebEngineView *mWebEngineView;
};
#endif // ADBLOCKBLOCKABLEELEMENTGUI_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