summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/tst_qmltests.cpp
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2019-11-29 14:43:24 +0100
committerTamas Zakor <ztamas@inf.u-szeged.hu>2019-12-18 14:54:13 +0000
commit17ea5b6534d6221e50cdd37dc773e03b5d34665e (patch)
tree559ca387ef7928797bdb5e1127ed31a1d668aa2a /tests/auto/quick/qmltests/tst_qmltests.cpp
parent12874d951f917d814efd582742b32d9d2884f9e4 (diff)
Fix Q(Quick)WebEngineDownloadItem::setDownloadDirectory()
Keep the custom file name if the calling order of setDownloadDirectory() and setDownloadFileName() changes. Also do not emit patchChanged signal twice if setDownloadDirectory() changes the uniquifier of the file name. Add TempDir for qml auto tests what uses QTemporaryDir() to create temporary directory for downloads. See https://cgit.kde.org/messagelib.git/commit/?id=2c113dcb155b11bf2c0af3c85544962485784b26 for details. Fixes: QTBUG-80566 Change-Id: Ia76f263558eaf55cb297700407948523788c6229 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests/tst_qmltests.cpp')
-rw-r--r--tests/auto/quick/qmltests/tst_qmltests.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp
index ba7a992db..d70a43895 100644
--- a/tests/auto/quick/qmltests/tst_qmltests.cpp
+++ b/tests/auto/quick/qmltests/tst_qmltests.cpp
@@ -27,8 +27,10 @@
****************************************************************************/
#include <QtCore/QScopedPointer>
+#include <QTemporaryDir>
#include <QtQuickTest/quicktest.h>
#include <QtWebEngine/QQuickWebEngineProfile>
+#include <QQmlEngine>
#include "qt_webengine_quicktest.h"
#if defined(Q_OS_LINUX) && defined(QT_DEBUG)
@@ -95,6 +97,19 @@ static void sigSegvHandler(int signum)
}
#endif
+class TempDir : public QObject {
+ Q_OBJECT
+
+public:
+ Q_INVOKABLE QString path() {
+ Q_ASSERT(tempDir.isValid());
+ return tempDir.isValid() ? tempDir.path() : QString();
+ }
+
+private:
+ QTemporaryDir tempDir;
+};
+
int main(int argc, char **argv)
{
#if defined(Q_OS_LINUX) && defined(QT_DEBUG)
@@ -127,9 +142,12 @@ int main(int argc, char **argv)
}
QtWebEngine::initialize();
QQuickWebEngineProfile::defaultProfile()->setOffTheRecord(true);
+ qmlRegisterType<TempDir>("Test.util", 1, 0, "TempDir");
QTEST_SET_MAIN_SOURCE_PATH
int i = quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR);
return i;
}
+
+#include "tst_qmltests.moc"