From d64771b8e35f8030369bb455cc811cdd98046d6a Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 27 Sep 2018 18:57:26 -0700 Subject: [PATCH] Clean up tab min/max width tests --- tests/unit/mainwindow/test_tabwidget.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index d29c61c0f..dba9f8f02 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -38,7 +38,8 @@ class TestTabWidget: qtbot.addWidget(w) monkeypatch.setattr(tabwidget.objects, 'backend', usertypes.Backend.QtWebKit) - monkeypatch.setattr(w.tabBar(), 'width', w.width) + w.show() + # monkeypatch.setattr(w.tabBar(), 'width', w.width) return w @pytest.fixture @@ -130,20 +131,16 @@ class TestTabWidget: benchmark(widget.update_tab_titles) 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') - normal_size = widget.tabBar().minimumTabSizeHint(0).width() - normal_size += 100 + normal_size = widget.tabBar().tabRect(0).width() + 100 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): - """Ensure by default, all tab sizes are the same.""" widget.addTab(fake_web_tab(), 'foobar') - normal_size = widget.tabBar().tabSizeHint(0).width() - normal_size -= 10 + normal_size = widget.tabBar().tabRect(0).width() - 10 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]) def test_add_remove_tab_benchmark(self, benchmark, browser,