summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/dialogs/BLACKLIST2
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp26
-rw-r--r--tests/auto/quick/qmltests/data/tst_action.qml16
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml61
-rw-r--r--tests/auto/quick/qquickwebengineview/BLACKLIST7
5 files changed, 96 insertions, 16 deletions
diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST
new file mode 100644
index 000000000..6d7e2a2fc
--- /dev/null
+++ b/tests/auto/quick/dialogs/BLACKLIST
@@ -0,0 +1,2 @@
+[contextMenuRequested]
+osx-10.13
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 90b768ac7..f464d58d0 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -80,6 +80,7 @@ static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *
<< &QQuickWebEngineColorDialogRequest::staticMetaObject
<< &QQuickWebEngineFileDialogRequest::staticMetaObject
<< &QQuickWebEngineFormValidationMessageRequest::staticMetaObject
+ << &QQuickWebEngineTooltipRequest::staticMetaObject
<< &QQuickWebEngineContextMenuRequest::staticMetaObject
<< &QWebEngineQuotaRequest::staticMetaObject
<< &QWebEngineRegisterProtocolHandlerRequest::staticMetaObject
@@ -259,6 +260,12 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineDownloadItem.type --> DownloadType"
<< "QQuickWebEngineDownloadItem.typeChanged() --> void"
<< "QQuickWebEngineDownloadItem.view --> QQuickWebEngineView*"
+ << "QQuickWebEngineDownloadItem.url --> QUrl"
+ << "QQuickWebEngineDownloadItem.suggestedFileName --> QString"
+ << "QQuickWebEngineDownloadItem.downloadDirectory --> QString"
+ << "QQuickWebEngineDownloadItem.downloadDirectoryChanged() --> void"
+ << "QQuickWebEngineDownloadItem.downloadFileName --> QString"
+ << "QQuickWebEngineDownloadItem.downloadFileNameChanged() --> void"
<< "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode"
<< "QQuickWebEngineFileDialogRequest.FileModeSave --> FileMode"
@@ -277,6 +284,13 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineFormValidationMessageRequest.subText --> QString"
<< "QQuickWebEngineFormValidationMessageRequest.text --> QString"
<< "QQuickWebEngineFormValidationMessageRequest.type --> RequestType"
+ << "QQuickWebEngineTooltipRequest.Hide --> RequestType"
+ << "QQuickWebEngineTooltipRequest.Show --> RequestType"
+ << "QQuickWebEngineTooltipRequest.x --> int"
+ << "QQuickWebEngineTooltipRequest.y --> int"
+ << "QQuickWebEngineTooltipRequest.text --> QString"
+ << "QQuickWebEngineTooltipRequest.type --> RequestType"
+ << "QQuickWebEngineTooltipRequest.accepted --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
<< "QQuickWebEngineFullScreenRequest.origin --> QUrl"
<< "QQuickWebEngineFullScreenRequest.reject() --> void"
@@ -596,6 +610,9 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.LetterExtra --> PrintedPageSizeId"
<< "QQuickWebEngineView.LetterPlus --> PrintedPageSizeId"
<< "QQuickWebEngineView.LetterSmall --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LifecycleState.Active --> LifecycleState"
+ << "QQuickWebEngineView.LifecycleState.Discarded --> LifecycleState"
+ << "QQuickWebEngineView.LifecycleState.Frozen --> LifecycleState"
<< "QQuickWebEngineView.LinkClickedNavigation --> NavigationType"
<< "QQuickWebEngineView.LoadFailedStatus --> LoadStatus"
<< "QQuickWebEngineView.LoadStartedStatus --> LoadStatus"
@@ -628,6 +645,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.Prc32K --> PrintedPageSizeId"
<< "QQuickWebEngineView.Prc32KBig --> PrintedPageSizeId"
<< "QQuickWebEngineView.Quarto --> PrintedPageSizeId"
+ << "QQuickWebEngineView.RedirectNavigation --> NavigationType"
<< "QQuickWebEngineView.Redo --> WebAction"
<< "QQuickWebEngineView.Reload --> WebAction"
<< "QQuickWebEngineView.ReloadAndBypassCache --> WebAction"
@@ -692,6 +710,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.isFullScreenChanged() --> void"
<< "QQuickWebEngineView.javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString) --> void"
<< "QQuickWebEngineView.javaScriptDialogRequested(QQuickWebEngineJavaScriptDialogRequest*) --> void"
+ << "QQuickWebEngineView.lifecycleState --> LifecycleState"
+ << "QQuickWebEngineView.lifecycleStateChanged(LifecycleState) --> void"
<< "QQuickWebEngineView.linkHovered(QUrl) --> void"
<< "QQuickWebEngineView.loadHtml(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
@@ -715,6 +735,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.quotaRequested(QWebEngineQuotaRequest) --> void"
<< "QQuickWebEngineView.recentlyAudible --> bool"
<< "QQuickWebEngineView.recentlyAudibleChanged(bool) --> void"
+ << "QQuickWebEngineView.recommendedState --> LifecycleState"
+ << "QQuickWebEngineView.recommendedStateChanged(LifecycleState) --> void"
<< "QQuickWebEngineView.registerProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest) --> void"
<< "QQuickWebEngineView.reload() --> void"
<< "QQuickWebEngineView.reloadAndBypassCache() --> void"
@@ -736,6 +758,7 @@ static const QStringList expectedAPI = QStringList()
#endif
<< "QQuickWebEngineView.title --> QString"
<< "QQuickWebEngineView.titleChanged() --> void"
+ << "QQuickWebEngineView.tooltipRequested(QQuickWebEngineTooltipRequest*) --> void"
<< "QQuickWebEngineView.triggerWebAction(WebAction) --> void"
<< "QQuickWebEngineView.url --> QUrl"
<< "QQuickWebEngineView.urlChanged() --> void"
@@ -811,8 +834,9 @@ static void checkKnownType(const QByteArray &typeName)
static void gatherAPI(const QString &prefix, const QMetaEnum &metaEnum, QStringList *output)
{
+ const auto format = metaEnum.isScoped() ? "%1%3.%2 --> %3" : "%1%2 --> %3";
for (int i = 0; i < metaEnum.keyCount(); ++i)
- *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(metaEnum.key(i)).arg(metaEnum.name());
+ *output << QString::fromLatin1(format).arg(prefix).arg(metaEnum.key(i)).arg(metaEnum.name());
}
static void gatherAPI(const QString &prefix, const QMetaProperty &property, QStringList *output)
diff --git a/tests/auto/quick/qmltests/data/tst_action.qml b/tests/auto/quick/qmltests/data/tst_action.qml
index 56a91d8d0..852d4145a 100644
--- a/tests/auto/quick/qmltests/data/tst_action.qml
+++ b/tests/auto/quick/qmltests/data/tst_action.qml
@@ -51,8 +51,8 @@ TestWebEngineView {
{ webAction: WebEngineView.Forward, text: "Forward", iconName: "go-next", enabled: false },
{ webAction: WebEngineView.Stop, text: "Stop", iconName: "", enabled: false },
{ webAction: WebEngineView.Reload, text: "Reload", iconName: "view-refresh", enabled: true },
- { webAction: WebEngineView.Cut, text: "Cut", iconName: "Cut", enabled: true },
- { webAction: WebEngineView.Copy, text: "Copy", iconName: "", enabled: true },
+ { webAction: WebEngineView.Cut, text: "Cut", iconName: "Cut", enabled: false },
+ { webAction: WebEngineView.Copy, text: "Copy", iconName: "", enabled: false },
{ webAction: WebEngineView.Paste, text: "Paste", iconName: "", enabled: true },
{ webAction: WebEngineView.Undo, text: "Undo", iconName: "", enabled: true },
{ webAction: WebEngineView.Redo, text: "Redo", iconName: "", enabled: true },
@@ -76,7 +76,7 @@ TestWebEngineView {
{ webAction: WebEngineView.InspectElement, text: "Inspect", iconName: "", enabled: true },
{ webAction: WebEngineView.ExitFullScreen, text: "Exit full screen", iconName: "", enabled: true },
{ webAction: WebEngineView.RequestClose, text: "Close Page", iconName: "", enabled: true },
- { webAction: WebEngineView.Unselect, text: "Unselect", iconName: "", enabled: true },
+ { webAction: WebEngineView.Unselect, text: "Unselect", iconName: "", enabled: false },
{ webAction: WebEngineView.SavePage, text: "Save page", iconName: "", enabled: true },
{ webAction: WebEngineView.ViewSource, text: "View page source", iconName: "view-source", enabled: true },
{ webAction: WebEngineView.ToggleBold, text: "&Bold", iconName: "", enabled: true },
@@ -110,17 +110,17 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("test1.html");
verify(webEngineView.waitForLoadSucceeded());
- var copyAction = webEngineView.action(WebEngineView.Copy);
- verify(copyAction);
+ var selectAction = webEngineView.action(WebEngineView.SelectAll);
+ verify(selectAction);
var stopAction = webEngineView.action(WebEngineView.Stop);
verify(stopAction);
- var triggerSpy = createTemporaryObject(signalSpy, actionTests, {target: copyAction, signalName: "triggered"});
+ var triggerSpy = createTemporaryObject(signalSpy, actionTests, {target: selectAction, signalName: "triggered"});
var stopTriggerSpy = createTemporaryObject(signalSpy, actionTests, {target: stopAction, signalName: "triggered"});
- verify(copyAction.enabled);
- copyAction.trigger();
+ verify(selectAction.enabled);
+ selectAction.trigger();
compare(triggerSpy.count, 1);
verify(!stopAction.enabled);
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index 5eb704cce..ff57c76c7 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -28,7 +28,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtWebEngine 1.9
+import QtWebEngine 1.10
import Qt.labs.platform 1.0
TestWebEngineView {
@@ -42,6 +42,14 @@ TestWebEngineView {
property bool cancelDownload: false
property var downloadState: []
property var downloadInterruptReason: null
+ property url downloadUrl: ""
+ property string suggestedFileName: ""
+ property string downloadDirectory: ""
+ property string downloadFileName: ""
+ property string downloadedPath: ""
+ property int downloadDirectoryChanged: 0
+ property int downloadFileNameChanged: 0
+ property int downloadPathChanged: 0
function urlToPath(url) {
var path = url.toString()
@@ -66,21 +74,36 @@ TestWebEngineView {
ignoreUnknownSignals: true
onStateChanged: downloadState.push(target.state)
onInterruptReasonChanged: downloadInterruptReason = target.interruptReason
+ onDownloadDirectoryChanged: downloadDirectoryChanged++
+ onDownloadFileNameChanged: downloadFileNameChanged++
+ onPathChanged: downloadPathChanged++
}
WebEngineProfile {
id: testDownloadProfile
onDownloadRequested: {
+ testDownloadProfile.downloadPath = urlToPath(StandardPaths.writableLocation(StandardPaths.TempLocation))
downloadState.push(download.state)
downloadItemConnections.target = download
if (cancelDownload) {
download.cancel()
} else {
totalBytes = download.totalBytes
- download.path = "testfile.zip"
+ download.downloadDirectory = testDownloadProfile.downloadPath
+ download.downloadFileName = "testfile.zip"
+
+ if (downloadDirectory.length != 0)
+ download.downloadDirectory = testDownloadProfile.downloadPath + downloadDirectory
+
+ if (downloadFileName.length != 0)
+ download.downloadFileName = downloadFileName
+
download.accept()
}
+ downloadUrl = download.url
+ suggestedFileName = download.suggestedFileName
+ downloadedPath = download.downloadDirectory + download.downloadFileName
}
onDownloadFinished: {
receivedBytes = download.receivedBytes;
@@ -99,6 +122,9 @@ TestWebEngineView {
downloadItemConnections.target = null
downloadState = []
downloadInterruptReason = null
+ downloadDirectoryChanged = 0
+ downloadFileNameChanged = 0
+ downloadPathChanged = 0
}
function test_downloadRequest() {
@@ -106,6 +132,8 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("download.zip")
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
+ compare(downloadUrl, webEngineView.url)
+ compare(suggestedFileName, "download.zip")
compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
verify(!downloadInterruptReason)
}
@@ -115,6 +143,8 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("download.zip")
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
+ compare(downloadUrl, webEngineView.url)
+ compare(suggestedFileName, "download.zip")
compare(totalBytes, 325)
verify(!downloadInterruptReason)
}
@@ -124,6 +154,8 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("download.zip")
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
+ compare(downloadUrl, webEngineView.url)
+ compare(suggestedFileName, "download.zip")
compare(downloadState[0], WebEngineDownloadItem.DownloadRequested)
tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress)
downloadFinishedSpy.wait()
@@ -138,6 +170,8 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("download.zip")
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
+ compare(downloadUrl, webEngineView.url)
+ compare(suggestedFileName, "download.zip")
compare(downloadFinishedSpy.count, 1)
tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadCancelled)
tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadItem.UserCanceled)
@@ -153,5 +187,28 @@ TestWebEngineView {
testDownloadProfile.downloadPath = downloadPath;
compare(testDownloadProfile.downloadPath, downloadPath);
}
+
+ function test_downloadToDirectoryWithFileName() {
+ compare(downLoadRequestedSpy.count, 0);
+ compare(downloadDirectoryChanged, 0);
+ compare(downloadFileNameChanged, 0);
+ downloadDirectory = "/test/";
+ downloadFileName = "test.zip";
+ webEngineView.url = Qt.resolvedUrl("download.zip");
+ downLoadRequestedSpy.wait();
+ compare(downLoadRequestedSpy.count, 1);
+ compare(downloadUrl, webEngineView.url);
+ compare(suggestedFileName, "download.zip");
+ compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + downloadFileName);
+ compare(downloadDirectoryChanged, 1);
+ compare(downloadFileNameChanged, 3);
+ compare(downloadPathChanged, 4);
+ downloadFinishedSpy.wait();
+ compare(totalBytes, receivedBytes);
+ tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ verify(!downloadInterruptReason);
+ }
}
}
diff --git a/tests/auto/quick/qquickwebengineview/BLACKLIST b/tests/auto/quick/qquickwebengineview/BLACKLIST
index 49c5332ff..d4d5c9844 100644
--- a/tests/auto/quick/qquickwebengineview/BLACKLIST
+++ b/tests/auto/quick/qquickwebengineview/BLACKLIST
@@ -1,5 +1,2 @@
-[javascriptClipboard:default]
-opensuse-leap
-
-[javascriptClipboard:canPaste]
-opensuse-leap
+[transparentWebEngineViews]
+windows