summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 06b19216d..715050fcc 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -236,6 +236,7 @@ private Q_SLOTS:
void restoreHistory();
void toPlainTextLoadFinishedRace_data();
void toPlainTextLoadFinishedRace();
+ void setZoomFactor();
private:
QWebEngineView* m_view;
@@ -4980,5 +4981,30 @@ void tst_QWebEnginePage::toPlainTextLoadFinishedRace()
QVERIFY(spy.count() == 3);
}
+void tst_QWebEnginePage::setZoomFactor()
+{
+ QWebEnginePage *page = new QWebEnginePage;
+
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 1.0));
+ page->setZoomFactor(2.5);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ const QUrl urlToLoad("qrc:/resources/test1.html");
+
+ QSignalSpy finishedSpy(m_page, SIGNAL(loadFinished(bool)));
+ m_page->setUrl(urlToLoad);
+ QTRY_COMPARE(finishedSpy.count(), 1);
+ QVERIFY(finishedSpy.at(0).first().toBool());
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ page->setZoomFactor(5.5);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ page->setZoomFactor(0.1);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ delete page;
+}
+
QTEST_MAIN(tst_QWebEnginePage)
#include "tst_qwebenginepage.moc"