summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-01-18 12:59:54 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-01-18 13:02:22 +0100
commitc2447a308882ba3691d66b2c28df197f571518c7 (patch)
treec6535d8e038a517f06ddbef9fee649412555b8ae /tests
parentb63a932bbe1eb2bdf2584e44378ac3fab243320c (diff)
parent42c6033724e2b5a54702d626c57806e53f163c62 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
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/qwebenginepage/tst_qwebenginepage.cpp33
-rw-r--r--tests/auto/widgets/tests.pri3
6 files changed, 50 insertions, 24 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/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index d7fff3a66..5467ce39e 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -3989,16 +3989,10 @@ void tst_QWebEnginePage::setHtmlWithImageResource()
void tst_QWebEnginePage::setHtmlWithStylesheetResource()
{
-#if !defined(QWEBENGINEELEMENT)
- QSKIP("QWEBENGINEELEMENT");
-#else
- // By default, only security origins of local files can load local resources.
- // So we should specify baseUrl to be a local file in order to be able to download the local stylesheet.
-
const char* htmlData =
"<html>"
"<head>"
- "<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
+ "<link rel='stylesheet' href='qrc:/resources/style.css' type='text/css' />"
"</head>"
"<body>"
"<p id='idP'>some text</p>"
@@ -4006,22 +4000,21 @@ void tst_QWebEnginePage::setHtmlWithStylesheetResource()
"</html>";
QLatin1String html(htmlData);
QWebEnginePage page;
- QWebEngineElement webElement;
-
- page.setHtml(html, QUrl(QLatin1String("qrc:///file")));
QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
- QVERIFY(spyFinished.wait(200));
- webElement = page.documentElement().findFirst("p");
- QCOMPARE(webElement.styleProperty("color", QWebEngineElement::CascadedStyle), QLatin1String("red"));
- // Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
+ // We allow access to qrc resources from any security origin, including local and anonymous
+ page.setHtml(html, QUrl("file:///path/to/file"));
+ QVERIFY(spyFinished.wait());
+ QCOMPARE(evaluateJavaScriptSync(&page, "window.getComputedStyle(document.getElementById('idP')).color").toString(), QString("rgb(255, 0, 0)"));
+
+ page.setHtml(html, QUrl(QLatin1String("qrc:/")));
+ QVERIFY(spyFinished.wait());
+ QCOMPARE(evaluateJavaScriptSync(&page, "window.getComputedStyle(document.getElementById('idP')).color").toString(), QString("rgb(255, 0, 0)"));
- page.setHtml(html, QUrl(QLatin1String("http://www.example.com/")));
- QVERIFY(spyFinished.wait(200));
- webElement = page.documentElement().findFirst("p");
- QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
- QCOMPARE(webElement.styleProperty("color", QWebEngineElement::CascadedStyle), QString());
-#endif
+ // Now we test the opposite: without a baseUrl as a local file, we can still request qrc resources.
+ page.setHtml(html);
+ QVERIFY(spyFinished.wait());
+ QCOMPARE(evaluateJavaScriptSync(&page, "window.getComputedStyle(document.getElementById('idP')).color").toString(), QString("rgb(255, 0, 0)"));
}
void tst_QWebEnginePage::setHtmlWithBaseURL()
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)