aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp')
-rw-r--r--tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
index 648e4490ee..2c62353630 100644
--- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
+++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp
@@ -33,6 +33,7 @@
#include <QQmlApplicationEngine>
#include <QFileSelector>
#include <QQmlContext>
+#include <QLoggingCategory>
#include <qqmlinfo.h>
#include "../../shared/util.h"
@@ -44,6 +45,7 @@ public:
private slots:
void basicTest();
+ void basicTestCached();
void applicationEngineTest();
};
@@ -62,6 +64,25 @@ void tst_qqmlfileselector::basicTest()
delete object;
}
+void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message)
+{
+ if (type == QtDebugMsg
+ && QByteArray(context.category) == QByteArray("qt.qml.diskcache")
+ && message.contains("QML source file has moved to a different location.")) {
+ QFAIL(message.toUtf8());
+ }
+}
+
+void tst_qqmlfileselector::basicTestCached()
+{
+ basicTest(); // Seed the cache, in case basicTestCached() is run on its own
+ QtMessageHandler defaultHandler = qInstallMessageHandler(&messageHandler);
+ QLoggingCategory::setFilterRules("qt.qml.diskcache.debug=true");
+ basicTest(); // Run again and check that the file is in the cache now
+ QLoggingCategory::setFilterRules(QString());
+ qInstallMessageHandler(defaultHandler);
+}
+
void tst_qqmlfileselector::applicationEngineTest()
{
QQmlApplicationEngine engine;