[Libreoffice-commits] .: sw/qa

Miklos Vajna vmiklos at kemper.freedesktop.org
Thu Mar 1 02:42:27 PST 2012


 sw/qa/extras/rtftok/data/fdo46662.rtf |   46 ++++++++++++++++++++++++++++++++++
 sw/qa/extras/rtftok/rtftok.cxx        |   35 +++++++++++++++++++++++++
 2 files changed, 81 insertions(+)

New commits:
commit 7029ccec25bc0b15f9cea463ea3713e802eafc08
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Mar 1 11:38:47 2012 +0100

    testcase for fdo#46662

diff --git a/sw/qa/extras/rtftok/data/fdo46662.rtf b/sw/qa/extras/rtftok/data/fdo46662.rtf
new file mode 100644
index 0000000..db93c9c
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo46662.rtf
@@ -0,0 +1,46 @@
+{\rtf1
+{\*\listtable
+{\list\listtemplateid3
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'01\'00;}
+{\levelnumbers\'01;}
+\fi-360\li720\lin720 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'03\'00.\'01;}
+{\levelnumbers\'01\'03;}
+\fi-360\li1080\lin1080 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'05\'00.\'01.\'02;}
+{\levelnumbers\'01\'03\'05;}
+\fi-360\li1440\lin1440 
+}
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'07\'00.\'01.\'02.\'03;}
+{\levelnumbers\'01\'03\'05\'07;}
+\fi-360\li1800\lin1800 }
+\listid3}
+}
+{\*\listoverridetable
+{\listoverride\listid3\listoverridecount0\ls3}
+}
+\pard\ls3
+{numbering with all sublevels: test 1
+\par 
+}
+\pard\ls3\ilvl1
+{test 1.1
+\par 
+}
+\pard\ls3\ilvl2
+{test 1.1.1
+\par 
+}
+\pard\ls3\ilvl3
+{test 1.1.1.1
+\par
+}
+\pard\ls3
+{test 2
+\par
+}
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 0e4a31b..1174626 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
@@ -60,6 +61,7 @@ public:
     void testN695479();
     void testFdo42465();
     void testFdo45187();
+    void testFdo46662();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -69,6 +71,7 @@ public:
     CPPUNIT_TEST(testN695479);
     CPPUNIT_TEST(testFdo42465);
     CPPUNIT_TEST(testFdo45187);
+    CPPUNIT_TEST(testFdo46662);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -266,6 +269,38 @@ void RtfModelTest::testFdo45187()
     CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
 }
 
+void RtfModelTest::testFdo46662()
+{
+    load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo46662.rtf")));
+
+    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xNumberingStyles(xStyles->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingStyles"))), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropertySet(xNumberingStyles->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("WWNum3"))), uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingRules"))), uno::UNO_QUERY);
+    uno::Any aValue = xLevels->getByIndex(1); // 2nd level
+    uno::Sequence<beans::PropertyValue> aProps;
+    aValue >>= aProps;
+
+    for (int i = 0; i < aProps.getLength(); ++i)
+    {
+        const beans::PropertyValue& rProp = aProps[i];
+
+        if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ParentNumbering")))
+        {
+            sal_Int16 nValue;
+            rProp.Value >>= nValue;
+            CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nValue);
+        }
+        else if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Suffix")))
+        {
+            rtl::OUString sValue;
+            rProp.Value >>= sValue;
+            CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sValue.getLength());
+        }
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list