From 27db1ad8916f8509673ff118028efe106c10a626 Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Fri, 16 Oct 2015 09:56:31 -0500 Subject: [PATCH] fix scrollbar not showing up error, change test_get_stylesheet a bit. --- qutebrowser/completion/completionwidget.py | 1 + tests/unit/config/test_style.py | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 50f31d8a3..e10b9cfdd 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -84,6 +84,7 @@ class CompletionView(QTreeView): QTreeView QScrollBar { width: {{ config.get('completion', 'scrollbar.width') }}px; + min-height: 10px; {{ color['completion.scrollbar.bg'] }} } diff --git a/tests/unit/config/test_style.py b/tests/unit/config/test_style.py index 53cce823a..ae8ca1833 100644 --- a/tests/unit/config/test_style.py +++ b/tests/unit/config/test_style.py @@ -27,15 +27,25 @@ from PyQt5.QtGui import QColor from qutebrowser.config import style -def test_get_stylesheet(config_stub): +@pytest.mark.parametrize('template, expected', [ + ("{{ color['completion.bg'] }}", "background-color: black;"), + ("{{ color['completion.fg'] }}", "color: red;"), + ("{{ font['completion'] }}", "font: foo;"), + ("{{ config.get('foo', 'bar') }}", "baz"), +]) +def test_get_stylesheet(config_stub, template, expected): config_stub.data = { - 'colors': {'completion.bg': 'black'}, - 'fonts': {'completion': 'foo'}, + 'colors': { + 'completion.bg': 'black', + 'completion.fg': 'red', + }, + 'fonts': { + 'completion': 'foo', + }, 'foo': {'bar': 'baz'}, } - template = "{{ color['completion.bg'] }}\n{{ font['completion'] }}" rendered = style.get_stylesheet(template) - assert rendered == 'background-color: black;\nfont: foo;' + assert rendered == expected class Obj(QObject): @@ -106,7 +116,6 @@ class TestColorDict: with pytest.raises(TypeError): d['foo'] # pylint: disable=pointless-statement - @pytest.mark.parametrize('key, expected', [ ('foo', 'font: one;'), ('bar', ''),