summaryrefslogtreecommitdiffstats
path: root/tests/manual/ios_assets/main.cpp
diff options
context:
space:
mode:
authorAlexandru Croitor <[email protected]>2022-08-08 18:33:36 +0200
committerAlexandru Croitor <[email protected]>2022-08-17 01:05:45 +0200
commitcf3535fdf2e7fe52b36aaa4b94a53525fd6640f4 (patch)
tree0f3d96b7e066dea92f526d7950987453cd76bc50 /tests/manual/ios_assets/main.cpp
parent753c352af0e1316767e24bfb960fe2a596c1489c (diff)
CMake: Add manual test for various iOS asset handling
Includes: - setting a custom Info.plist - Bundling non-image assets - Bundling image assets using asset catalogs - Bundling app icons - Bundling a launch screen Projects added for both qmake and CMake. The executable uses testlib to check that non-image assets, icons and asset catalogs were successfully bundled upon deployment to a device. Task-number: QTBUG-104519 Change-Id: Iaab6112e31e1098dcd2548e18b58bed5b64e6f83 Reviewed-by: Jörg Bornemann <[email protected]>
Diffstat (limited to 'tests/manual/ios_assets/main.cpp')
-rw-r--r--tests/manual/ios_assets/main.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/manual/ios_assets/main.cpp b/tests/manual/ios_assets/main.cpp
new file mode 100644
index 00000000000..020f3f940be
--- /dev/null
+++ b/tests/manual/ios_assets/main.cpp
@@ -0,0 +1,70 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtCore/QStandardPaths>
+#include <QtCore/QDir>
+#include <QtTest/QtTest>
+
+#ifdef DEBUG_APP_DATA_LOCATION
+ #include <QtCore/QDebug>
+#endif
+
+class AssetsIos : public QObject
+{
+ Q_OBJECT
+private slots:
+ void bundledTextFiles();
+ void bundledAppIcons();
+ void bundledImageInAssetCatalog();
+};
+
+void AssetsIos::bundledTextFiles()
+{
+#ifdef DEBUG_APP_DATA_LOCATION
+ auto paths = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
+ qDebug() << paths;
+
+ for (const QString& path: paths) {
+ QDir oneDir = QDir(path);
+ qDebug() << "path" << path << "entries" << oneDir.entryList();
+ }
+#endif
+
+ /*
+ AppDataLocation returns the following 3 paths on iOS
+ /var/mobile/Containers/Data/Application/uuid/Library/Application Support/tst_manual_ios_assets
+ /Library/Application Support/tst_manual_ios_assets
+ /private/var/containers/Bundle/Application/<uuid>/tst_manual_ios_assets.app
+
+ The textFiles/foo.txt file only exists in the third location at
+ /private/var/containers/Bundle/Application/<uuid>/tst_manual_ios_assets.app/textFiles/foo.txt
+
+ AppDataLocation returns the following 3 paths on macOS
+ /Users/<user>/Library/Application Support/tst_manual_ios_assets
+ /Library/Application Support/tst_manual_ios_assets
+ <build-dir>/tst_manual_ios_assets.app/Contents/Resources
+
+ Once again the file only exists in the third location at
+ <build-dir>/tst_manual_ios_assets.app/Contents/Resources/textFiles/foo.txt
+ */
+ QString textFile = QStandardPaths::locate(QStandardPaths::AppDataLocation,
+ QStringLiteral("textFiles/foo.txt"));
+ QVERIFY(!textFile.isEmpty());
+}
+
+void AssetsIos::bundledAppIcons() {
+ // Confirm one of the app icons are present.
+ QString appIcon = QStandardPaths::locate(QStandardPaths::AppDataLocation,
+ QStringLiteral("[email protected]"));
+ QVERIFY(!appIcon.isEmpty());
+}
+
+bool imageExistsInAssetCatalog(QString imageName);
+
+void AssetsIos::bundledImageInAssetCatalog() {
+ // Asset catalog images can be accessed only via a name, not a path.
+ QVERIFY(imageExistsInAssetCatalog(QStringLiteral("Face")));
+}
+
+QTEST_MAIN(AssetsIos)
+#include "main.moc"