diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-03-16 14:23:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-03-19 09:09:09 +0100 |
commit | dd875e4f6a7b6c6bea7121f701821d7c7ba7f6d0 (patch) | |
tree | b6fd2321911efabadeb4e2cf07de21d91422d34e /sw/qa/extras | |
parent | dac6b7938173d0793810ee5731de51c440c1af5e (diff) |
testcase for fdo#43965
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/rtftok/data/fdo43965.rtf | 16 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 35 |
2 files changed, 51 insertions, 0 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo43965.rtf b/sw/qa/extras/rtftok/data/fdo43965.rtf new file mode 100644 index 000000000000..968fe77e2782 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo43965.rtf @@ -0,0 +1,16 @@ +{\rtf1\ansi\ansicpg1252 +{\fonttbl \f0\froman\fcharset0 Times;\f1\fswiss\fcharset0 Helvetica;} +{\info{\subject Test file for LibreOffice 3.5}} +\margl1440\margr1440\margt1440\margb1440\deftab720\viewkind1\viewscale100 +\pard\pardeftab720\ql\qnatural +\f0\fs36 +{ +{\fs22\up8 2} +}\ +{\box\brdrs Box +}\ +Page feeds:\ + This is on the first page.\ +\page + This is on the second page.\ +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 95fc51b74a1d..c376779d5b0d 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -33,9 +33,11 @@ #include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/SizeType.hpp> +#include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <rtl/oustringostreaminserter.hxx> #include <test/bootstrapfixture.hxx> @@ -64,6 +66,7 @@ public: void testFdo46662(); void testN750757(); void testFdo45563(); + void testFdo43965(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) && !defined(WNT) @@ -76,6 +79,7 @@ public: CPPUNIT_TEST(testFdo46662); CPPUNIT_TEST(testN750757); CPPUNIT_TEST(testFdo45563); + CPPUNIT_TEST(testFdo43965); #endif CPPUNIT_TEST_SUITE_END(); @@ -339,6 +343,37 @@ void RtfModelTest::testFdo45563() CPPUNIT_ASSERT_EQUAL(4, i); } +void RtfModelTest::testFdo43965() +{ + load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo43965.rtf"))); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + + // First paragraph: the parameter of \up was ignored + uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration(); + uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY); + sal_Int32 nValue; + xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapement"))) >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nValue); + xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapementHeight"))) >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue); + + // Second paragraph: Word vs Writer border default problem + xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY); + table::BorderLine2 aBorder; + xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopBorder"))) >>= aBorder; + CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), aBorder.LineWidth); + + // Finally, make sure that we have two pages + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); |