Fix setting monospace fonts with None values

Fixes #3130
This commit is contained in:
Florian Bruhin 2017-10-16 06:18:09 +02:00
parent e003b11670
commit 2a65cadb67
2 changed files with 12 additions and 1 deletions

View File

@ -104,7 +104,9 @@ def _update_monospace_fonts():
continue
elif not isinstance(opt.typ, configtypes.Font):
continue
elif not config.instance.get_obj(name).endswith(' monospace'):
value = config.instance.get_obj(name)
if value is None or not value.endswith(' monospace'):
continue
config.instance.changed.emit(name)

View File

@ -258,6 +258,15 @@ class TestEarlyInit:
# Font subclass, but doesn't end with "monospace"
assert 'fonts.web.family.standard' not in changed_options
def test_setting_monospace_fonts_family(self, init_patch, args):
"""Make sure setting fonts.monospace after a family works.
See https://github.com/qutebrowser/qutebrowser/issues/3130
"""
configinit.early_init(args)
config.instance.set_str('fonts.web.family.standard', '')
config.instance.set_str('fonts.monospace', 'Terminus')
def test_force_software_rendering(self, monkeypatch, config_stub):
"""Setting force_software_rendering should set the environment var."""
envvar = 'QT_XCB_FORCE_SOFTWARE_OPENGL'