fix scrollbar not showing up error, change test_get_stylesheet a bit.

This commit is contained in:
Nathan Isom 2015-10-16 09:56:31 -05:00
parent 57d8ebfb83
commit 27db1ad891
2 changed files with 16 additions and 6 deletions

View File

@ -84,6 +84,7 @@ class CompletionView(QTreeView):
QTreeView QScrollBar {
width: {{ config.get('completion', 'scrollbar.width') }}px;
min-height: 10px;
{{ color['completion.scrollbar.bg'] }}
}

View File

@ -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', ''),