Fix qflags_key comparison.

This commit is contained in:
Florian Bruhin 2015-11-25 18:54:03 +01:00
parent c755a78518
commit 951c2e8eb6
2 changed files with 2 additions and 3 deletions

View File

@ -156,7 +156,7 @@ def qflags_key(base, value, add_base=False, klass=None):
names = []
mask = 0x01
value = int(value)
while mask < value:
while mask <= value:
if value & mask:
bits.append(mask)
mask <<= 1

View File

@ -163,7 +163,7 @@ class TestQFlagsKey:
fixme = pytest.mark.xfail(reason="See issue #42", raises=AssertionError)
@pytest.mark.parametrize('base, value, klass, expected', [
fixme((Qt, Qt.AlignTop, None, 'AlignTop')),
(Qt, Qt.AlignTop, None, 'AlignTop'),
fixme((Qt, Qt.AlignLeft | Qt.AlignTop, None, 'AlignLeft|AlignTop')),
(Qt, Qt.AlignCenter, None, 'AlignHCenter|AlignVCenter'),
fixme((Qt, 0x0021, Qt.Alignment, 'AlignLeft|AlignTop')),
@ -173,7 +173,6 @@ class TestQFlagsKey:
flags = debug.qflags_key(base, value, klass=klass)
assert flags == expected
@fixme
def test_add_base(self):
"""Test with add_base=True."""
flags = debug.qflags_key(Qt, Qt.AlignTop, add_base=True)