Fix zero handling in qflags_key
This commit is contained in:
parent
046401c489
commit
4cd977cab6
@ -156,6 +156,10 @@ def qflags_key(base, value, add_base=False, klass=None):
|
|||||||
klass = value.__class__
|
klass = value.__class__
|
||||||
if klass == int:
|
if klass == int:
|
||||||
raise TypeError("Can't guess enum class of an int!")
|
raise TypeError("Can't guess enum class of an int!")
|
||||||
|
|
||||||
|
if not value:
|
||||||
|
return qenum_key(base, value, add_base, klass)
|
||||||
|
|
||||||
bits = []
|
bits = []
|
||||||
names = []
|
names = []
|
||||||
mask = 0x01
|
mask = 0x01
|
||||||
|
@ -138,6 +138,7 @@ class TestQEnumKey:
|
|||||||
(QFrame, QFrame.Sunken, None, 'Sunken'),
|
(QFrame, QFrame.Sunken, None, 'Sunken'),
|
||||||
(QFrame, 0x0030, QFrame.Shadow, 'Sunken'),
|
(QFrame, 0x0030, QFrame.Shadow, 'Sunken'),
|
||||||
(QFrame, 0x1337, QFrame.Shadow, '0x1337'),
|
(QFrame, 0x1337, QFrame.Shadow, '0x1337'),
|
||||||
|
(Qt, Qt.AnchorLeft, None, 'AnchorLeft'),
|
||||||
])
|
])
|
||||||
def test_qenum_key(self, base, value, klass, expected):
|
def test_qenum_key(self, base, value, klass, expected):
|
||||||
key = debug.qenum_key(base, value, klass=klass)
|
key = debug.qenum_key(base, value, klass=klass)
|
||||||
@ -168,6 +169,8 @@ class TestQFlagsKey:
|
|||||||
(Qt, Qt.AlignCenter, None, 'AlignHCenter|AlignVCenter'),
|
(Qt, Qt.AlignCenter, None, 'AlignHCenter|AlignVCenter'),
|
||||||
fixme((Qt, 0x0021, Qt.Alignment, 'AlignLeft|AlignTop')),
|
fixme((Qt, 0x0021, Qt.Alignment, 'AlignLeft|AlignTop')),
|
||||||
(Qt, 0x1100, Qt.Alignment, '0x0100|0x1000'),
|
(Qt, 0x1100, Qt.Alignment, '0x0100|0x1000'),
|
||||||
|
(Qt, Qt.DockWidgetAreas(0), Qt.DockWidgetArea, 'NoDockWidgetArea'),
|
||||||
|
(Qt, Qt.DockWidgetAreas(0), None, '0x0000'),
|
||||||
])
|
])
|
||||||
def test_qflags_key(self, base, value, klass, expected):
|
def test_qflags_key(self, base, value, klass, expected):
|
||||||
flags = debug.qflags_key(base, value, klass=klass)
|
flags = debug.qflags_key(base, value, klass=klass)
|
||||||
|
Loading…
Reference in New Issue
Block a user