aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-07-20 09:22:47 -0700
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-27 04:56:14 +0000
commit447e2e024609a22fe052cf458c27efdef2e3d3eb (patch)
treef2665cfdea84b9d85044a3221658eb8ce10e7d9a /tests/auto/qml/qmlcachegen
parent65fd9165162a8498c5bbe71e5372b65770c240b0 (diff)
Try to load QML cache from CacheLocation if side-by-side fails
This could happen if the .qmlc file is stale or corrupt for some reason. In that case, we should try to load a cache file from the user's CacheLocation. Change-Id: Id2be776c7ae0467c9d9ffffd1543204272a531d1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcachegen')
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 48eb694167..60717dfafa 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -32,6 +32,7 @@
#include <QQmlEngine>
#include <QProcess>
#include <QLibraryInfo>
+#include <QStandardPaths>
#include <QSysInfo>
#include <QLoggingCategory>
#include <private/qqmlcomponent_p.h>
@@ -105,6 +106,13 @@ static bool generateCache(const QString &qmlFileName, QByteArray *capturedStderr
void tst_qmlcachegen::initTestCase()
{
qputenv("QML_FORCE_DISK_CACHE", "1");
+ QStandardPaths::setTestModeEnabled(true);
+
+ // make sure there's no pre-existing cache dir
+ QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ if (!cacheDir.isEmpty())
+ //QDir(cacheDir).removeRecursively();
+ qDebug() << cacheDir;
}
void tst_qmlcachegen::loadGeneratedFile()