[Libreoffice-commits] core.git: sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Feb 19 15:50:57 CET 2014


 sw/qa/extras/odfimport/data/annotation-formatting.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx                  |   11 +++++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 1733b678417085f17f07e0018fda08fc70b84621
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Feb 19 15:45:46 2014 +0100

    CppunitTest_sw_odfimport: add annotation formatting testcase
    
    Most probably this was fixed by 0761f81643a6890457e9ef7d913ab5c88c2593a4
    (123792: complete annotations on text ranges feature, 2013-12-19).
    
    Change-Id: Ic712c1a33271081205901ddbf5d629d6f2198126

diff --git a/sw/qa/extras/odfimport/data/annotation-formatting.odt b/sw/qa/extras/odfimport/data/annotation-formatting.odt
new file mode 100644
index 0000000..ce8d98f
Binary files /dev/null and b/sw/qa/extras/odfimport/data/annotation-formatting.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 8f7f8a7..8fa14b4 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -10,6 +10,7 @@
 
 #if !defined(MACOSX) && !defined(WNT)
 
+#include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/style/PageStyleLayout.hpp>
 #include <com/sun/star/table/XCell.hpp>
 #include <com/sun/star/table/BorderLine.hpp>
@@ -437,6 +438,16 @@ DECLARE_ODFIMPORT_TEST(testSpellmenuRedline, "spellmenu-redline.odt")
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_PREV_CHANGE), aPopup.GetItemId(aPopup.GetItemCount() - 1));
 }
 
+DECLARE_ODFIMPORT_TEST(testAnnotationFormatting, "annotation-formatting.odt")
+{
+    uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 1), "TextField");
+    uno::Reference<text::XText> xText = getProperty< uno::Reference<text::XText> >(xTextField, "TextRange");
+    // Make sure we test the right annotation.
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "Looses: bold");
+    // Formatting was lost: the second text portion was NORMAL, not BOLD.
+    CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(xParagraph, 2), "CharWeight"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list