summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2016-12-02 13:03:53 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-01-10 09:26:47 +0000
commitceff67e0bab4d34c5b791d1f1b1d43c7a4e44d84 (patch)
treea8e2c65b769a6eac13fbc037001475367414487e /tests
parent017cf5e691290fb667847866e68e84ec3fcdb516 (diff)
Fix font load error messages inside non-app-bundle tests
Some fonts were failing to load in tests because macOS does not consider some font paths when an application is built without an Info.plist file (as is the case for a non-bundle application). It is possible though to embed a plist file into the executable by passing the path to the file as a linker argument. This change generates an Info.plist for each test, and embeds it into the final executable, thus fixing the font problems. Task-number: QTBUG-57354 Change-Id: I4c3c29442b9d308ee6a327645054a67c4b008ef8 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/Info.plist.in18
-rw-r--r--tests/auto/core/tests.pri3
-rw-r--r--tests/auto/embed_info_plist.pri13
-rw-r--r--tests/auto/quick/tests.pri4
-rw-r--r--tests/auto/widgets/tests.pri3
5 files changed, 37 insertions, 4 deletions
diff --git a/tests/auto/Info.plist.in b/tests/auto/Info.plist.in
new file mode 100644
index 000000000..e7f314042
--- /dev/null
+++ b/tests/auto/Info.plist.in
@@ -0,0 +1,18 @@
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
+<plist version=\"1.0\">
+<dict>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleExecutable</key>
+ <string>$${TARGET}</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.qt-project.qt.tests.$${TARGET_HYPHENATED}</string>
+ <key>CFBundleName</key>
+ <string>$${TARGET}</string>
+ <key>LSUIElement</key>
+ <string>0</string>
+</dict>
+</plist>
diff --git a/tests/auto/core/tests.pri b/tests/auto/core/tests.pri
index 606ed2a8c..19f53f12d 100644
--- a/tests/auto/core/tests.pri
+++ b/tests/auto/core/tests.pri
@@ -12,4 +12,5 @@ INCLUDEPATH += $$PWD
exists($$_PRO_FILE_PWD_/$${TARGET}.qrc): RESOURCES += $${TARGET}.qrc
QT += testlib network webenginewidgets widgets
-osx: CONFIG -= app_bundle
+
+include(../embed_info_plist.pri)
diff --git a/tests/auto/embed_info_plist.pri b/tests/auto/embed_info_plist.pri
new file mode 100644
index 000000000..cca93c35e
--- /dev/null
+++ b/tests/auto/embed_info_plist.pri
@@ -0,0 +1,13 @@
+macos {
+ CONFIG -= app_bundle
+
+ # QTBUG-57354 embed Info.plist so that certain fonts can be found in non-bundle apps
+ out_info = $$OUT_PWD/Info.plist
+ embed_info_plist.input = $$PWD/Info.plist.in
+ embed_info_plist.output = $$out_info
+ TARGET_HYPHENATED = $$replace(TARGET, [^a-zA-Z0-9-.], -)
+ QMAKE_SUBSTITUTES += embed_info_plist
+ QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,$$shell_quote($$out_info)
+ PRE_TARGETDEPS += $$out_info
+ QMAKE_DISTCLEAN += $$out_info
+}
diff --git a/tests/auto/quick/tests.pri b/tests/auto/quick/tests.pri
index efe9ff9d0..e00537b9e 100644
--- a/tests/auto/quick/tests.pri
+++ b/tests/auto/quick/tests.pri
@@ -13,11 +13,11 @@ INCLUDEPATH += \
QT += testlib network quick webengine
-macx: CONFIG -= app_bundle
-
# This define is used by some tests to look up resources in the source tree
DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
isQMLTestSupportApiEnabled() {
DEFINES += ENABLE_QML_TESTSUPPORT_API
}
+
+include(../embed_info_plist.pri)
diff --git a/tests/auto/widgets/tests.pri b/tests/auto/widgets/tests.pri
index 14074cd08..d77cd5af5 100644
--- a/tests/auto/widgets/tests.pri
+++ b/tests/auto/widgets/tests.pri
@@ -13,7 +13,8 @@ RESOURCES += ../resources/tests.qrc
exists($$_PRO_FILE_PWD_/$${TARGET}.qrc): RESOURCES += $${TARGET}.qrc
QT += testlib network webenginewidgets widgets quick quickwidgets
-macx: CONFIG -= app_bundle
# This define is used by some tests to look up resources in the source tree
DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
+
+include(../embed_info_plist.pri)