aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-04-27 03:47:31 -0700
committerJake Petroules <jake.petroules@qt.io>2017-06-12 16:24:44 +0000
commite675eda3d40bb0e17f10b410e1ccdbbd12d063c9 (patch)
treed1dadf89b6b1d58541bc92d0825ea59fbebbf4e6 /tests
parenta3bc51e1ea52d867ce6647a278225948982d7d48 (diff)
Add support for building macOS disk images
This allows users to build drag 'n' drop installers with custom backgrounds, volume icons, and icon layouts. Unlike other solutions, disk images with these features can be built without any reliance on AppleScript, Finder, or a graphical login session, making it (mostly) reproducible and CI-friendly. .DS_Store files and their contained alias and bookmark records (which control the mounted disk image's appearance in the Finder) are written on-demand based on qbs properties defined in the project file, as well as the Carbon LPic, TEXT, styl, and RTF resources used for embedding a license agreement prompt. Task-number: QBS-416 Change-Id: I95431e21becc3bea075a1468d5271a41c38bbd04 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/apple-dmg.qbs88
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/hello.icnsbin0 -> 1393763 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/hello.tifbin0 -> 866742 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/eula.rtf49
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/main.c1
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/eula.txt6
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16.pngbin0 -> 649 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16@2x.pngbin0 -> 665 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/eula.odtbin0 -> 2680 bytes
-rw-r--r--tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/eula.docxbin0 -> 12338 bytes
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp6
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.h1
17 files changed, 181 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/apple-dmg.qbs b/tests/auto/blackbox/testdata-apple/apple-dmg/apple-dmg.qbs
new file mode 100644
index 000000000..3bccebfd0
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/apple-dmg.qbs
@@ -0,0 +1,88 @@
+import qbs
+
+Project {
+ AppleApplicationDiskImage {
+ Depends { name: "myapp" }
+ Depends { name: "ib" }
+ dmg.volumeName: "My Great App"
+ dmg.iconSize: 128
+ dmg.windowWidth: 640
+ dmg.windowHeight: 280
+ files: [
+ "white.iconset",
+ ]
+ }
+
+ CppApplication {
+ name: "myapp"
+ targetName: "My Great App"
+ files: ["main.c"]
+
+ Group {
+ fileTagsFilter: ["bundle.content"]
+ qbs.install: true
+ qbs.installDir: "/Applications"
+ qbs.installSourceBase: product.buildDirectory
+ }
+ }
+
+ AppleDiskImage {
+ name: "hellodmg"
+ targetName: "hellodmg-1.0"
+ + (qbs.architecture ? "-" + qbs.architecture : "")
+
+ dmg.volumeName: "Hello DMG"
+
+ files: [
+ "hello.icns",
+ "hello.tif"
+ ]
+
+ Group {
+ files: ["en_US.lproj/eula.txt"]
+ fileTags: ["dmg.input", "dmg.license.input"]
+ dmg.iconX: 320
+ dmg.iconY: 240
+ dmg.licenseLocale: "en_US"
+ }
+
+ Group {
+ files: ["*.lproj/**"]
+ excludeFiles: ["en_US.lproj/eula.txt"]
+ }
+ }
+
+ AppleDiskImage {
+ name: "green"
+ dmg.backgroundColor: "green"
+ }
+
+ AppleDiskImage {
+ name: "german"
+ dmg.defaultLicenseLocale: "de_DE"
+
+ Group {
+ files: ["*.lproj/**"]
+ }
+ }
+
+ AppleDiskImage {
+ name: "custom-buttons"
+
+ Group {
+ files: ["ru_RU.lproj/eula.txt"]
+ dmg.licenseLocale: "sv_SE" // override auto-detected ru_RU with sv_SE
+ dmg.licenseLanguageName: "Swedish, not Russian"
+ dmg.licenseAgreeButtonText: "Of course"
+ dmg.licenseDisagreeButtonText: "Never!"
+ dmg.licensePrintButtonText: "Make Paper"
+ dmg.licenseSaveButtonText: "Make Bits"
+ dmg.licenseInstructionText: "Do please agree to the license!"
+ }
+
+ Group {
+ files: ["*.lproj/**"]
+ excludeFiles: ["ru_RU.lproj/eula.txt"]
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/eula.txt
new file mode 100644
index 000000000..7ca2bf84b
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/de_DE.lproj/eula.txt
@@ -0,0 +1,6 @@
+FIKTIVE UNTERNEHMEN
+SOFTWARE BEISPIEL VEREINBARUNG
+
+Sie stimmen zu, dass Sie nicht mit dieser App auf Atomwaffen zu machen.
+
+Sie bestätigen, dass Qbs das Beste ist.
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/eula.txt
new file mode 100644
index 000000000..e2b7adbed
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/en_GB.lproj/eula.txt
@@ -0,0 +1,6 @@
+FICTIONAL CORPORATION
+SOFTWARE EXAMPLE AGREEMENT
+
+You agree that you will not use this app to make nuclear weapons.
+
+You agree that Qbs is the best.
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/eula.txt
new file mode 100644
index 000000000..e2b7adbed
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/en_US.lproj/eula.txt
@@ -0,0 +1,6 @@
+FICTIONAL CORPORATION
+SOFTWARE EXAMPLE AGREEMENT
+
+You agree that you will not use this app to make nuclear weapons.
+
+You agree that Qbs is the best.
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/eula.txt
new file mode 100644
index 000000000..48a9af57c
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/fr_FR.lproj/eula.txt
@@ -0,0 +1,6 @@
+SOCIÉTÉ FICTIONNEL
+EXEMPLE D'ACCORD DU LOGICIEL
+
+Vous vous engagez à ne pas utiliser cette application pour fabriquer des armes nucléaires.
+
+Vous acceptez que Qbs est le meilleur.
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/hello.icns b/tests/auto/blackbox/testdata-apple/apple-dmg/hello.icns
new file mode 100644
index 000000000..b8ff0c53b
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/hello.icns
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/hello.tif b/tests/auto/blackbox/testdata-apple/apple-dmg/hello.tif
new file mode 100644
index 000000000..b58b4548d
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/hello.tif
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/eula.txt
new file mode 100644
index 000000000..e44c34bb3
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/ja_JP.lproj/eula.txt
@@ -0,0 +1,6 @@
+架空CORPORATION
+ソフトウェア例契約
+
+あなたは核兵器を作るために、このアプリを使用しないことに同意します。
+
+あなたは、QBSがベストであることに同意するものとします。
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/eula.rtf b/tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/eula.rtf
new file mode 100644
index 000000000..5b7c49d56
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/ko_KR.lproj/eula.rtf
@@ -0,0 +1,49 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1265
+{\fonttbl\f0\fnil\fcharset129 AppleSDGothicNeo-Regular;\f1\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
+
+\f0\b\fs24 \cf0 \'c7\'e3\'b1\'b8
+\f1 CORPORATION\
+
+\f0 \'bc\'d2\'c7\'c1\'c6\'ae\'bf\'fe\'be\'ee
+\f1
+\f0 \'bf\'b9
+\f1
+\f0 \'b0\'e8\'be\'e0
+\f1\b0 \
+\
+
+\f0 \'b4\'e7\'bd\'c5\'c0\'ba
+\f1
+\f0 \'b4\'e7\'bd\'c5\'c0\'cc
+\f1
+\f0 \'c7\'d9\'b9\'ab\'b1\'e2\'b8\'a6
+\f1
+\f0 \'b8\'b8\'b5\'e9\'b1\'e2
+\f1
+\f0 \'c0\'a7\'c7\'d8\'c0\'cc
+\f1
+\f0 \'c0\'c0\'bf\'eb
+\f1
+\f0 \'c7\'c1\'b7\'ce\'b1\'d7\'b7\'a5\'c0\'bb
+\f1
+\f0 \'bb\'e7\'bf\'eb\'c7\'cf\'c1\'f6
+\f1
+\f0 \'be\'ca\'c0\'bb
+\f1
+\f0 \'b0\'cd\'bf\'a1
+\f1
+\f0 \'b5\'bf\'c0\'c7\'c7\'d5\'b4\'cf\'b4\'d9
+\f1 .\
+\
+
+\f0 \'b4\'e7\'bd\'c5\'c0\'ba
+\f1 QBS
+\f0 \'b0\'a1
+\f1
+\f0 \'c3\'d6\'b0\'ed\'b6\'f3\'b0\'ed
+\f1
+\f0 \'b5\'bf\'c0\'c7\'c7\'d5\'b4\'cf\'b4\'d9
+\f1 .} \ No newline at end of file
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/main.c b/tests/auto/blackbox/testdata-apple/apple-dmg/main.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/main.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/eula.txt b/tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/eula.txt
new file mode 100644
index 000000000..e2b7adbed
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/ru_RU.lproj/eula.txt
@@ -0,0 +1,6 @@
+FICTIONAL CORPORATION
+SOFTWARE EXAMPLE AGREEMENT
+
+You agree that you will not use this app to make nuclear weapons.
+
+You agree that Qbs is the best.
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16.png b/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16.png
new file mode 100644
index 000000000..60365798f
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16.png
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16@2x.png b/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16@2x.png
new file mode 100644
index 000000000..20369000d
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/white.iconset/icon_16x16@2x.png
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/eula.odt b/tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/eula.odt
new file mode 100644
index 000000000..21345e536
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/zh_CN.lproj/eula.odt
Binary files differ
diff --git a/tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/eula.docx b/tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/eula.docx
new file mode 100644
index 000000000..9e48895ac
--- /dev/null
+++ b/tests/auto/blackbox/testdata-apple/apple-dmg/zh_TW.lproj/eula.docx
Binary files differ
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index f5bad1cbd..9d3364914 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -595,6 +595,12 @@ void TestBlackboxApple::deploymentTarget_data()
}
}
+void TestBlackboxApple::dmg()
+{
+ QDir::setCurrent(testDataDir + "/apple-dmg");
+ QCOMPARE(runQbs(), 0);
+}
+
void TestBlackboxApple::embedInfoPlist()
{
QDir::setCurrent(testDataDir + QLatin1String("/embedInfoPlist"));
diff --git a/tests/auto/blackbox/tst_blackboxapple.h b/tests/auto/blackbox/tst_blackboxapple.h
index ea56d915f..b9bb64104 100644
--- a/tests/auto/blackbox/tst_blackboxapple.h
+++ b/tests/auto/blackbox/tst_blackboxapple.h
@@ -57,6 +57,7 @@ private slots:
void bundleStructure_data();
void deploymentTarget();
void deploymentTarget_data();
+ void dmg();
void embedInfoPlist();
void frameworkStructure();
void iconset();