Clean up tab min/max width tests
This commit is contained in:
parent
e01682f51d
commit
d64771b8e3
@ -38,7 +38,8 @@ class TestTabWidget:
|
|||||||
qtbot.addWidget(w)
|
qtbot.addWidget(w)
|
||||||
monkeypatch.setattr(tabwidget.objects, 'backend',
|
monkeypatch.setattr(tabwidget.objects, 'backend',
|
||||||
usertypes.Backend.QtWebKit)
|
usertypes.Backend.QtWebKit)
|
||||||
monkeypatch.setattr(w.tabBar(), 'width', w.width)
|
w.show()
|
||||||
|
# monkeypatch.setattr(w.tabBar(), 'width', w.width)
|
||||||
return w
|
return w
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -130,20 +131,16 @@ class TestTabWidget:
|
|||||||
benchmark(widget.update_tab_titles)
|
benchmark(widget.update_tab_titles)
|
||||||
|
|
||||||
def test_tab_min_width(self, widget, fake_web_tab, config_stub):
|
def test_tab_min_width(self, widget, fake_web_tab, config_stub):
|
||||||
"""Ensure by default, all tab sizes are the same."""
|
|
||||||
widget.addTab(fake_web_tab(), 'foobar')
|
widget.addTab(fake_web_tab(), 'foobar')
|
||||||
normal_size = widget.tabBar().minimumTabSizeHint(0).width()
|
normal_size = widget.tabBar().tabRect(0).width() + 100
|
||||||
normal_size += 100
|
|
||||||
config_stub.val.tabs.min_width = normal_size
|
config_stub.val.tabs.min_width = normal_size
|
||||||
assert widget.tabBar().minimumTabSizeHint(0).width() == normal_size
|
assert widget.tabBar().tabRect(0).width() == normal_size
|
||||||
|
|
||||||
def test_tab_max_width(self, widget, fake_web_tab, config_stub):
|
def test_tab_max_width(self, widget, fake_web_tab, config_stub):
|
||||||
"""Ensure by default, all tab sizes are the same."""
|
|
||||||
widget.addTab(fake_web_tab(), 'foobar')
|
widget.addTab(fake_web_tab(), 'foobar')
|
||||||
normal_size = widget.tabBar().tabSizeHint(0).width()
|
normal_size = widget.tabBar().tabRect(0).width() - 10
|
||||||
normal_size -= 10
|
|
||||||
config_stub.val.tabs.max_width = normal_size
|
config_stub.val.tabs.max_width = normal_size
|
||||||
assert widget.tabBar().tabSizeHint(0).width() == normal_size
|
assert widget.tabBar().tabRect(0).width() == normal_size
|
||||||
|
|
||||||
@pytest.mark.parametrize("num_tabs", [4, 10])
|
@pytest.mark.parametrize("num_tabs", [4, 10])
|
||||||
def test_add_remove_tab_benchmark(self, benchmark, browser,
|
def test_add_remove_tab_benchmark(self, benchmark, browser,
|
||||||
|
Loading…
Reference in New Issue
Block a user