From 8bbf8373b7c83fc64beba1ab0c79ce99c4175384 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 11 Jan 2020 14:56:50 +0100 Subject: 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 --- tests/auto/blackbox/tst_blackboxapple.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') 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)); } } -- cgit v1.2.3