summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-01-18 12:48:09 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-18 14:03:51 +0100
commit4144858f99764003db549645944f5ddae7b7f6aa (patch)
tree8dde509875e2a17239e0dfacac61d5793a77a722 /sw
parent1abdfeee5fd0e25c92cd180b2c0b5cba6c901ebc (diff)
sw: add testcase for RTF_LEVELFOLLOW import
I almost broke this during refactoring... Change-Id: If38e73f3b7d66e97bbcbad87447b8aa611ff79d1
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfimport/data/levelfollow.rtf38
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx13
2 files changed, 51 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/levelfollow.rtf b/sw/qa/extras/rtfimport/data/levelfollow.rtf
new file mode 100644
index 000000000000..b35027640805
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/levelfollow.rtf
@@ -0,0 +1,38 @@
+{\rtf1
+{\*\listtable
+{\list\listtemplateid1194210988\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow1\levelstartat1\levelspace0\levelindent0
+{\leveltext
+\leveltemplateid-1922248890\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0\hres0\chhres0 \fi-360\li720\lin720 }
+\listid451049142}
+{\list\listtemplateid-229602660\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0
+\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid67698703\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li720\lin720 }
+\listid1067075036}
+{\list\listtemplateid-2074719740\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow2\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid-641807334\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0
+\fbias0\hres0\chhres0 \fi-360\li720\lin720 }
+\listid1455825451}
+}
+{\*\listoverridetable
+{\listoverride\listid1067075036\listoverridecount0\ls1}
+{\listoverride\listid451049142\listoverridecount0\ls2}
+{\listoverride\listid1455825451\listoverridecount0\ls3
+}
+}
+{\pard\plain Before first.\par}
+{\pard\plain \ls1 This has tab suffix. \par }
+{\pard\plain After first, before second.\par}
+{\pard\plain \ls2 This has space suffix. \par }
+{\pard\plain After second, before third.\par}
+{\pard\plain \ls3 This has no suffix. \par }
+{\pard\plain After third.\par}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2534099cda3e..8b1dc94bed76 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -46,6 +46,7 @@
#include <vcl/svapp.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <bordertest.hxx>
@@ -1405,6 +1406,18 @@ DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf")
CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque")));
}
+DECLARE_RTFIMPORT_TEST(testLevelfollow, "levelfollow.rtf")
+{
+ uno::Reference<container::XIndexAccess> xNum1Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::LISTTAB), comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, tab
+
+ uno::Reference<container::XIndexAccess> xNum2Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum2"), "NumberingRules");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::SPACE), comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, space
+
+ uno::Reference<container::XIndexAccess> xNum3Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum3"), "NumberingRules");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::NOTHING), comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, nothing
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */