aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/tst_blackboxapple.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-06-08 19:36:20 -0700
committerJake Petroules <jake.petroules@qt.io>2017-06-09 09:53:35 +0000
commit8cebe57331d118f6c6ae6e599a3c9f624a8146b6 (patch)
tree8f65d6e79bf3f746efdbd9f4b9dc1de4d3fd4b33 /tests/auto/blackbox/tst_blackboxapple.cpp
parent7d9fe986599cf138cfa237df8fcab44ee61a39e3 (diff)
Refactor asset catalogs test for greater performance and coverage
This splits out assetCatalogsEmpty and assetCatalogsMultiple from the main assetCatalog test. They are not affected by the data axis of the main test, so this improves performance by not running each of them twice for no reason. It also increases coverage by running them on OSes < macOS 10.9 (which we still test with) as long as Xcode 5 is present. Further, the main assetCatalog test no longer has a hard requirement on macOS 10.9 either, and instead conditionally enables testing of asset catalogs based on the Xcode version (>= 5). This increases test coverage of XIB compilation with older Xcodes and OSes. The MainMenu.xib has been recreated in an old version of Xcode (4.6.3) so it is more broadly usable as a test artifact with older configurations. Tested on macOS 10.12.5 with Xcode 8.3.2, macOS 10.7.5 with Xcode 4.6.3, and macOS 10.8.5 with Xcode 5.1.1. Change-Id: Ifc5d1b0462fd94aa5f1d55727bc74af73e8b9272 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxapple.cpp')
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp55
1 files changed, 36 insertions, 19 deletions
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index d0fae8e63..820bc8052 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -139,8 +139,7 @@ void TestBlackboxApple::assetCatalog()
{
QFETCH(bool, flatten);
- if (HostOsInfo::hostOsVersion() < qbs::Internal::Version(10, 9))
- QSKIP("This test needs at least macOS 10.9.");
+ const auto xcodeVersion = findXcodeVersion();
QDir::setCurrent(testDataDir + QLatin1String("/ib/assetcatalog"));
@@ -158,7 +157,8 @@ void TestBlackboxApple::assetCatalog()
QCOMPARE(runQbs(params), 0);
// empty asset catalogs must still produce output
- QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets"));
+ if (xcodeVersion >= qbs::Internal::Version(5))
+ QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets"));
// should not produce a CAR since minimumMacosVersion will be < 10.9
QVERIFY(!regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car"));
@@ -168,8 +168,21 @@ void TestBlackboxApple::assetCatalog()
QCOMPARE(runQbs(params), 0);
// empty asset catalogs must still produce output
- QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets"));
- QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty") + "/assetcatalogempty.app/Contents/Resources/Assets.car"));
+ if (xcodeVersion >= qbs::Internal::Version(5)) {
+ QVERIFY((bool)m_qbsStdout.contains("compiling empty.xcassets"));
+ // No matter what, we need a 10.9 host to build CAR files
+ if (HostOsInfo::hostOsVersion() >= qbs::Internal::Version(10, 9)) {
+ QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty")
+ + "/assetcatalogempty.app/Contents/Resources/Assets.car"));
+ } else {
+ QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty")
+ + "/assetcatalogempty.app/Contents/Resources/empty.icns"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty")
+ + "/assetcatalogempty.app/Contents/Resources/other.png"));
+ QVERIFY(regularFileExists(relativeProductBuildDir("assetcatalogempty")
+ + "/assetcatalogempty.app/Contents/Resources/other@2x.png"));
+ }
+ }
// this asset catalog happens to have an embedded icon set,
// but this should NOT be built since it is not in the files list
@@ -219,20 +232,6 @@ void TestBlackboxApple::assetCatalog()
QCOMPARE(runQbs(params2), 0);
QCOMPARE(QDir(nib).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList());
QCOMPARE(QDir(storyboardc).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name), QStringList());
-
- QDir::setCurrent(testDataDir + QLatin1String("/ib/multiple-asset-catalogs"));
- rmDirR(relativeBuildDir());
- params.arguments = QStringList();
- QCOMPARE(runQbs(params), 0);
- QVERIFY2(m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout);
- QVERIFY2(m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout);
-
- QDir::setCurrent(testDataDir + QLatin1String("/ib/empty-asset-catalogs"));
- rmDirR(relativeBuildDir());
- params.arguments = QStringList();
- QCOMPARE(runQbs(params), 0);
- QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout);
- QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout);
}
void TestBlackboxApple::assetCatalog_data()
@@ -242,6 +241,24 @@ void TestBlackboxApple::assetCatalog_data()
QTest::newRow("unflattened") << false;
}
+void TestBlackboxApple::assetCatalogsEmpty() {
+ if (findXcodeVersion() < qbs::Internal::Version(5))
+ QSKIP("requires Xcode 5 or above");
+ QDir::setCurrent(testDataDir + QLatin1String("/ib/empty-asset-catalogs"));
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout);
+ QVERIFY2(!m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout);
+}
+
+void TestBlackboxApple::assetCatalogsMultiple() {
+ if (findXcodeVersion() < qbs::Internal::Version(5))
+ QSKIP("requires Xcode 5 or above");
+ QDir::setCurrent(testDataDir + QLatin1String("/ib/multiple-asset-catalogs"));
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.contains("compiling assetcatalog1.xcassets"), m_qbsStdout);
+ QVERIFY2(m_qbsStdout.contains("compiling assetcatalog2.xcassets"), m_qbsStdout);
+}
+
void TestBlackboxApple::bundleStructure()
{
QFETCH(QString, productName);