summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2023-06-13 14:49:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-16 04:26:14 +0000
commit73fde85dd8f0d47256052270cc9cdccc9a3daeba (patch)
tree81673c3766cf480183e790b034b4fb2462e465d5
parent7fef3141917323194b47bf553e0c0e43692b1ed7 (diff)
Enable locale file access in the auto tests
Task-number: QTBUG-114495 Change-Id: Ic32814a8e2672dd3835083dc2e8c0abebb9f168b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 654143b49c2720ae1a19aa6b191b62a89d41af60) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/qml/qquickwebview/tst_qquickwebview.cpp2
-rw-r--r--tests/auto/webview/qwebview/tst_qwebview.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
index 5926022..139dd85 100644
--- a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
+++ b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
@@ -100,6 +100,8 @@ QQuickWebView *tst_QQuickWebView::newWebView()
{
QObject *viewInstance = m_component->create();
QQuickWebView *webView = qobject_cast<QQuickWebView*>(viewInstance);
+ webView->settings()->setAllowFileAccess(true);
+ webView->settings()->setLocalContentCanAccessFileUrls(true);
return webView;
}
diff --git a/tests/auto/webview/qwebview/tst_qwebview.cpp b/tests/auto/webview/qwebview/tst_qwebview.cpp
index 3a51df9..b21b35d 100644
--- a/tests/auto/webview/qwebview/tst_qwebview.cpp
+++ b/tests/auto/webview/qwebview/tst_qwebview.cpp
@@ -76,6 +76,8 @@ void tst_QWebView::load()
QWebView &view = qview.webView();
#else
QWebView view;
+ view.getSettings()->setAllowFileAccess(true);
+ view.getSettings()->setLocalContentCanAccessFileUrls(true);
#endif
QCOMPARE(view.loadProgress(), 0);
const QUrl url = QUrl::fromLocalFile(fileName);
@@ -153,6 +155,8 @@ void tst_QWebView::loadRequest()
QWebView &view = qview.webView();
#else
QWebView view;
+ view.getSettings()->setAllowFileAccess(true);
+ view.getSettings()->setLocalContentCanAccessFileUrls(true);
#endif
QCOMPARE(view.loadProgress(), 0);
const QUrl url = QUrl::fromLocalFile(fileName);
@@ -185,6 +189,8 @@ void tst_QWebView::loadRequest()
QWebView &view = qview.webView();
#else
QWebView view;
+ view.getSettings()->setAllowFileAccess(true);
+ view.getSettings()->setLocalContentCanAccessFileUrls(true);
#endif
QCOMPARE(view.loadProgress(), 0);
QSignalSpy loadChangedSingalSpy(&view, SIGNAL(loadingChanged(const QWebViewLoadRequestPrivate &)));
@@ -217,6 +223,9 @@ void tst_QWebView::setAndDeleteCookie()
QWebView & view = qview.webView();
#else
QWebView view;
+ view.getSettings()->setLocalStorageEnabled(true);
+ view.getSettings()->setAllowFileAccess(true);
+ view.getSettings()->setLocalContentCanAccessFileUrls(true);
#endif
QSignalSpy cookieAddedSpy(&view, SIGNAL(cookieAdded(const QString &, const QString &)));