summaryrefslogtreecommitdiff
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2021-11-17 15:08:14 +0100
committerSzabolcs David <davidsz@inf.u-szeged.hu>2022-01-19 17:10:16 +0000
commit99b46c0959ec6280ee51c0d9ef8df432fd96a5bc (patch)
tree28b3e4f0a9d38751db5250724d2e185bc1418489 /tests/auto/widgets
parent0c69660a8f67248edcf469391a2ac96a000f37d9 (diff)
downloadqtwebengine-99b46c0959ec6280ee51c0d9ef8df432fd96a5bc.tar.gz
Widgets: Add FileSelectionMode::FileSelectSave
Now we have an example to trigger this type of dialog, we can expose this as public API. Pick-to: 6.3 Change-Id: If0964d07a532daaff5e798dac63dc02ec7781d4d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index c86e89b42..d95c246fc 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -4758,6 +4758,8 @@ void tst_QWebEnginePage::testChooseFilesParameters_data()
<< QWebEnginePage::FileSelectOpenMultiple << QStringList();
QTest::addRow("Folder upload") << QString("multiple webkitdirectory") << QString()
<< QWebEnginePage::FileSelectUploadFolder << QStringList();
+ QTest::addRow("Save file") << QString("") << QString()
+ << QWebEnginePage::FileSelectSave << QStringList();
mimeTypes = QStringList() << "audio/*";
QTest::addRow("MIME type: audio") << QString() << QString("accept='%1'").arg(mimeTypes.join(','))
<< QWebEnginePage::FileSelectOpen << mimeTypes;
@@ -4791,9 +4793,16 @@ void tst_QWebEnginePage::testChooseFilesParameters()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- page.setHtml(QString("<html><body>"
- "<input id='filePicker' type='file' name='filePicker' %1 %2 />"
- "</body></html>").arg(uploadAttribute, mimeTypeAttribute));
+ if (expectedFileSelectionMode != QWebEnginePage::FileSelectSave) {
+ page.setHtml(QString("<html><body>"
+ "<input id='filePicker' type='file' name='filePicker' %1 %2 />"
+ "</body></html>").arg(uploadAttribute, mimeTypeAttribute));
+ } else {
+ page.setHtml(QString("<html><body>"
+ "<button id='filePicker' value='trigger' "
+ "onclick='window.showSaveFilePicker()'"
+ "</body></html>"), QString("qrc:/"));
+ }
QVERIFY(spyFinished.wait());
QTRY_COMPARE(spyFinished.count(), 1);