diff --git a/tests/unit/mainwindow/statusbar/test_backforward.py b/tests/unit/mainwindow/statusbar/test_backforward.py index b355fcfdf..6e594c0d2 100644 --- a/tests/unit/mainwindow/statusbar/test_backforward.py +++ b/tests/unit/mainwindow/statusbar/test_backforward.py @@ -45,14 +45,22 @@ def test_backforward_widget(backforward_widget, tabbed_browser_stubs, tabbed_browser = tabbed_browser_stubs[0] tabbed_browser.current_index = 1 tabbed_browser.tabs = [tab] + backforward_widget.enabled = True backforward_widget.on_tab_cur_url_changed(tabbed_browser) assert backforward_widget.text() == expected_text assert backforward_widget.isVisible() == bool(expected_text) + # Check that the widget stays hidden if not in the statusbar + backforward_widget.enabled = False + backforward_widget.hide() + backforward_widget.on_tab_cur_url_changed(tabbed_browser) + assert backforward_widget.isHidden() + # Check that the widget gets reset if empty. if can_go_back and can_go_forward: tab = fake_web_tab(can_go_back=False, can_go_forward=False) tabbed_browser.tabs = [tab] + backforward_widget.enabled = True backforward_widget.on_tab_cur_url_changed(tabbed_browser) assert backforward_widget.text() == '' assert not backforward_widget.isVisible() @@ -64,6 +72,7 @@ def test_none_tab(backforward_widget, tabbed_browser_stubs, fake_web_tab): tabbed_browser = tabbed_browser_stubs[0] tabbed_browser.current_index = 1 tabbed_browser.tabs = [tab] + backforward_widget.enabled = True backforward_widget.on_tab_cur_url_changed(tabbed_browser) assert backforward_widget.text() == '[<>]' diff --git a/tests/unit/mainwindow/statusbar/test_percentage.py b/tests/unit/mainwindow/statusbar/test_percentage.py index 91de051d1..c7b5b9fe2 100644 --- a/tests/unit/mainwindow/statusbar/test_percentage.py +++ b/tests/unit/mainwindow/statusbar/test_percentage.py @@ -33,15 +33,21 @@ def percentage(qtbot): return widget -@pytest.mark.parametrize('y, expected', [ - (0, '[top]'), - (100, '[bot]'), - (75, '[75%]'), - (25, '[25%]'), - (5, '[ 5%]'), - (None, '[???]'), +@pytest.mark.parametrize('y, raw, expected', [ + (0, False, '[top]'), + (100, False, '[bot]'), + (75, False, '[75%]'), + (25, False, '[25%]'), + (5, False, '[05%]'), + (None, False, '[???]'), + (0, True, '[top]'), + (100, True, '[bot]'), + (75, True, '[75]'), + (25, True, '[25]'), + (5, True, '[05]'), + (None, True, '[???]'), ]) -def test_percentage_text(percentage, y, expected): +def test_percentage_text(percentage, y, raw, expected): """Test text displayed by the widget based on the y position of a page. Args: @@ -49,6 +55,7 @@ def test_percentage_text(percentage, y, expected): parametrized. expected: expected text given y position. parametrized. """ + percentage.raw = raw percentage.set_perc(x=None, y=y) assert percentage.text() == expected diff --git a/tests/unit/mainwindow/statusbar/test_progress.py b/tests/unit/mainwindow/statusbar/test_progress.py index 763ea1059..6d054a5c9 100644 --- a/tests/unit/mainwindow/statusbar/test_progress.py +++ b/tests/unit/mainwindow/statusbar/test_progress.py @@ -30,6 +30,7 @@ from qutebrowser.utils import usertypes def progress_widget(qtbot, config_stub): """Create a Progress widget and checks its initial state.""" widget = Progress() + widget.enabled = True qtbot.add_widget(widget) assert not widget.isVisible() assert not widget.isTextVisible()