summaryrefslogtreecommitdiff
path: root/src/positioning/qgeopositioninfosource.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-09-09 13:55:31 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-09-09 21:57:24 +0000
commitf6a48c06d3090e553867db327665b3cc44d9b21a (patch)
tree4c074df93a40fe6784c10d4da0912aa06a67e05f /src/positioning/qgeopositioninfosource.cpp
parent84ee5b304d1ab87bc2addb21fb684cc2b9a68d00 (diff)
downloadqtlocation-f6a48c06d3090e553867db327665b3cc44d9b21a.tar.gz
Skip loading real plugins in tests
Introduce a new plugin metadata field "Testable" that can be used to indicate that using the plugin in question in test runs (e.g. in a CI environment) is dangerous. We can then check for QT_QTESTLIB_RUNNING and skip the plugin in question. Change-Id: Iabe9f1600d7274e0e9224dc49d02aa2e5d3cabd6 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/positioning/qgeopositioninfosource.cpp')
-rw-r--r--src/positioning/qgeopositioninfosource.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/positioning/qgeopositioninfosource.cpp b/src/positioning/qgeopositioninfosource.cpp
index 1cdd4116..0cec8eaa 100644
--- a/src/positioning/qgeopositioninfosource.cpp
+++ b/src/positioning/qgeopositioninfosource.cpp
@@ -158,6 +158,12 @@ void QGeoPositionInfoSourcePrivate::loadPluginMetadata(QHash<QString, QJsonObjec
QList<QJsonObject> meta = l->metaData();
for (int i = 0; i < meta.size(); ++i) {
QJsonObject obj = meta.at(i).value(QStringLiteral("MetaData")).toObject();
+ const QString testableKey = QStringLiteral("Testable");
+ if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
+ static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
+ if (inTest)
+ continue;
+ }
obj.insert(QStringLiteral("index"), i);
plugins.insertMulti(obj.value(QStringLiteral("Provider")).toString(), obj);
}