summaryrefslogtreecommitdiff
path: root/sw/qa/extras/unowriter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-21 13:53:24 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-21 18:01:24 +0200
commitbf4b40f720146e7f76dab4deb72e85ea158e2d17 (patch)
tree040496cbceeae0204429177a06fcb37e6f526047 /sw/qa/extras/unowriter
parent98e186a37388d35320b813142b4fc7f0071f5b43 (diff)
sw comments on frames: fix annotation start order in UNO portion enum
The problem was similar to commit 76a4305d1e90b6617054dd33036e64f005dbcf04 (sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames, 2017-12-21), except here we have an (annotation) mark which does have a range, but still around at-char anchored frames, similar to the bookmark situation in that commit. Fix the problem similarly, by first adding comment-start portions to the enumeration, then frames, and finally the rest of the comment portions (as before). With this, an ODF <office:annotation/><draw:frame text:anchor-type="char"/><office:annotation-end/> sequence (commented at-char image) is roundtripped correctly. Change-Id: I8790d9efae625de48c689ca4180fe75f15b4833c Reviewed-on: https://gerrit.libreoffice.org/74503 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras/unowriter')
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 2969b5447675..38c55cfb74dd 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -547,6 +547,20 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar)
// is also the anchor position of the image).
IDocumentMarkAccess* pMarks = pDoc->getIDocumentMarkAccess();
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pMarks->getAnnotationMarksCount());
+
+ uno::Reference<text::XTextRange> xPara = getParagraph(1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Text"),
+ getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
+ // Without the accompanying fix in place, this test would have failed with 'Expected:
+ // Annotation; Actual: Frame', i.e. the comment-start portion was after the commented image.
+ CPPUNIT_ASSERT_EQUAL(OUString("Annotation"),
+ getProperty<OUString>(getRun(xPara, 2), "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Frame"),
+ getProperty<OUString>(getRun(xPara, 3), "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"),
+ getProperty<OUString>(getRun(xPara, 4), "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Text"),
+ getProperty<OUString>(getRun(xPara, 5), "TextPortionType"));
}
CPPUNIT_PLUGIN_IMPLEMENT();