summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/util.h')
-rw-r--r--tests/auto/widgets/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h
index ca03c5833..cb58f4243 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/widgets/util.h
@@ -36,6 +36,7 @@
#include <QSignalSpy>
#include <QTimer>
#include <qwebenginepage.h>
+#include <qwebengineview.h>
#if !defined(TESTS_SOURCE_DIR)
#define TESTS_SOURCE_DIR ""
@@ -160,6 +161,18 @@ static inline QUrl baseUrlSync(QWebEnginePage *page)
return spy.waitForResult().toUrl();
}
+static inline bool loadSync(QWebEnginePage *page, const QUrl &url, bool ok = true)
+{
+ QSignalSpy spy(page, &QWebEnginePage::loadFinished);
+ page->load(url);
+ return (!spy.empty() || spy.wait(20000)) && (spy.front().value(0).toBool() == ok);
+}
+
+static inline bool loadSync(QWebEngineView *view, const QUrl &url, bool ok = true)
+{
+ return loadSync(view->page(), url, ok);
+}
+
#define W_QSKIP(a, b) QSKIP(a)
#define W_QTEST_MAIN(TestObject, params) \