summaryrefslogtreecommitdiff
path: root/tests/unit/misc/test_miscwidgets.py
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-02-06 15:48:58 +0100
committerFlorian Bruhin <git@the-compiler.org>2017-02-06 16:22:58 +0100
commit29ffa3d134f869f248b28c5ed984c8b40f2298ac (patch)
tree58c04148ce7c9f94de74249c8a79bc096d579415 /tests/unit/misc/test_miscwidgets.py
parent39508d984e97b7315e506acdc38bba7d7b5bf3fd (diff)
downloadqutebrowser-29ffa3d134f869f248b28c5ed984c8b40f2298ac.tar.gz
qutebrowser-29ffa3d134f869f248b28c5ed984c8b40f2298ac.zip
Add a fullscreen notification overlay
From the spec: User agents should ensure, e.g. by means of an overlay, that the end user is aware something is displayed fullscreen. User agents should provide a means of exiting fullscreen that always works and advertise this to the user. This is to prevent a site from spoofing the end user by recreating the user agent or even operating system environment when fullscreen. https://fullscreen.spec.whatwg.org/#security-and-privacy-considerations
Diffstat (limited to 'tests/unit/misc/test_miscwidgets.py')
-rw-r--r--tests/unit/misc/test_miscwidgets.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/misc/test_miscwidgets.py b/tests/unit/misc/test_miscwidgets.py
index 3e25d0080..dd17ac254 100644
--- a/tests/unit/misc/test_miscwidgets.py
+++ b/tests/unit/misc/test_miscwidgets.py
@@ -100,3 +100,26 @@ class TestWrapperLayout:
def test_wrapped(self, container):
assert container.wrapped.parent() is container
assert container.focusProxy() is container.wrapped
+
+
+class TestFullscreenNotification:
+
+ @pytest.mark.parametrize('bindings, text', [
+ ({'<escape>': 'fullscreen --leave'},
+ "Press Escape to exit fullscreen."),
+ ({'<escape>': 'fullscreen'}, "Page is now fullscreen."),
+ ({'a': 'fullscreen --leave'}, "Press a to exit fullscreen."),
+ ({}, "Page is now fullscreen."),
+ ])
+ def test_text(self, qtbot, key_config_stub, bindings, text):
+ key_config_stub.set_bindings_for('normal', bindings)
+ w = miscwidgets.FullscreenNotification()
+ qtbot.add_widget(w)
+ assert w.text() == text
+
+ def test_timeout(self, qtbot, key_config_stub):
+ key_config_stub.set_bindings_for('normal', {})
+ w = miscwidgets.FullscreenNotification()
+ qtbot.add_widget(w)
+ with qtbot.waitSignal(w.destroyed):
+ w.set_timeout(1)