From 7cb32dca078c3af873536c14dac3fa4d7ef9084f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 8 Sep 2018 13:36:02 +0200 Subject: [PATCH] Add a container around webkit_tab This makes the selection appear properly in caret tests - otherwise, --no-xvfb would be needed. --- tests/helpers/fixtures.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 1c37301cf..e8321e1f1 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -157,9 +157,22 @@ def webkit_tab(qtbot, tab_registry, cookiejar_and_cache, mode_manager, session_manager_stub, greasemonkey_manager, fake_args, host_blocker_stub): webkittab = pytest.importorskip('qutebrowser.browser.webkit.webkittab') + + container = QWidget() + qtbot.add_widget(container) + + vbox = QVBoxLayout(container) tab = webkittab.WebKitTab(win_id=0, mode_manager=mode_manager, private=False) - qtbot.add_widget(tab) + vbox.addWidget(tab) + # to make sure container isn't GCed + # pylint: disable=attribute-defined-outside-init + tab.container = container + # pylint: enable=attribute-defined-outside-init + + with qtbot.waitExposed(container): + container.show() + return tab