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

Miklos Vajna vmiklos at collabora.co.uk
Tue Feb 7 09:20:34 UTC 2017


 sw/qa/extras/rtfexport/data/leveljc-center.rtf |   22 ++++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx           |   22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)

New commits:
commit dd2837ac654cbebac44dee7558232629bff6f49a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 7 09:08:51 2017 +0100

    sw RTF filter: add \leveljc1 testcase
    
    lcov pointed out this had no coverage previously (unlike the 0 and the 2
    case).
    
    Change-Id: Iaa480015d1ddfe7c489a3cbbf079a38d20e6d45c
    Reviewed-on: https://gerrit.libreoffice.org/33987
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/qa/extras/rtfexport/data/leveljc-center.rtf b/sw/qa/extras/rtfexport/data/leveljc-center.rtf
new file mode 100644
index 0000000..f559f06
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/leveljc-center.rtf
@@ -0,0 +1,22 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
+\noqfpromote 
+{\*\listtable
+{\list\listtemplateid139628226\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc1\leveljcn1\levelfollow0\levelstartat1\levelspace360\levelindent0
+{\leveltext
+\leveltemplateid2049739134\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0\hres0\chhres0 \fi-360\li720\lin720 }
+{\listname ;}
+\listid1549801677}
+}
+{\*\listoverridetable
+{\listoverride\listid1549801677\listoverridecount0\ls1}
+}
+{\listtext\pard\plain\ltrpar \s15 \rtlch\fcs1 \af31507\afs22 \ltrch\fcs0 \f31506\fs22\insrsid10952771 \hich\af31506\dbch\af31506\loch\f31506 1.\tab}
+\pard\plain \ltrpar\s15\ql \fi-360\li720\ri0\sa200\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\pararsid10952771\contextualspace \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 
+{\rtlch\fcs1 \af31507 
+\ltrch\fcs0 \insrsid10952771 X
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 710b7853..cf09769 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
 #include <com/sun/star/text/RubyAdjust.hpp>
 #include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
 
 #include <vcl/svapp.hxx>
 
@@ -1158,6 +1159,27 @@ DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf")
     CPPUNIT_FAIL("no BulletChar property");
 }
 
+DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf")
+{
+    // Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule.
+    uno::Reference<text::XTextRange> xPara(getParagraph(1));
+    uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xLevels(properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+    uno::Sequence<beans::PropertyValue> aProps;
+    xLevels->getByIndex(0) >>= aProps;
+    for (int i = 0; i < aProps.getLength(); ++i)
+    {
+        if (aProps[i].Name == "Adjust")
+        {
+            sal_Int16 nValue = 0;
+            CPPUNIT_ASSERT(aProps[i].Value >>= nValue);
+            CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
+            return;
+        }
+    }
+    CPPUNIT_FAIL("no Adjust property");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list