aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-01-11 14:56:50 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-01-20 09:42:12 +0000
commit8bbf8373b7c83fc64beba1ab0c79ce99c4175384 (patch)
treec7e207ae75ca05b82221955363e1ee04379f10f3
parent7df849cdf5818a621780d6ec07803b36a37bdfec (diff)
Add checks for some types in infoPlist
Checking the exact values is hard because they depend on the targetPlatfom/architecture, but we can check that types are correct if those values are present. Task-number: QBS-1447 Change-Id: I4407421919ad74719ce089d059cbe36764a565d8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 819193b4b..ab095a3a1 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -108,6 +108,17 @@ static QString getInfoPlistPath(const QString &bundlePath)
return bundlePath + "/Info.plist";
}
+static bool testVariantListType(const QVariant &variant, QMetaType::Type type)
+{
+ if (variant.userType() != QMetaType::QVariantList)
+ return false;
+ for (const auto &value : variant.toList()) {
+ if (value.userType() != type)
+ return false;
+ }
+ return true;
+}
+
TestBlackboxApple::TestBlackboxApple()
: TestBlackboxBase (SRCDIR "/testdata-apple", "blackbox-apple")
{
@@ -783,6 +794,19 @@ void TestBlackboxApple::infoPlist()
if (!content.contains(QStringLiteral("SDKROOT"))) { // macOS-specific values
QCOMPARE(content.value("LSMinimumSystemVersion"), QStringLiteral("10.7"));
QVERIFY(content.contains("NSPrincipalClass"));
+ } else {
+ // QBS-1447: UIDeviceFamily was set to a string instead of an array
+ const auto family = content.value(QStringLiteral("UIDeviceFamily"));
+ if (family.isValid()) {
+ // int gets converted to a double when exporting plist as JSON
+ QVERIFY(testVariantListType(family, QMetaType::Double));
+ }
+ const auto caps = content.value(QStringLiteral("UIRequiredDeviceCapabilities"));
+ if (caps.isValid())
+ QVERIFY(testVariantListType(caps, QMetaType::QString));
+ const auto orientations = content.value(QStringLiteral("UIRequiredDeviceCapabilities"));
+ if (orientations.isValid())
+ QVERIFY(testVariantListType(orientations, QMetaType::QString));
}
}