summaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qquickwebview/tst_qquickwebview.cpp')
-rw-r--r--tests/auto/qml/qquickwebview/tst_qquickwebview.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
index e3162bc..b1a1364 100644
--- a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
+++ b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp
@@ -68,6 +68,7 @@ private Q_SLOTS:
void multipleWebViewWindows();
void multipleWebViews();
void titleUpdate();
+ void changeUserAgent();
private:
inline QQuickWebView *newWebView();
@@ -75,11 +76,12 @@ private:
void runJavaScript(const QString &script);
QScopedPointer<TestWindow> m_window;
QScopedPointer<QQmlComponent> m_component;
+ QQmlEngine *engine = nullptr;
};
tst_QQuickWebView::tst_QQuickWebView()
{
- static QQmlEngine *engine = new QQmlEngine(this);
+ engine = new QQmlEngine(this);
m_component.reset(new QQmlComponent(engine, this));
m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n"
"import QtWebView 1.1\n"
@@ -332,5 +334,19 @@ void tst_QQuickWebView::titleUpdate()
}
+void tst_QQuickWebView::changeUserAgent()
+{
+ QQmlComponent userAgentWebView(engine, this);
+ userAgentWebView.setData(QByteArrayLiteral("import QtQuick 2.0\n"
+ "import QtWebView 1.14\n"
+ "WebView {\n"
+ "httpUserAgent: \"dummy\"\n"
+ "}"),
+ QUrl());
+ QObject *viewInstance = userAgentWebView.create();
+ QQuickWebView *webView = qobject_cast<QQuickWebView *>(viewInstance);
+ QCOMPARE(webView->httpUserAgent(), "dummy");
+}
+
QTEST_MAIN(tst_QQuickWebView)
#include "tst_qquickwebview.moc"