Fix tabs appearing when updating all tab titles

Closes #4295
This commit is contained in:
Jay Kamat 2018-10-05 18:14:12 -07:00
parent fd48e29a54
commit 2f155e5d2b
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 9 additions and 1 deletions

View File

@ -225,8 +225,8 @@ class TabWidget(QTabWidget):
non-visible. To avoid flickering, disable repaint updates whlie we
work.
"""
toggle = self.count() > 10
bar = self.tabBar()
toggle = self.count() > 10 and bar.isVisible()
if toggle:
bar.setUpdatesEnabled(False)
bar.setVisible(False)

View File

@ -134,6 +134,14 @@ class TestTabWidget:
config_stub.val.tabs.max_width = max_size
assert widget.tabBar().tabRect(0).width() == max_size
def test_tab_stays_hidden(self, widget, fake_web_tab, config_stub):
assert widget.tabBar().isVisible()
config_stub.val.tabs.show = "never"
assert not widget.tabBar().isVisible()
for i in range(12):
widget.addTab(fake_web_tab(), 'foobar' + str(i))
assert not widget.tabBar().isVisible()
@pytest.mark.parametrize("num_tabs", [4, 100])
@pytest.mark.parametrize("rev", [True, False])
def test_add_remove_tab_benchmark(self, benchmark, widget,