forked from qt-creator/qt-creator
Unit tests: Fix ProjectInfoGenerator.* tests
...by adapting to recent mime type changes:
commit e8e46ab553
Plugins: Fix that mimetype definition was not valid JSON
Change-Id: Iac416ab481814e4488fac4d818c51c647c1ec349
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -28,8 +28,11 @@
|
||||
#include "hostosinfo.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QRegularExpression>
|
||||
#include <QSet>
|
||||
|
||||
@@ -246,4 +249,24 @@ QTCREATOR_UTILS_EXPORT QString stripAccelerator(const QString &text)
|
||||
return res;
|
||||
}
|
||||
|
||||
QTCREATOR_UTILS_EXPORT bool readMultiLineString(const QJsonValue &value, QString *out)
|
||||
{
|
||||
QTC_ASSERT(out, return false);
|
||||
if (value.isString()) {
|
||||
*out = value.toString();
|
||||
} else if (value.isArray()) {
|
||||
QJsonArray array = value.toArray();
|
||||
QStringList lines;
|
||||
foreach (const QJsonValue &v, array) {
|
||||
if (!v.isString())
|
||||
return false;
|
||||
lines.append(v.toString());
|
||||
}
|
||||
*out = lines.join(QLatin1Char('\n'));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
Reference in New Issue
Block a user