From ceff67e0bab4d34c5b791d1f1b1d43c7a4e44d84 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 2 Dec 2016 13:03:53 +0100 Subject: 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 --- tests/auto/widgets/tests.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets') 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) -- cgit v1.2.3 From 51d5737fa45b62ff9fc769cdb8d3a238dbe9d1cb Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 14 Dec 2016 03:27:32 -0800 Subject: Unskip tst_QWebEnginePage::setHtmlWithStylesheetResource Task-number: QTBUG-51572 Change-Id: Ie8e7e5ef38f88ae91d892b703cd9702b2637daa2 Reviewed-by: Allan Sandfeld Jensen --- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 287af511f..821ab4757 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 = "" "" - "" + "" "" "" "

some text

" @@ -4006,22 +4000,21 @@ void tst_QWebEnginePage::setHtmlWithStylesheetResource() ""; 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() -- cgit v1.2.3