From 0c54aff9b4cef8a4e66ce1501f207184f3328284 Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@qt.io>
Date: Wed, 17 Apr 2019 15:32:26 +0200
Subject: [PATCH] Make offscreen test offline
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This enables also the test on qemu.

Change-Id: I70c40b3cedeadfb21e396d8a550a54fe0a319438
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
---
 tests/auto/widgets/offscreen/test.html         | 7 +++++++
 tests/auto/widgets/offscreen/tst_offscreen.cpp | 3 ++-
 tests/auto/widgets/offscreen/tst_offscreen.qrc | 6 ++++++
 tests/auto/widgets/widgets.pro                 | 3 +--
 4 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 tests/auto/widgets/offscreen/test.html
 create mode 100644 tests/auto/widgets/offscreen/tst_offscreen.qrc

diff --git a/tests/auto/widgets/offscreen/test.html b/tests/auto/widgets/offscreen/test.html
new file mode 100644
index 000000000..55063539f
--- /dev/null
+++ b/tests/auto/widgets/offscreen/test.html
@@ -0,0 +1,7 @@
+<html>
+<head><title>TEST</title></head>
+<body>
+Eat me !
+</body>
+</html>
+
diff --git a/tests/auto/widgets/offscreen/tst_offscreen.cpp b/tests/auto/widgets/offscreen/tst_offscreen.cpp
index 98cbe55fe..7573b0537 100644
--- a/tests/auto/widgets/offscreen/tst_offscreen.cpp
+++ b/tests/auto/widgets/offscreen/tst_offscreen.cpp
@@ -49,10 +49,11 @@ void tst_OffScreen::offscreen()
     QWebEngineView view;
     QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
     view.setPage(&page);
-    page.load(QUrl("http://qt.io"));
+    page.load(QUrl("qrc:/test.html"));
     view.show();
     QTRY_COMPARE(view.isVisible(), true);
     QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count() > 0, true, 20000);
+    QCOMPARE(loadFinishedSpy.takeFirst().at(0).toBool(), true);
 }
 
 #include "tst_offscreen.moc"
diff --git a/tests/auto/widgets/offscreen/tst_offscreen.qrc b/tests/auto/widgets/offscreen/tst_offscreen.qrc
new file mode 100644
index 000000000..8a998fe85
--- /dev/null
+++ b/tests/auto/widgets/offscreen/tst_offscreen.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>test.html</file>
+</qresource>
+</RCC>
+
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 9dba2c070..104c85895 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -43,7 +43,6 @@ boot2qt: SUBDIRS -= accessibility defaultsurfaceformat devtools \
                     qwebenginepage \
                     qwebengineprofile  \
                     qwebengineview  \
-                    qwebenginescript \
-                    offscreen
+                    qwebenginescript
 
 win32: SUBDIRS -= offscreen
-- 
GitLab