Fix StyledText so serialize will match for style list order changes
Fixes #11529
This commit is contained in:
parent
d83fff3b62
commit
26b78c17af
@ -299,6 +299,7 @@ class StyledText:
|
|||||||
"""
|
"""
|
||||||
if self._tags:
|
if self._tags:
|
||||||
the_tags = [tag.serialize() for tag in self._tags]
|
the_tags = [tag.serialize() for tag in self._tags]
|
||||||
|
the_tags.sort()
|
||||||
else:
|
else:
|
||||||
the_tags = []
|
the_tags = []
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ class Test1(unittest.TestCase):
|
|||||||
C = self.C.join([self.A, self.S, deepcopy(self.B)])
|
C = self.C.join([self.A, self.S, deepcopy(self.B)])
|
||||||
C = C.replace('X', StyledText('_', [self.T3]))
|
C = C.replace('X', StyledText('_', [self.T3]))
|
||||||
_C = ('123_456\ncleartext\nabc_def',
|
_C = ('123_456\ncleartext\nabc_def',
|
||||||
[((1, ''), 'v1', [(0, 2), (2, 3)]),
|
[((0, ''), 'v3', [(3, 4)]),
|
||||||
((0, ''), 'v3', [(3, 4)]),
|
((0, ''), 'v3', [(21, 22)]),
|
||||||
|
((1, ''), 'v1', [(0, 2), (2, 3)]),
|
||||||
((1, ''), 'v1', [(4, 6)]),
|
((1, ''), 'v1', [(4, 6)]),
|
||||||
((2, ''), 'v2', [(19, 21), (18, 21)]),
|
((2, ''), 'v2', [(19, 21), (18, 21)]),
|
||||||
((0, ''), 'v3', [(21, 22)]),
|
|
||||||
((2, ''), 'v2', [(22, 23), (22, 25)])])
|
((2, ''), 'v2', [(22, 23), (22, 25)])])
|
||||||
self.assertEqual(C.serialize(), _C)
|
self.assertEqual(C.serialize(), _C)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user