diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-08-05 14:29:50 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-08-05 15:01:21 +0200 |
commit | e02e262a04ccf9ad0d320074d9260e41492f1b84 (patch) | |
tree | e4f93c043da696ecf0133d4b379185441156da08 | |
parent | a24a43415a33a4e94c16188b7a30ff86a1476647 (diff) | |
download | qutebrowser-e02e262a04ccf9ad0d320074d9260e41492f1b84.tar.gz qutebrowser-e02e262a04ccf9ad0d320074d9260e41492f1b84.zip |
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.
-rw-r--r-- | pytest.ini | 1 | ||||
-rw-r--r-- | tests/end2end/conftest.py | 10 | ||||
-rw-r--r-- | tests/end2end/features/qutescheme.feature | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/pytest.ini b/pytest.ini index a034a27b3..1235efb4b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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: .* diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index f87b84a56..43105d6cb 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -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: diff --git a/tests/end2end/features/qutescheme.feature b/tests/end2end/features/qutescheme.feature index 2325912c5..55e366b4f 100644 --- a/tests/end2end/features/qutescheme.feature +++ b/tests/end2end/features/qutescheme.feature @@ -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 |