test_conftypes: Use qenum_key for Font.__repr__

This commit is contained in:
Florian Bruhin 2014-08-07 07:35:25 +02:00
parent 2546c871c8
commit 956f6ef5e6

View File

@ -25,6 +25,7 @@ from collections import namedtuple
import qutebrowser.config.conftypes as conftypes
from qutebrowser.test.stubs import FakeCmdUtils, FakeCommand
from qutebrowser.utils.debug import qenum_key
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QColor, QFont
@ -36,9 +37,10 @@ class Font(QFont):
"""A QFont with a nicer repr()."""
def __repr__(self):
return 'Font("{}", {}, {}, {})'.format(
self.family(), self.pointSize(), self.weight(),
self.style() & QFont.StyleItalic)
return '<Font family={}, pt={}, px={}, weight={}, style={}>'.format(
self.family(), self.pointSize(), self.pixelSize(),
qenum_key(QFont, self.weight(), add_base=True, klass=QFont.Weight),
self.style())
@classmethod
def fromdesc(cls, desc):