tests: Skip pdf.js disabled test on QtWebKit with PDF image plugin

Since Qt 5.15, QtWebEngine comes with Qt PDF as TP:
https://wiki.qt.io/New_Features_in_Qt_5.15#Technology_Preview_Modules

This also includes a new PDF image plugin in
/usr/lib/qt/plugins/imageformats/libqpdf.so. Due to that, QtWebKit now displays the
PDF's first page as image rather than triggering a download.

See https://github.com/qtwebkit/qtwebkit/issues/1013

Thus, detect this condition (both QtWebKit and QtWebEngine installed) and skip the test
in that scenario.
This commit is contained in:
Florian Bruhin 2020-08-05 14:29:50 +02:00
parent a24a43415a
commit e02e262a04
3 changed files with 11 additions and 1 deletions

View File

@ -38,6 +38,7 @@ markers =
unicode_locale: Tests which need an unicode locale to work
qtwebkit6021_xfail: Tests which would fail on WebKit version 602.1
js_headers: Sets JS headers dynamically on QtWebEngine (unsupported on some versions)
qtwebkit_pdf_imageformat_skip: Broken on QtWebKit with PDF image format plugin installed
qt_log_level_fail = WARNING
qt_log_ignore =
^SpellCheck: .*

View File

@ -28,9 +28,10 @@ import sys
import shutil
import pstats
import operator
import pathlib
import pytest
from PyQt5.QtCore import PYQT_VERSION
from PyQt5.QtCore import PYQT_VERSION, QCoreApplication
pytest.register_assert_rewrite('end2end.fixtures')
@ -142,6 +143,9 @@ def pytest_collection_modifyitems(config, items):
header_bug_fixed = (not qtutils.version_check('5.12', compiled=False) or
qtutils.version_check('5.15', compiled=False))
lib_path = pathlib.Path(QCoreApplication.libraryPaths()[0])
qpdf_image_plugin = lib_path / 'imageformats' / 'libqpdf.so'
markers = [
('qtwebengine_todo', 'QtWebEngine TODO', pytest.mark.xfail,
config.webengine),
@ -160,6 +164,10 @@ def pytest_collection_modifyitems(config, items):
('js_headers', 'Sets headers dynamically via JS',
pytest.mark.skipif,
config.webengine and not header_bug_fixed),
('qtwebkit_pdf_imageformat_skip',
'Skipped with QtWebKit if PDF image plugin is available',
pytest.mark.skipif,
not config.webengine and qpdf_image_plugin.exists()),
]
for item in items:

View File

@ -177,6 +177,7 @@ Feature: Special qute:// pages
And I open data/misc/test.pdf without waiting
Then the javascript message "PDF * [*] (PDF.js: *)" should be logged
@qtwebkit_pdf_imageformat_skip
Scenario: pdfjs is not used when disabled
When I set content.pdfjs to false
And I set downloads.location.prompt to false