Commit 71bfe5e3 authored by Laurent Montel's avatar Laurent Montel 😁

Add test for zoom action (work here not in kmail...)

parent 935b7c03
......@@ -132,8 +132,9 @@ void MailWebEngineView::selectAll()
void MailWebEngineView::slotZoomChanged(qreal zoom)
{
//qDebug() << " void MailWebEngineView::slotZoomChanged(qreal zoom)*******" << zoom;
setZoomFactor(zoom);
qDebug() << " void MailWebEngineView::slotZoomChanged(qreal zoom)*******" << zoom;
setZoomFactor(zoom*100);
qDebug()<<" zoomFactor"<<zoomFactor();
}
void MailWebEngineView::scamCheck()
......
......@@ -28,6 +28,7 @@
TestMailWebEngine::TestMailWebEngine(QWidget *parent)
: QWidget(parent)
{
mZoom = 1.0;
QVBoxLayout *vbox = new QVBoxLayout(this);
mTestWebEngine = new MessageViewer::MailWebEngineView(new KActionCollection(this), this);
mTestWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
......@@ -43,6 +44,17 @@ TestMailWebEngine::TestMailWebEngine(QWidget *parent)
QPushButton *scrollDown = new QPushButton(QStringLiteral("scrollDown 10px"), this);
connect(scrollDown, &QPushButton::clicked, this, &TestMailWebEngine::slotScrollDown);
hButtonBox->addWidget(scrollDown);
hButtonBox = new QHBoxLayout;
vbox->addLayout(hButtonBox);
QPushButton *zoomUp = new QPushButton(QStringLiteral("zoom Up"), this);
connect(zoomUp, &QPushButton::clicked, this, &TestMailWebEngine::slotZoomUp);
hButtonBox->addWidget(zoomUp);
QPushButton *zoomDown = new QPushButton(QStringLiteral("zoom Down"), this);
connect(zoomDown, &QPushButton::clicked, this, &TestMailWebEngine::slotZoomDown);
hButtonBox->addWidget(zoomDown);
}
TestMailWebEngine::~TestMailWebEngine()
......@@ -60,6 +72,18 @@ void TestMailWebEngine::slotScrollUp()
mTestWebEngine->page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollUp(10));
}
void TestMailWebEngine::slotZoomDown()
{
mZoom -= 0.2;
mTestWebEngine->setZoomFactor(mZoom);
}
void TestMailWebEngine::slotZoomUp()
{
mZoom += 0.2;
mTestWebEngine->setZoomFactor(mZoom);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
......
......@@ -35,8 +35,11 @@ private Q_SLOTS:
void slotScrollUp();
void slotScrollDown();
void slotZoomUp();
void slotZoomDown();
private:
MessageViewer::MailWebEngineView *mTestWebEngine;
qreal mZoom;
};
#endif // TESTMAILWEBENGINE_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