summaryrefslogtreecommitdiff
path: root/tests/unit/browser/test_history.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-14 20:10:38 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-14 20:10:38 +0100
commitfd4f0663e76e9ff9f8e11ac6a8c3b40e4c700bc2 (patch)
tree6aae2481fbe95087388576c46b7d5ca7e4193ce3 /tests/unit/browser/test_history.py
parentf1b925e37fea016939a35126bfc29a0c3e2d547b (diff)
downloadqutebrowser-fd4f0663e76e9ff9f8e11ac6a8c3b40e4c700bc2.tar.gz
qutebrowser-fd4f0663e76e9ff9f8e11ac6a8c3b40e4c700bc2.zip
Revert "history: Simplify HistoryProgress"
Seems to cause random dialogs This reverts commit f1b925e37fea016939a35126bfc29a0c3e2d547b.
Diffstat (limited to 'tests/unit/browser/test_history.py')
-rw-r--r--tests/unit/browser/test_history.py51
1 files changed, 32 insertions, 19 deletions
diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py
index 1aa873503..876ffb9bc 100644
--- a/tests/unit/browser/test_history.py
+++ b/tests/unit/browser/test_history.py
@@ -498,22 +498,35 @@ class TestCompletionMetaInfo:
assert metainfo['excluded_patterns'] == value
-def test_history_progress(qtbot):
- progress = history.HistoryProgress()
- progress.start("Hello World")
- dialog = progress._progress
- qtbot.add_widget(dialog)
- progress.tick()
-
- assert dialog.isVisible()
- assert dialog.labelText() == "Hello World"
- assert dialog.minimum() == 0
- assert dialog.value() == 1
- assert dialog.minimumDuration() == 0
-
- assert dialog.maximum() == 0
- progress.set_maximum(42)
- assert dialog.maximum() == 42
-
- progress.finish()
- assert not dialog.isVisible()
+class TestHistoryProgress:
+
+ @pytest.fixture
+ def progress(self):
+ return history.HistoryProgress()
+
+ def test_no_start(self, progress):
+ """Test calling tick/finish without start."""
+ progress.tick()
+ assert progress._value == 1
+ progress.finish()
+ assert progress._progress is None
+ assert progress._value == 0
+
+ def test_gui(self, qtbot, progress):
+ progress.start("Hello World")
+ dialog = progress._progress
+ qtbot.add_widget(dialog)
+ progress.tick()
+
+ assert dialog.isVisible()
+ assert dialog.labelText() == "Hello World"
+ assert dialog.minimum() == 0
+ assert dialog.value() == 1
+ assert dialog.minimumDuration() == 0
+
+ assert dialog.maximum() == 0
+ progress.set_maximum(42)
+ assert dialog.maximum() == 42
+
+ progress.finish()
+ assert not dialog.isVisible()