From 0ea7a1457d9fea84abbcc597d860ab4af061f650 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 19 Mar 2018 19:36:27 +0100 Subject: [PATCH] Make test_position_caret work again The tests only work properly with QtWebKit (and aren't needed on QtWebEngine). Also, for some reason the scrolled_down tests only work without Xvfb. --- .../javascript/position_caret/test_position_caret.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/unit/javascript/position_caret/test_position_caret.py b/tests/unit/javascript/position_caret/test_position_caret.py index d62175ed9..06c54bb15 100644 --- a/tests/unit/javascript/position_caret/test_position_caret.py +++ b/tests/unit/javascript/position_caret/test_position_caret.py @@ -24,8 +24,8 @@ import pytest import helpers.utils from PyQt5.QtCore import Qt -from PyQt5.QtWebKit import QWebSettings -from PyQt5.QtWebKitWidgets import QWebPage +QWebSettings = pytest.importorskip("PyQt5.QtWebKit").QWebSettings +QWebPage = pytest.importorskip("PyQt5.QtWebKitWidgets").QWebPage @pytest.fixture(autouse=True) @@ -66,9 +66,9 @@ class CaretTester: @pytest.fixture -def caret_tester(js_tester): +def caret_tester(js_tester_webkit): """Helper fixture to test caret browsing positions.""" - caret_tester = CaretTester(js_tester) + caret_tester = CaretTester(js_tester_webkit) # Showing webview here is necessary for test_scrolled_down_img to # succeed in some cases, see #1988 caret_tester.js.tab.show() @@ -83,6 +83,7 @@ def test_simple(caret_tester): @pytest.mark.integration +@pytest.mark.no_xvfb def test_scrolled_down(caret_tester): """Test with multiple text blocks with the viewport scrolled down.""" caret_tester.js.load('position_caret/scrolled_down.html') @@ -100,6 +101,7 @@ def test_invisible(caret_tester, style): @pytest.mark.integration +@pytest.mark.no_xvfb def test_scrolled_down_img(caret_tester): """Test with an image at the top with the viewport scrolled down.""" caret_tester.js.load('position_caret/scrolled_down_img.html')