diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-06-09 10:22:17 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-06-09 10:22:17 +0200 |
commit | 96149c7e28e41a2d65464fee81b364b3f2474e64 (patch) | |
tree | e905a26064aa0cd7c633b4709cd116bb8d92da88 /tests | |
parent | e6261ad92ef138b7eac1266a7f20133ff6bc0ece (diff) | |
download | qutebrowser-96149c7e28e41a2d65464fee81b364b3f2474e64.tar.gz qutebrowser-96149c7e28e41a2d65464fee81b364b3f2474e64.zip |
Add content.prefers_reduced_motion
Closes #6530
Diffstat (limited to 'tests')
-rw-r--r-- | tests/end2end/data/prefers_reduced_motion.html | 38 | ||||
-rw-r--r-- | tests/end2end/test_invocations.py | 20 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/end2end/data/prefers_reduced_motion.html b/tests/end2end/data/prefers_reduced_motion.html new file mode 100644 index 000000000..a37d43864 --- /dev/null +++ b/tests/end2end/data/prefers_reduced_motion.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>Prefers reduced motion test</title> + <style> +#reduce-text { + display: none; +} +#no-preference-text { + display: none; +} + +@media (prefers-reduced-motion: no-preference) { + #no-preference-text { + display: inline; + } + #missing-support-text { + display: none; + } +} + +@media (prefers-reduced-motion: reduce) { + #reduce-text { + display: inline; + } + #missing-support-text { + display: none; + } +} + </style> + </head> + <body> + <p id="reduce-text">Reduced motion preference detected.</p> + <p id="no-preference-text">No preference detected.</p> + <p id="missing-support-text">Preference support missing.</p> + </body> +</html> diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 71cbfcb90..971be903c 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -752,6 +752,26 @@ def test_dark_mode_mathml(quteproc_new, request, qtbot): ) +@testutils.qt514 +@pytest.mark.parametrize('value, preference', [ + ('true', 'Reduced motion'), + ('false', 'No'), +]) +def test_prefers_reduced_motion(quteproc_new, request, qtbot, value, preference): + if not request.config.webengine: + pytest.skip("Skipped with QtWebKit") + + args = _base_args(request.config) + [ + '--temp-basedir', + '-s', 'content.prefers_reduced_motion', value, + ] + quteproc_new.start(args) + + quteproc_new.open_path('data/prefers_reduced_motion.html') + content = quteproc_new.get_content() + assert content == f"{preference} preference detected." + + def test_unavailable_backend(request, quteproc_new): """Test starting with a backend which isn't available. |