diff options
author | toofar <toofar@spalge.com> | 2024-01-29 23:28:29 +1300 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2024-02-06 12:36:17 +1300 |
commit | 88cfc1c3edbfcadec35ba9653e2d9b7608bdb5a2 (patch) | |
tree | c38f876c7148333413e5a59c3d51809c0c869340 | |
parent | afa2efbdf6cc660e0c9a76036a608142a84d11d8 (diff) | |
download | qutebrowser-88cfc1c3edbfcadec35ba9653e2d9b7608bdb5a2.tar.gz qutebrowser-88cfc1c3edbfcadec35ba9653e2d9b7608bdb5a2.zip |
Fix tab widget benchmark tests
In 8aa88b83e I added a dependency in the TabWidget in
`parent.is_shutting_down` (assuming parent is a TabbedBrowser, but
without updating the type hints...).
Since the benchmark test wasn't setting a parent it's been breaking
since then, oops.
That's going to be breaking all the branches based off of the tree tabs
branch, so we should probably cherry pick this back to the
tree-tabs-integration branch. And consider updating the
TabWidget parent kwarg type hint (and make the dummpy parent a
mock/spy/double of the TabbedBrowser I guess).
Not sure where the size of 640x480 came from before hand but when I
added a parent it went to 100x30.
-rw-r--r-- | tests/unit/mainwindow/test_tabwidget.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index a249a6d1c..59defeb50 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -11,6 +11,7 @@ import pytest from unittest.mock import Mock from qutebrowser.qt.gui import QIcon, QPixmap +from qutebrowser.qt.widgets import QWidget from qutebrowser.mainwindow import tabwidget from qutebrowser.utils import usertypes @@ -21,7 +22,14 @@ class TestTabWidget: @pytest.fixture def widget(self, qtbot, monkeypatch, config_stub): - w = tabwidget.TabWidget(0) + class DummyParent(QWidget): + def __init__(self): + super().__init__() + self.is_shutting_down = False + self.show() + + w = tabwidget.TabWidget(0, parent=DummyParent()) + w.resize(640, 480) qtbot.add_widget(w) monkeypatch.setattr(tabwidget.objects, 'backend', usertypes.Backend.QtWebKit) |