summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebengineview
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-09 12:04:12 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-06-09 18:58:54 +0200
commit5d1ef38f9f6815807596d0606cf7ed06b7930aac (patch)
tree441c2b27eb9d169d58cb94a30ac424ebb6b42b65 /tests/auto/widgets/qwebengineview
parent3f5b5213d42376470274f0e3aaa51731f0d2552a (diff)
Create a RWHV delegate in core
This is adapting the Quick code for shared use with widgets, and allows us to use it from QWebEnginePage. Pick-to: 6.4 Fixes: QTBUG-96377 Change-Id: I3f09c1a949eff86d80fbe6c513dc66e3f9f2f611 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tests/auto/widgets/qwebengineview')
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 921b0c52f..883720490 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -106,6 +106,7 @@ private Q_SLOTS:
void changePage();
void reusePage_data();
void reusePage();
+ void setLoadedPage();
void microFocusCoordinates();
void focusInputTypes();
void unhandledKeyEventPropagation();
@@ -399,7 +400,7 @@ void tst_QWebEngineView::reusePage()
view1->show();
QVERIFY(QTest::qWaitForWindowExposed(view1));
delete view1;
- QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view
+ QVERIFY(page != nullptr); // deleting view must not have deleted the page, since it's not a child of view
QWebEngineView *view2 = new QWebEngineView;
view2->setPage(page.data());
@@ -412,6 +413,23 @@ void tst_QWebEngineView::reusePage()
QDir::setCurrent(QApplication::applicationDirPath());
}
+void tst_QWebEngineView::setLoadedPage()
+{
+ // MEMO load page first to make sure that just simple attach to view would draw its content
+ QWebEnginePage page;
+ QSignalSpy loadSpy(&page, &QWebEnginePage::loadFinished);
+ page.setHtml(QString("<html><body bgcolor=\"%1\"></body></html>").arg(QColor(Qt::yellow).name()));
+ QTRY_VERIFY(loadSpy.count() == 1 && loadSpy.first().first().toBool());
+
+ QWebEngineView view;
+ view.resize(480, 320);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ view.setPage(&page);
+ QTRY_COMPARE(view.grab().toImage().pixelColor(QPoint(view.width() / 2, view.height() / 2)), Qt::yellow);
+}
+
// Class used in crashTests
class WebViewCrashTest : public QObject {
Q_OBJECT