From c381d4b124b6dd8bb800402817750436cba06ee9 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 21 Dec 2022 15:29:58 +0100 Subject: QTextImageHandler: Resolve Nx images correctly for file or qrc URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The qt_findAtNxFile helper in qicon.cpp expects a local file name that can be probed with QFile::exists. If the src attribute of an element specifies the location of the image as a file:/ or qrc:/ url rather than as a local file name, then we need to strip the scheme off the file path, and in the case of a qrc URL leave the :/ prefix before calling the qt_findAtNxFile helper. Amends, and partially reverts, 760df7256588e76d082ea959399af36d7ba80a86. We can't avoid testing whether the source in the HTML is provided as a URL before interpreting it as a file name. Fixes: QTBUG-109212 Change-Id: I7ea7a5bfde79bab90a8025c42e754129813dd0fc Reviewed-by: Tor Arne Vestbø (cherry picked from commit 2d87c4d881b74619fef966ffb0d7a00cb4ccea50) Reviewed-by: Volker Hilsheimer --- tests/auto/gui/text/qtextimagehandler/tst_qtextimagehandler.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/text/qtextimagehandler/tst_qtextimagehandler.cpp b/tests/auto/gui/text/qtextimagehandler/tst_qtextimagehandler.cpp index fc8900f94f..a0f5e4c133 100644 --- a/tests/auto/gui/text/qtextimagehandler/tst_qtextimagehandler.cpp +++ b/tests/auto/gui/text/qtextimagehandler/tst_qtextimagehandler.cpp @@ -96,13 +96,6 @@ void tst_QTextImageHandler::loadAtNImages() p.end(); QVERIFY(!img.isNull()); const auto expectedColor = dpr == 1 ? Qt::red : Qt::green; -#ifdef Q_OS_ANDROID // On Android, file:/ fails completely - QEXPECT_FAIL("file_url", "file:/ schema not handled - QTBUG-109212", Continue); -#else - if (dpr != 1) - QEXPECT_FAIL("file_url", "Nx images not resolved for file:/ schema - QTBUG-109212", Continue); -#endif - QEXPECT_FAIL("qrc_url", "qrc:/ schema not handled - QTBUG-109212", Continue); QCOMPARE(img.pixelColor(0, 0), expectedColor); } } -- cgit v1.2.3