Add a simple benchmark for _update_tab_titles

This commit is contained in:
Jay Kamat 2017-10-26 17:56:28 -04:00
parent cb6f4313d7
commit 97d719b179
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -52,3 +52,21 @@ class TestTabWidget:
with qtbot.waitExposed(widget):
widget.show()
def test_update_tab_titles_benchmark(self, benchmark, widget,
qtbot, fake_web_tab):
"""Benchmark for update_tab_titles."""
widget.addTab(fake_web_tab(), 'foobar')
widget.addTab(fake_web_tab(), 'foobar2')
widget.addTab(fake_web_tab(), 'foobar3')
widget.addTab(fake_web_tab(), 'foobar4')
with qtbot.waitExposed(widget):
widget.show()
def bench():
for _a in range(1000):
# pylint: disable=protected-access
widget._update_tab_titles()
# pylint: enable=protected-access
benchmark(bench)