From 26b78c17affc211a48b293e19cd71792e39eb2c9 Mon Sep 17 00:00:00 2001 From: prculley Date: Sun, 12 Jan 2020 10:16:39 -0600 Subject: [PATCH] Fix StyledText so serialize will match for style list order changes Fixes #11529 --- gramps/gen/lib/styledtext.py | 1 + gramps/gen/lib/test/styledtext_test.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gramps/gen/lib/styledtext.py b/gramps/gen/lib/styledtext.py index 0dc2f087e..0b6800f1d 100644 --- a/gramps/gen/lib/styledtext.py +++ b/gramps/gen/lib/styledtext.py @@ -299,6 +299,7 @@ class StyledText: """ if self._tags: the_tags = [tag.serialize() for tag in self._tags] + the_tags.sort() else: the_tags = [] diff --git a/gramps/gen/lib/test/styledtext_test.py b/gramps/gen/lib/test/styledtext_test.py index 0d0485f74..cb17b4c4b 100644 --- a/gramps/gen/lib/test/styledtext_test.py +++ b/gramps/gen/lib/test/styledtext_test.py @@ -64,11 +64,11 @@ class Test1(unittest.TestCase): C = self.C.join([self.A, self.S, deepcopy(self.B)]) C = C.replace('X', StyledText('_', [self.T3])) _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)]), ((2, ''), 'v2', [(19, 21), (18, 21)]), - ((0, ''), 'v3', [(21, 22)]), ((2, ''), 'v2', [(22, 23), (22, 25)])]) self.assertEqual(C.serialize(), _C)