LCOV - code coverage report
Current view: top level - sw/qa/extras/rtfimport - rtfimport.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1198 1206 99.3 %
Date: 2014-11-03 Functions: 1368 1540 88.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  */
       8             : 
       9             : #include <swmodeltestbase.hxx>
      10             : 
      11             : #include <com/sun/star/awt/FontDescriptor.hpp>
      12             : #include <com/sun/star/awt/FontUnderline.hpp>
      13             : #include <com/sun/star/awt/FontWeight.hpp>
      14             : #include <com/sun/star/document/XFilter.hpp>
      15             : #include <com/sun/star/document/XImporter.hpp>
      16             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      17             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      18             : #include <com/sun/star/drawing/FillStyle.hpp>
      19             : #include <com/sun/star/drawing/LineStyle.hpp>
      20             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      21             : #include <com/sun/star/graphic/GraphicType.hpp>
      22             : #include <com/sun/star/lang/XServiceInfo.hpp>
      23             : #include <com/sun/star/style/BreakType.hpp>
      24             : #include <com/sun/star/style/CaseMap.hpp>
      25             : #include <com/sun/star/style/LineSpacing.hpp>
      26             : #include <com/sun/star/style/LineSpacingMode.hpp>
      27             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      28             : #include <com/sun/star/style/TabStop.hpp>
      29             : #include <com/sun/star/table/BorderLine2.hpp>
      30             : #include <com/sun/star/table/BorderLineStyle.hpp>
      31             : #include <com/sun/star/text/RelOrientation.hpp>
      32             : #include <com/sun/star/text/SizeType.hpp>
      33             : #include <com/sun/star/text/TableColumnSeparator.hpp>
      34             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      35             : #include <com/sun/star/text/XFootnotesSupplier.hpp>
      36             : #include <com/sun/star/text/XPageCursor.hpp>
      37             : #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
      38             : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      39             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      40             : #include <com/sun/star/text/XTextRangeCompare.hpp>
      41             : #include <com/sun/star/text/XTextTablesSupplier.hpp>
      42             : #include <com/sun/star/text/XTextTable.hpp>
      43             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      44             : #include <com/sun/star/text/WrapTextMode.hpp>
      45             : #include <com/sun/star/text/HoriOrientation.hpp>
      46             : #include <com/sun/star/text/VertOrientation.hpp>
      47             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      48             : 
      49             : #include <rtl/ustring.hxx>
      50             : #include <vcl/outdev.hxx>
      51             : #include <vcl/svapp.hxx>
      52             : #include <vcl/settings.hxx>
      53             : #include <unotools/ucbstreamhelper.hxx>
      54             : #include <unotools/streamwrap.hxx>
      55             : #include <comphelper/sequenceashashmap.hxx>
      56             : 
      57             : #include <bordertest.hxx>
      58             : 
      59         340 : class Test : public SwModelTestBase
      60             : {
      61             : public:
      62         340 :     Test() : SwModelTestBase("/sw/qa/extras/rtfimport/data/", "Rich Text Format")
      63             :     {
      64         340 :     }
      65             : 
      66         340 :     virtual void preTest(const char* filename) SAL_OVERRIDE
      67             :     {
      68         340 :         m_aSavedSettings = Application::GetSettings();
      69         340 :         if (OString(filename) == "fdo48023.rtf")
      70             :         {
      71           2 :             AllSettings aSettings(m_aSavedSettings);
      72           2 :             aSettings.SetLanguageTag(LanguageTag("ru"));
      73           2 :             Application::SetSettings(aSettings);
      74             :         }
      75         338 :         else if (OString(filename) == "fdo44211.rtf")
      76             :         {
      77           2 :             AllSettings aSettings(m_aSavedSettings);
      78           2 :             aSettings.SetLanguageTag(LanguageTag("lt"));
      79           2 :             Application::SetSettings(aSettings);
      80             :         }
      81         340 :     }
      82             : 
      83         340 :     virtual void postTest(const char* filename) SAL_OVERRIDE
      84             :     {
      85         340 :         if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo44211.rtf")
      86           4 :             Application::SetSettings(m_aSavedSettings);
      87         340 :     }
      88             : 
      89             : protected:
      90             :     /// Copy&paste helper.
      91             : #if !defined WNT
      92          14 :     void paste(const OUString& aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>())
      93             :     {
      94          14 :         uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
      95          28 :         uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW);
      96          14 :         xImporter->setTargetDocument(mxComponent);
      97          28 :         uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2);
      98          14 :         aDescriptor[0].Name = "InputStream";
      99          14 :         SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, STREAM_WRITE);
     100          28 :         uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream));
     101          14 :         aDescriptor[0].Value <<= xStream;
     102          14 :         aDescriptor[1].Name = "InsertMode";
     103          14 :         aDescriptor[1].Value <<= sal_True;
     104          14 :         if (xTextRange.is())
     105             :         {
     106          12 :             aDescriptor[2].Name = "TextInsertModeRange";
     107          12 :             aDescriptor[2].Value <<= xTextRange;
     108             :         }
     109          28 :         xFilter->filter(aDescriptor);
     110          14 :     }
     111             : #endif
     112             : 
     113             :     AllSettings m_aSavedSettings;
     114             : };
     115             : 
     116             : #if !defined(WNT)
     117             : 
     118          18 : DECLARE_RTFIMPORT_TEST(testFdo45553, "fdo45553.rtf")
     119             : {
     120           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     121           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     122           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     123           8 :     while (xParaEnum->hasMoreElements())
     124             :     {
     125           4 :         uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     126           8 :         uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     127          12 :         while (xRangeEnum->hasMoreElements())
     128             :         {
     129           4 :             uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
     130           8 :             OUString aStr = xRange->getString();
     131           4 :             if (aStr == "space-before")
     132           2 :                 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)), getProperty<sal_Int32>(xRange, "ParaTopMargin"));
     133           2 :             else if (aStr == "space-after")
     134           2 :                 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)), getProperty<sal_Int32>(xRange, "ParaBottomMargin"));
     135           4 :         }
     136           6 :     }
     137           2 : }
     138             : 
     139          18 : DECLARE_RTFIMPORT_TEST(testN192129, "n192129.rtf")
     140             : {
     141             :     // We expect that the result will be 16x16px.
     142           2 :     Size aExpectedSize(16, 16);
     143           2 :     MapMode aMap(MAP_100TH_MM);
     144           2 :     aExpectedSize = Application::GetDefaultDevice()->PixelToLogic(aExpectedSize, aMap);
     145             : 
     146           4 :     uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY);
     147           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
     148           4 :     uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     149           2 :     awt::Size aActualSize(xShape->getSize());
     150             : 
     151           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width);
     152           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
     153           2 : }
     154             : 
     155          18 : DECLARE_RTFIMPORT_TEST(testFdo45543, "fdo45543.rtf")
     156             : {
     157           2 :     CPPUNIT_ASSERT_EQUAL(5, getLength());
     158           2 : }
     159             : 
     160          18 : DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf")
     161             : {
     162           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     163           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     164           4 :     uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     165             : 
     166             :     // Negative ABSH should mean fixed size.
     167           2 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xPropertySet, "SizeType"));
     168           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(300)), getProperty<sal_Int32>(xPropertySet, "Height"));
     169             : 
     170           4 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     171           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     172           2 :     bool bFrameFound = false, bDrawFound = false;
     173           8 :     for (int i = 0; i < xDraws->getCount(); ++i)
     174             :     {
     175           6 :         uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(i), uno::UNO_QUERY);
     176           6 :         if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
     177             :         {
     178             :             // Both frames should be anchored to the first paragraph.
     179           4 :             bFrameFound = true;
     180           4 :             uno::Reference<text::XTextContent> xTextContent(xServiceInfo, uno::UNO_QUERY);
     181           8 :             uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
     182           8 :             uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
     183           4 :             CPPUNIT_ASSERT_EQUAL(OUString("plain"), xText->getString());
     184             : 
     185           4 :             if (i == 0)
     186             :                 // Additionally, the frist frame should have double border at the bottom.
     187           4 :                 CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, getProperty<table::BorderLine2>(xPropertySet, "BottomBorder").LineStyle);
     188             :         }
     189           2 :         else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape"))
     190             :         {
     191             :             // The older "drawing objects" syntax should be recognized.
     192           2 :             bDrawFound = true;
     193           2 :             xPropertySet.set(xServiceInfo, uno::UNO_QUERY);
     194           2 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation"));
     195           2 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "VertOrientRelation"));
     196             :         }
     197           6 :     }
     198           2 :     CPPUNIT_ASSERT(bFrameFound);
     199           4 :     CPPUNIT_ASSERT(bDrawFound);
     200           2 : }
     201             : 
     202          18 : DECLARE_RTFIMPORT_TEST(testFdo42465, "fdo42465.rtf")
     203             : {
     204           2 :     CPPUNIT_ASSERT_EQUAL(3, getLength());
     205           2 : }
     206             : 
     207          18 : DECLARE_RTFIMPORT_TEST(testFdo45187, "fdo45187.rtf")
     208             : {
     209           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     210           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     211             :     // There should be two shapes.
     212           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
     213             : 
     214             :     // They should be anchored to different paragraphs.
     215           4 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     216           4 :     uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xTextDocument->getText(), uno::UNO_QUERY);
     217           4 :     uno::Reference<text::XTextRange> xAnchor0 = uno::Reference<text::XTextContent>(xDraws->getByIndex(0), uno::UNO_QUERY)->getAnchor();
     218           4 :     uno::Reference<text::XTextRange> xAnchor1 = uno::Reference<text::XTextContent>(xDraws->getByIndex(1), uno::UNO_QUERY)->getAnchor();
     219             :     // Was 0 ("starts at the same position"), should be 1 ("starts before")
     220           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
     221           2 : }
     222             : 
     223          18 : DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
     224             : {
     225           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
     226           4 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
     227           4 :     uno::Sequence<beans::PropertyValue> aProps;
     228           2 :     xLevels->getByIndex(1) >>= aProps; // 2nd level
     229             : 
     230          26 :     for (int i = 0; i < aProps.getLength(); ++i)
     231             :     {
     232          24 :         const beans::PropertyValue& rProp = aProps[i];
     233             : 
     234          24 :         if (rProp.Name == "ParentNumbering")
     235           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get<sal_Int16>());
     236          22 :         else if (rProp.Name == "Suffix")
     237           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
     238           2 :     }
     239           2 : }
     240             : 
     241          18 : DECLARE_RTFIMPORT_TEST(testN750757, "n750757.rtf")
     242             : {
     243           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     244           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     245           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     246             : 
     247           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin")));
     248           4 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin")));
     249           2 : }
     250             : 
     251          18 : DECLARE_RTFIMPORT_TEST(testFdo45563, "fdo45563.rtf")
     252             : {
     253           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     254           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     255           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     256           2 :     int i = 0;
     257          12 :     while (xParaEnum->hasMoreElements())
     258             :     {
     259           8 :         xParaEnum->nextElement();
     260           8 :         i++;
     261             :     }
     262           4 :     CPPUNIT_ASSERT_EQUAL(4, i);
     263           2 : }
     264             : 
     265          18 : DECLARE_RTFIMPORT_TEST(testFdo43965, "fdo43965.rtf")
     266             : {
     267           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     268           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     269           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     270             : 
     271             :     // First paragraph: the parameter of \up was ignored
     272           4 :     uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     273           4 :     uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     274           4 :     uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
     275           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty<sal_Int32>(xPropertySet, "CharEscapement"));
     276           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight"));
     277             : 
     278             :     // Second paragraph: Word vs Writer border default problem
     279           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth);
     280             : 
     281             :     // Finally, make sure that we have two pages
     282           4 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     283           2 : }
     284             : 
     285          18 : DECLARE_RTFIMPORT_TEST(testN751020, "n751020.rtf")
     286             : {
     287           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     288           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     289           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     290           2 :     CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
     291           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(200)), getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin"));
     292           2 : }
     293             : 
     294          18 : DECLARE_RTFIMPORT_TEST(testFdo79384, "fdo79384.rtf")
     295             : {
     296           2 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
     297             : 
     298           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Маркеры спискамЫ", 31, RTL_TEXTENCODING_UTF8), xTextRange->getString());
     299           2 : }
     300             : 
     301          18 : DECLARE_RTFIMPORT_TEST(testFdo47326, "fdo47326.rtf")
     302             : {
     303             :     // This was 15 only, as \super buffered text, then the contents of it got lost.
     304           2 :     CPPUNIT_ASSERT_EQUAL(19, getLength());
     305           2 : }
     306             : 
     307          18 : DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf")
     308             : {
     309           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     310           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     311           2 :     int nAtCharacter = 0;
     312           8 :     for (int i = 0; i < xDraws->getCount(); ++i)
     313             :     {
     314           6 :         if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AT_CHARACTER)
     315           2 :             nAtCharacter++;
     316             :     }
     317             :     // The image at the document start was ignored.
     318           2 :     CPPUNIT_ASSERT_EQUAL(1, nAtCharacter);
     319             : 
     320             :     // There should be 2 textboxes, not 4
     321           4 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     322           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     323           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
     324           2 : }
     325             : 
     326          18 : DECLARE_RTFIMPORT_TEST(testFdo46955, "fdo46955.rtf")
     327             : {
     328           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     329           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     330           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     331           6 :     while (xParaEnum->hasMoreElements())
     332             :     {
     333           2 :         uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     334           4 :         uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     335           6 :         while (xRangeEnum->hasMoreElements())
     336           2 :             CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap"));
     337           4 :     }
     338           2 : }
     339             : 
     340          18 : DECLARE_RTFIMPORT_TEST(testFdo81892, "fdo81892.rtf")
     341             : {
     342             :     // table was not centered
     343           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     344           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     345           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     346           2 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient"));
     347             : 
     348             :     // fdo#81893: paragraph with \page was not centered
     349           4 :     uno::Reference<text::XTextRange> xPara(getParagraph(2, "Performance"));
     350           4 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust")));
     351           2 : }
     352             : 
     353          18 : DECLARE_RTFIMPORT_TEST(testFdo45394, "fdo45394.rtf")
     354             : {
     355           2 :     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
     356           4 :     OUString aActual = xHeaderText->getString();
     357             :     // Encoding in the header was wrong.
     358           4 :     OUString aExpected("\xd0\x9f\xd0\x9a \xd0\xa0\xd0\x98\xd0\x9a", 11, RTL_TEXTENCODING_UTF8);
     359           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     360             : 
     361           4 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     362           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     363           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     364           2 : }
     365             : 
     366          18 : DECLARE_RTFIMPORT_TEST(testFdo48104, "fdo48104.rtf")
     367             : {
     368           2 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     369           2 : }
     370             : 
     371          18 : DECLARE_RTFIMPORT_TEST(testFdo47107, "fdo47107.rtf")
     372             : {
     373           2 :     uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
     374             :     // Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
     375           2 :     xNumberingStyles->getByName("WWNum1");
     376           2 :     xNumberingStyles->getByName("WWNum2");
     377           2 : }
     378             : 
     379          18 : DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf")
     380             : {
     381           2 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     382           4 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
     383           4 :     uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
     384             :     // Encoding in the footnote was wrong.
     385           4 :     OUString aExpected("\xc5\xbeivnost\xc3\xad\n", 11, RTL_TEXTENCODING_UTF8);
     386           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     387           2 : }
     388             : 
     389          18 : DECLARE_RTFIMPORT_TEST(testFdo44176, "fdo44176.rtf")
     390             : {
     391           2 :     uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
     392           4 :     uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
     393           4 :     uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     394           2 :     sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
     395           2 :     xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
     396           2 :     xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
     397           2 :     xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
     398           4 :     CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
     399           2 : }
     400             : 
     401          18 : DECLARE_RTFIMPORT_TEST(testFdo39053, "fdo39053.rtf")
     402             : {
     403           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     404           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     405           2 :     int nAsCharacter = 0;
     406           4 :     for (int i = 0; i < xDraws->getCount(); ++i)
     407           2 :         if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AS_CHARACTER)
     408           2 :             nAsCharacter++;
     409             :     // The image in binary format was ignored.
     410           4 :     CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
     411           2 : }
     412             : 
     413          18 : DECLARE_RTFIMPORT_TEST(testFdo48356, "fdo48356.rtf")
     414             : {
     415           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     416           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     417           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     418           2 :     int i = 0;
     419           6 :     while (xParaEnum->hasMoreElements())
     420             :     {
     421           2 :         xParaEnum->nextElement();
     422           2 :         i++;
     423             :     }
     424             :     // The document used to be imported as two paragraphs.
     425           4 :     CPPUNIT_ASSERT_EQUAL(1, i);
     426           2 : }
     427             : 
     428          18 : DECLARE_RTFIMPORT_TEST(testFdo48023, "fdo48023.rtf")
     429             : {
     430           2 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
     431             : 
     432             :     // Implicit encoding detection based on locale was missing
     433           4 :     OUString aExpected("\xd0\x9f\xd1\x80\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd0\xbc\xd0\xbc\xd0\xb8\xd1\x81\xd1\x82", 22, RTL_TEXTENCODING_UTF8);
     434           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     435           2 : }
     436             : 
     437          18 : DECLARE_RTFIMPORT_TEST(testFdo48876, "fdo48876.rtf")
     438             : {
     439           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     440           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     441           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     442           2 :     CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
     443           4 :     CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode);
     444           2 : }
     445             : 
     446          18 : DECLARE_RTFIMPORT_TEST(testFdo48193, "fdo48193.rtf")
     447             : {
     448           2 :     CPPUNIT_ASSERT_EQUAL(7, getLength());
     449           2 : }
     450             : 
     451          18 : DECLARE_RTFIMPORT_TEST(testFdo44211, "fdo44211.rtf")
     452             : {
     453           2 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
     454             : 
     455           4 :     OUString aExpected("\xc4\x85\xc4\x8d\xc4\x99", 6, RTL_TEXTENCODING_UTF8);
     456           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     457           2 : }
     458             : 
     459          18 : DECLARE_RTFIMPORT_TEST(testFdo48037, "fdo48037.rtf")
     460             : {
     461           2 :     uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
     462           4 :     lang::Locale aUSLocale, aFRLocale;
     463           2 :     aUSLocale.Language = "en";
     464           2 :     aFRLocale.Language = "fr";
     465           2 :     sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale);
     466             : 
     467           4 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     468           4 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     469           4 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     470           4 :     uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
     471           2 :     sal_Int32 nActual = 0;
     472           2 :     xPropertySet->getPropertyValue("NumberFormat") >>= nActual;
     473             : 
     474           4 :     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
     475           2 : }
     476             : 
     477          18 : DECLARE_RTFIMPORT_TEST(testFdo47764, "fdo47764.rtf")
     478             : {
     479             :     // \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
     480           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getParagraph(1), "ParaBackColor"));
     481           2 : }
     482             : 
     483          18 : DECLARE_RTFIMPORT_TEST(testFdo38786, "fdo38786.rtf")
     484             : {
     485           2 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     486           4 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     487           4 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     488             :     // \chpgn was ignored, so exception was thrown
     489           4 :     xFields->nextElement();
     490           2 : }
     491             : 
     492          18 : DECLARE_RTFIMPORT_TEST(testN757651, "n757651.rtf")
     493             : {
     494             :     // The bug was that due to buggy layout the text expanded to two pages.
     495           2 :     if (Application::GetDefaultDevice()->IsFontAvailable(OUString("Times New Roman")))
     496           0 :         CPPUNIT_ASSERT_EQUAL(1, getPages());
     497           2 : }
     498             : 
     499          18 : DECLARE_RTFIMPORT_TEST(testFdo49501, "fdo49501.rtf")
     500             : {
     501           2 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     502             : 
     503           2 :     CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStyle, "IsLandscape"));
     504           2 :     sal_Int32 nExpected(convertTwipToMm100(567));
     505           2 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "LeftMargin"));
     506           2 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "RightMargin"));
     507           2 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "TopMargin"));
     508           2 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "BottomMargin"));
     509           2 : }
     510             : 
     511          18 : DECLARE_RTFIMPORT_TEST(testFdo49271, "fdo49271.rtf")
     512             : {
     513           2 :     CPPUNIT_ASSERT_EQUAL(25.f, getProperty<float>(getParagraph(2), "CharHeight"));
     514           2 : }
     515             : 
     516          18 : DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf")
     517             : {
     518           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
     519           4 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
     520           4 :     uno::Sequence<beans::PropertyValue> aProps;
     521           2 :     xLevels->getByIndex(0) >>= aProps; // 1st level
     522             : 
     523          26 :     for (int i = 0; i < aProps.getLength(); ++i)
     524             :     {
     525          24 :         const beans::PropertyValue& rProp = aProps[i];
     526             : 
     527          24 :         if (rProp.Name == "Suffix")
     528           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
     529           2 :     }
     530           2 : }
     531             : 
     532          18 : DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf")
     533             : {
     534             :     // inherited \fi should be reset
     535           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
     536             : 
     537             :     // but direct one not
     538           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-100)), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent"));
     539           2 : }
     540             : 
     541          18 : DECLARE_RTFIMPORT_TEST(testFdo50539, "fdo50539.rtf")
     542             : {
     543             :     // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black)
     544           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor"));
     545           2 : }
     546             : 
     547          18 : DECLARE_RTFIMPORT_TEST(testFdo79599, "fdo79599.rtf")
     548             : {
     549             :     // test for \highlightNN, document has full \colortbl (produced in MS Word 2003 or 2007)
     550             : 
     551             :     // ignore \highlight0
     552           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor"));
     553             : 
     554             :     // test \highlight2 = yellow
     555           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFFFF00), getProperty<sal_uInt32>(getRun(getParagraph(2), 1), "CharBackColor"));
     556             : 
     557             :     // test \highlight3 = green
     558           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), getProperty<sal_uInt32>(getRun(getParagraph(3), 1), "CharBackColor"));
     559             : 
     560             :     // test \highlight4 = cyan
     561           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FFFF), getProperty<sal_uInt32>(getRun(getParagraph(4), 1), "CharBackColor"));
     562             : 
     563             :     // test \highlight5 = magenta
     564           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF00FF), getProperty<sal_uInt32>(getRun(getParagraph(5), 1), "CharBackColor"));
     565             : 
     566             :     // test \highlight6 = blue
     567           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0000FF), getProperty<sal_uInt32>(getRun(getParagraph(6), 1), "CharBackColor"));
     568             : 
     569             :     // test \highlight7 = red
     570           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), getProperty<sal_uInt32>(getRun(getParagraph(7), 1), "CharBackColor"));
     571             : 
     572             :     // test \highlight8 = dark blue
     573           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x000080), getProperty<sal_uInt32>(getRun(getParagraph(8), 1), "CharBackColor"));
     574             : 
     575             :     // test \highlight9 = dark cyan
     576           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x008080), getProperty<sal_uInt32>(getRun(getParagraph(9), 1), "CharBackColor"));
     577             : 
     578             :     // test \highlight10 = dark green
     579           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x008000), getProperty<sal_uInt32>(getRun(getParagraph(10), 1), "CharBackColor"));
     580             : 
     581             :     // test \highlight11 = dark magenta
     582           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800080), getProperty<sal_uInt32>(getRun(getParagraph(11), 1), "CharBackColor"));
     583             : 
     584             :     // test \highlight12 = dark red
     585           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x800000), getProperty<sal_uInt32>(getRun(getParagraph(12), 1), "CharBackColor"));
     586             : 
     587             :     // test \highlight13 = dark yellow
     588           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x808000), getProperty<sal_uInt32>(getRun(getParagraph(13), 1), "CharBackColor"));
     589             : 
     590             :     // test \highlight14 = dark gray
     591           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x808080), getProperty<sal_uInt32>(getRun(getParagraph(14), 1), "CharBackColor"));
     592             : 
     593             :     // test \highlight15 = light gray
     594           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xC0C0C0), getProperty<sal_uInt32>(getRun(getParagraph(15), 1), "CharBackColor"));
     595             : 
     596             :     // test \highlight1 = black
     597           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x000000), getProperty<sal_uInt32>(getRun(getParagraph(16), 1), "CharBackColor"));
     598           2 : }
     599             : 
     600          18 : DECLARE_RTFIMPORT_TEST(testFdo50665, "fdo50665.rtf")
     601             : {
     602             :     // Access the second run, which is a textfield
     603           2 :     uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY);
     604             :     // This used to be the default, as character properties were ignored.
     605           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty<OUString>(xRun, "CharFontName"));
     606           2 : }
     607             : 
     608          18 : DECLARE_RTFIMPORT_TEST(testFdo49659, "fdo49659.rtf")
     609             : {
     610             :     // Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc
     611           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     612           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     613           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
     614             : 
     615             :     // The graphic was also empty
     616           4 :     uno::Reference<beans::XPropertySet> xGraphic(getProperty< uno::Reference<beans::XPropertySet> >(getShape(1), "Graphic"), uno::UNO_QUERY);
     617           4 :     CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType"));
     618           2 : }
     619             : 
     620          18 : DECLARE_RTFIMPORT_TEST(testFdo46966, "fdo46966.rtf")
     621             : {
     622             :     /*
     623             :      * The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
     624             :      *
     625             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
     626             :      */
     627           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     628           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(720)), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
     629           2 : }
     630             : 
     631          18 : DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
     632             : {
     633             :     /*
     634             :      * The problem was that the height of the shape was too big.
     635             :      *
     636             :      * xray ThisComponent.DrawPage(0).Size.Height
     637             :      */
     638           2 :     uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
     639           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(19)), xShape->getSize().Height);
     640           2 : }
     641             : 
     642          18 : DECLARE_RTFIMPORT_TEST(testFdo76633, "fdo76633.rtf")
     643             : {
     644             :     // check that there is only a graphic object, not an additional rectangle
     645           2 :     uno::Reference<lang::XServiceInfo> xShape(getShape(1), uno::UNO_QUERY);
     646           2 :     CPPUNIT_ASSERT(xShape.is());
     647           2 :     CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject"));
     648             :     try
     649             :     {
     650           2 :         uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY);
     651           0 :         CPPUNIT_FAIL("exception expected");
     652             :     }
     653           2 :     catch (lang::IndexOutOfBoundsException const&)
     654             :     {
     655             :         /* expected */
     656           2 :     }
     657           2 : }
     658             : 
     659          18 : DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf")
     660             : {
     661             :     /*
     662             :      * The problem was that the picture (48033) or OLE object (53594) was in the first cell,
     663             :      * instead of the second one.
     664             :      *
     665             :      * oTable = ThisComponent.TextTables(0)
     666             :      * oParas = oTable.getCellByName("B1").Text.createEnumeration
     667             :      * oPara = oParas.nextElement
     668             :      * oRuns = oPara.createEnumeration
     669             :      * oRun = oRuns.nextElement
     670             :      * xray oRun.TextPortionType ' Frame, was Text
     671             :      */
     672           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     673           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     674           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     675           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
     676           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
     677           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     678           4 :     uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     679           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
     680           2 : }
     681             : 
     682          18 : DECLARE_RTFIMPORT_TEST(testFdo53594, "fdo53594.rtf")
     683             : {
     684             :     /*
     685             :      * The problem was that the picture (48033) or OLE object (53594) was in the first cell,
     686             :      * instead of the second one.
     687             :      *
     688             :      * oTable = ThisComponent.TextTables(0)
     689             :      * oParas = oTable.getCellByName("B1").Text.createEnumeration
     690             :      * oPara = oParas.nextElement
     691             :      * oRuns = oPara.createEnumeration
     692             :      * oRun = oRuns.nextElement
     693             :      * xray oRun.TextPortionType ' Frame, was Text
     694             :      */
     695           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     696           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     697           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     698           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
     699           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
     700           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     701           4 :     uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     702           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
     703           2 : }
     704             : 
     705          18 : DECLARE_RTFIMPORT_TEST(testFdo36089, "fdo36089.rtf")
     706             : {
     707           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
     708           2 : }
     709             : 
     710          18 : DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf")
     711             : {
     712           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     713           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     714           4 :     for (int i = 0; i < xDraws->getCount(); ++i)
     715             :     {
     716           2 :         OUString aDescription = getProperty<OUString>(xDraws->getByIndex(i), "Description");
     717           2 :         if (aDescription == "red")
     718           0 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     719           2 :         else if (aDescription == "green")
     720           0 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     721           2 :         else if (aDescription == "blue")
     722           0 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     723           2 :         else if (aDescription == "rect")
     724             :         {
     725           0 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation"));
     726           0 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation"));
     727             :         }
     728           4 :     }
     729           2 : }
     730             : 
     731          18 : DECLARE_RTFIMPORT_TEST(testFdo48446, "fdo48446.rtf")
     732             : {
     733           2 :     OUString aExpected("\xd0\x98\xd0\xbc\xd1\x8f", 6, RTL_TEXTENCODING_UTF8);
     734           2 :     getParagraph(1, aExpected);
     735           2 : }
     736             : 
     737          18 : DECLARE_RTFIMPORT_TEST(testFdo47495, "fdo47495.rtf")
     738             : {
     739             :     // Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
     740           2 :     CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
     741           2 : }
     742             : 
     743          18 : DECLARE_RTFIMPORT_TEST(testAllGapsWord, "all_gaps_word.rtf")
     744             : {
     745           2 :     BorderTest borderTest;
     746           2 :     borderTest.testTheBorders(mxComponent, false);
     747           2 : }
     748             : 
     749          18 : DECLARE_RTFIMPORT_TEST(testFdo52052, "fdo52052.rtf")
     750             : {
     751             :     // Make sure the textframe containing the text "third" appears on the 3rd page.
     752           2 :     CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()"));
     753           2 : }
     754             : 
     755          18 : DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf")
     756             : {
     757             :     /*
     758             :      * The problem was that the second segment had wrong command count and wrap type.
     759             :      *
     760             :      * oShape = ThisComponent.DrawPage(0)
     761             :      * oPathPropVec = oShape.CustomShapeGeometry(1).Value
     762             :      * oSegments = oPathPropVec(1).Value
     763             :      * msgbox oSegments(1).Count ' was 0x2000 | 10, should be 10
     764             :      * msgbox oShape.Surround ' was 2, should be 1
     765             :      */
     766           2 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry");
     767           4 :     uno::Sequence<beans::PropertyValue> aPathProps;
     768           8 :     for (int i = 0; i < aProps.getLength(); ++i)
     769             :     {
     770           6 :         const beans::PropertyValue& rProp = aProps[i];
     771           6 :         if (rProp.Name == "Path")
     772           2 :             rProp.Value >>= aPathProps;
     773             :     }
     774           4 :     uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
     775           6 :     for (int i = 0; i < aPathProps.getLength(); ++i)
     776             :     {
     777           4 :         const beans::PropertyValue& rProp = aPathProps[i];
     778           4 :         if (rProp.Name == "Segments")
     779           2 :             rProp.Value >>= aSegments;
     780             :     }
     781           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(10), aSegments[1].Count);
     782           4 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
     783           2 : }
     784             : 
     785          18 : DECLARE_RTFIMPORT_TEST(testFdo52389, "fdo52389.rtf")
     786             : {
     787             :     // The last '!' character at the end of the document was lost
     788           2 :     CPPUNIT_ASSERT_EQUAL(6, getLength());
     789           2 : }
     790             : 
     791          18 : DECLARE_RTFIMPORT_TEST(testFdo49655, "fdo49655.rtf")
     792             : {
     793             :     /*
     794             :      * 49655 :
     795             :      * The problem was that the table was not imported due to the '  ' string in the middle of the table definition.
     796             :      *
     797             :      * xray ThisComponent.TextTables.Count 'was 0
     798             :      */
     799           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     800           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     801           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     802           2 : }
     803             : 
     804          18 : DECLARE_RTFIMPORT_TEST(testFdo62805, "fdo62805.rtf")
     805             : {
     806             :     /*
     807             :      * 62805 :
     808             :      * The problem was that the table was not imported due to the absence of \pard after \row.
     809             :      * The table was instead in a group (the '}' replace the \pard).
     810             :      */
     811           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     812           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     813           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     814           2 : }
     815             : 
     816          18 : DECLARE_RTFIMPORT_TEST(testFdo52475, "fdo52475.rtf")
     817             : {
     818             :     // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
     819           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
     820           2 : }
     821             : 
     822          18 : DECLARE_RTFIMPORT_TEST(testFdo55493, "fdo55493.rtf")
     823             : {
     824             :     // The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
     825           2 :     uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
     826           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
     827           2 : }
     828             : 
     829          18 : DECLARE_RTFIMPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf")
     830             : {
     831             :     // The problem was that RTF import during copy&paste did not ignore page styles.
     832             :     // Once we have more copy&paste tests, makes sense to refactor this to some helper method.
     833           2 :     paste("copypaste-pagestyle-paste.rtf");
     834             : 
     835           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     836           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
     837           2 : }
     838             : 
     839          18 : DECLARE_RTFIMPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf")
     840             : {
     841             :     // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote.
     842           2 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     843           4 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
     844           4 :     uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
     845           2 :     paste("copypaste-footnote-paste.rtf", xTextRange);
     846             : 
     847           4 :     CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
     848           2 : }
     849             : 
     850          18 : DECLARE_RTFIMPORT_TEST(testFdo61193, "hello.rtf")
     851             : {
     852             :     // Pasting content that contained a footnote caused a crash.
     853           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     854           4 :     uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
     855           4 :     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
     856           4 :     paste("fdo61193.rtf", xEnd);
     857           2 : }
     858             : 
     859          18 : DECLARE_RTFIMPORT_TEST(testShptxtPard, "shptxt-pard.rtf")
     860             : {
     861             :     // The problem was that \pard inside \shptxt caused loss of shape text
     862           2 :     uno::Reference<text::XText> xText(getShape(1), uno::UNO_QUERY);
     863           2 :     CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
     864           2 : }
     865             : 
     866          18 : DECLARE_RTFIMPORT_TEST(testDoDhgt, "do-dhgt.rtf")
     867             : {
     868           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     869           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     870           8 :     for (int i = 0; i < xDraws->getCount(); ++i)
     871             :     {
     872           6 :         sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor");
     873           6 :         if (nFillColor == 0xc0504d) // red
     874           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     875           4 :         else if (nFillColor == 0x9bbb59) // green
     876           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     877           2 :         else if (nFillColor == 0x4f81bd) // blue
     878           2 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     879           2 :     }
     880           2 : }
     881             : 
     882          18 : DECLARE_RTFIMPORT_TEST(testDplinehollow, "dplinehollow.rtf")
     883             : {
     884           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
     885           2 :     table::BorderLine2 line(getProperty<table::BorderLine2>(xPropertySet, "TopBorder"));
     886           2 :     CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::NONE, line.LineStyle);
     887           2 : }
     888             : 
     889          18 : DECLARE_RTFIMPORT_TEST(testLeftmarginDefault, "leftmargin-default.rtf")
     890             : {
     891             :     // The default left/right margin was incorrect when the top margin was set to zero.
     892           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
     893           2 : }
     894             : 
     895          18 : DECLARE_RTFIMPORT_TEST(testDppolyline, "dppolyline.rtf")
     896             : {
     897             :     // This was completely ignored, for now, just make sure we have all 4 lines.
     898           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     899           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     900           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
     901           2 : }
     902             : 
     903          18 : DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf")
     904             : {
     905             :     // the thin horizontal rule was imported as a big fat rectangle
     906           2 :     uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
     907           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xShape, "RelativeWidth"));
     908             :     // FIXME the width/height numbers here are bogus; they should be 15238 / 53
     909             :     // (as they are when opening the file in a full soffice)
     910             : #if 0
     911             :     CPPUNIT_ASSERT_EQUAL(sal_Int32(15238), xShape->getSize().Width);
     912             :     CPPUNIT_ASSERT_EQUAL(sal_Int32(53), xShape->getSize().Height);
     913             :     CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xShape, "VertOrient"));
     914             :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xShape, "HoriOrient"));
     915             : #endif
     916           2 : }
     917             : 
     918          18 : DECLARE_RTFIMPORT_TEST(testFdo56512, "fdo56512.rtf")
     919             : {
     920           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     921           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     922           4 :     uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     923           4 :     OUString aExpected("\xd7\xa2\xd7\x95\xd7\xa1\xd7\xa7 \xd7\x9e\xd7\x95\xd7\xa8\xd7\xa9\xd7\x94 ", 20, RTL_TEXTENCODING_UTF8);
     924           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     925           2 : }
     926             : 
     927          18 : DECLARE_RTFIMPORT_TEST(testFdo52989, "fdo52989.rtf")
     928             : {
     929             :     // Same as n#192129, but for JPEG files.
     930           2 :     uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
     931           4 :     OString aMessage("xShape->getSize().Width() = ");
     932           2 :     aMessage += OString::number(xShape->getSize().Width);
     933             : 
     934             :     // This was 2, should be 423 (or 369?).
     935           4 :     CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), xShape->getSize().Width >= 273);
     936           2 : }
     937             : 
     938          18 : DECLARE_RTFIMPORT_TEST(testFdo48442, "fdo48442.rtf")
     939             : {
     940             :     // The problem was that \pvmrg is the default in RTF, but not in Writer.
     941           2 :     uno::Reference<drawing::XShape> xShape = getShape(1);
     942           2 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME
     943           2 : }
     944             : 
     945          18 : DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf")
     946             : {
     947           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     948           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     949           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     950             :     // Negative left margin was ~missing, -191
     951           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty<sal_Int32>(xTable, "LeftMargin"));
     952             :     // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width)
     953           4 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
     954           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
     955           2 : }
     956             : 
     957          18 : DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf")
     958             : {
     959             :     // There were two issues: the doc was of 2 pages and the picture was missing.
     960           2 :     CPPUNIT_ASSERT_EQUAL(1, getPages());
     961           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     962           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     963             :     // Two objects: a picture and a textframe.
     964           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
     965           2 : }
     966             : 
     967          18 : DECLARE_RTFIMPORT_TEST(testFdo54473, "fdo54473.rtf")
     968             : {
     969             :     // The problem was that character styles were not imported due to a typo.
     970           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
     971           2 :     CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
     972           2 : }
     973             : 
     974          18 : DECLARE_RTFIMPORT_TEST(testFdo49934, "fdo49934.rtf")
     975             : {
     976             :     // Column break without columns defined should be a page break, but it was just ignored.
     977           2 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     978           2 : }
     979             : 
     980          18 : DECLARE_RTFIMPORT_TEST(testFdo57886, "fdo57886.rtf")
     981             : {
     982             :     // Was 'int from <?> to <?> <?>'.
     983           2 :     CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1)));
     984           2 : }
     985             : 
     986          18 : DECLARE_RTFIMPORT_TEST(testFdo58076, "fdo58076.rtf")
     987             : {
     988             :     // An additional section was created, so the default page style didn't have the custom margins.
     989           2 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     990           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty<sal_Int32>(xStyle, "LeftMargin"));
     991           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty<sal_Int32>(xStyle, "RightMargin"));
     992           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "TopMargin"));
     993           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
     994           2 : }
     995             : 
     996          18 : DECLARE_RTFIMPORT_TEST(testFdo57678, "fdo57678.rtf")
     997             : {
     998             :     // Paragraphs of the two tables were not converted to tables.
     999           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1000           4 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1001           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
    1002           2 : }
    1003             : 
    1004          18 : DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf")
    1005             : {
    1006             :     // Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text.
    1007           2 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
    1008             : 
    1009           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1010           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1011             :     // Was 247, resulting in a table having width almost zero and height of 10+ pages.
    1012           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
    1013           2 : }
    1014             : 
    1015          18 : DECLARE_RTFIMPORT_TEST(testFdo54612, "fdo54612.rtf")
    1016             : {
    1017             :     // \dpptx without a \dppolycount caused a crash.
    1018           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1019           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1020           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount());
    1021           2 : }
    1022             : 
    1023          18 : DECLARE_RTFIMPORT_TEST(testFdo58933, "fdo58933.rtf")
    1024             : {
    1025             :     // The problem was that the table had an additional cell in its first line.
    1026           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1027           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1028           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1029             :     // This was 4.
    1030           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
    1031           2 : }
    1032             : 
    1033          18 : DECLARE_RTFIMPORT_TEST(testFdo44053, "fdo44053.rtf")
    1034             : {
    1035           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1036           4 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1037           4 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1038           4 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1039             :     // The with of the table's A1 and A2 cell should equal.
    1040           4 :     CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position,
    1041           4 :                          getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
    1042           2 : }
    1043             : 
    1044          18 : DECLARE_RTFIMPORT_TEST(testFdo48440, "fdo48440.rtf")
    1045             : {
    1046             :     // Page break was ignored.
    1047           2 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
    1048           2 : }
    1049             : 
    1050          18 : DECLARE_RTFIMPORT_TEST(testFdo58646line, "fdo58646line.rtf")
    1051             : {
    1052             :     // \line symbol was ignored
    1053           2 :     getParagraph(1, "foo\nbar");
    1054           2 : }
    1055             : 
    1056          18 : DECLARE_RTFIMPORT_TEST(testFdo78502, "fdo78502.rtf")
    1057             : {
    1058             :     // ";" separators were inserted as text
    1059           2 :     getParagraph(1, "foo");
    1060           2 : }
    1061             : 
    1062          18 : DECLARE_RTFIMPORT_TEST(testFdo58646, "fdo58646.rtf")
    1063             : {
    1064             :     // Page break was ignored inside a continuous section, on title page.
    1065           2 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
    1066           2 : }
    1067             : 
    1068          18 : DECLARE_RTFIMPORT_TEST(testFdo59419, "fdo59419.rtf")
    1069             : {
    1070             :     // Junk to be ignored broke import of the table.
    1071           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1072           4 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1073           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
    1074           2 : }
    1075             : 
    1076          18 : DECLARE_RTFIMPORT_TEST(testFdo58076_2, "fdo58076-2.rtf")
    1077             : {
    1078             :     // Position of the picture wasn't correct.
    1079           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(8345)), getProperty<sal_Int32>(getShape(1), "HoriOrientPosition"));
    1080           2 : }
    1081             : 
    1082          18 : DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf")
    1083             : {
    1084           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1085           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1086           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1087             :     // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width)
    1088           4 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1089           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
    1090           2 : }
    1091             : 
    1092          18 : DECLARE_RTFIMPORT_TEST(testFdo59638, "fdo59638.rtf")
    1093             : {
    1094             :     // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
    1095             : 
    1096           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
    1097           2 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
    1098           2 :     uno::Sequence<beans::PropertyValue> aProps;
    1099           2 :     xLevels->getByIndex(0) >>= aProps; // 1st level
    1100             : 
    1101          28 :     for (int i = 0; i < aProps.getLength(); ++i)
    1102             :     {
    1103          28 :         const beans::PropertyValue& rProp = aProps[i];
    1104             : 
    1105          28 :         if (rProp.Name == "BulletChar")
    1106             :         {
    1107             :             // Was '*', should be 'o'.
    1108           2 :             CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
    1109           4 :             return;
    1110             :         }
    1111             :     }
    1112           0 :     CPPUNIT_FAIL("no BulletChar property");
    1113             : }
    1114             : 
    1115          18 : DECLARE_RTFIMPORT_TEST(testFdo60722, "fdo60722.rtf")
    1116             : {
    1117             :     // The problem was that the larger shape was over the smaller one, and not the other way around.
    1118           2 :     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
    1119           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "ZOrder"));
    1120           2 :     CPPUNIT_ASSERT_EQUAL(OUString("larger"), getProperty<OUString>(xShape, "Description"));
    1121             : 
    1122           2 :     xShape.set(getShape(2), uno::UNO_QUERY);
    1123           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
    1124           2 :     CPPUNIT_ASSERT_EQUAL(OUString("smaller"), getProperty<OUString>(xShape, "Description"));
    1125             : 
    1126             :     // Color of the line was blue, and it had zero width.
    1127           2 :     xShape.set(getShape(3), uno::UNO_QUERY);
    1128           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<sal_uInt32>(xShape, "LineWidth"));
    1129           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor"));
    1130           2 : }
    1131             : 
    1132          18 : DECLARE_RTFIMPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf")
    1133             : {
    1134             :     // The file contains 3 shapes which have the same dhgt (z-order).
    1135             :     // Test that the order is 1) a 2) black rectangle 3) b, and not something else
    1136           2 :     uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY);
    1137           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "ZOrder"));
    1138           2 :     CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString());
    1139             : 
    1140           2 :     xShape.set(getShape(2), uno::UNO_QUERY);
    1141           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
    1142           2 :     CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<sal_uInt32>(xShape, "FillColor"));
    1143             : 
    1144           2 :     xShape.set(getShape(3), uno::UNO_QUERY);
    1145           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xShape, "ZOrder"));
    1146           2 :     CPPUNIT_ASSERT_EQUAL(OUString("b"), xShape->getString());
    1147           2 : }
    1148             : 
    1149          18 : DECLARE_RTFIMPORT_TEST(testFdo61909, "fdo61909.rtf")
    1150             : {
    1151           2 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
    1152             :     // Was the Writer default font.
    1153           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName"));
    1154             :     // It is white (0xFFFFFF) in document
    1155           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFFFFFF), getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
    1156           2 : }
    1157             : 
    1158          18 : DECLARE_RTFIMPORT_TEST(testFdo62288, "fdo62288.rtf")
    1159             : {
    1160           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1161           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1162           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1163           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
    1164           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
    1165           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
    1166           4 :     uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
    1167             :     // Margins were inherited from the previous cell, even there was a \pard there.
    1168           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
    1169           2 : }
    1170             : 
    1171          18 : DECLARE_RTFIMPORT_TEST(testFdo37716, "fdo37716.rtf")
    1172             : {
    1173           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    1174           4 :     uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    1175             :     // \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL
    1176           4 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround"));
    1177           2 : }
    1178             : 
    1179          18 : DECLARE_RTFIMPORT_TEST(testFdo51916, "fdo51916.rtf")
    1180             : {
    1181             :     // Complex nested table caused a crash.
    1182           2 : }
    1183             : 
    1184          18 : DECLARE_RTFIMPORT_TEST(testFdo63023, "fdo63023.rtf")
    1185             : {
    1186           2 :     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
    1187             :     // Back color was black (0) in the header, due to missing color table in the substream.
    1188           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFF99), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xHeaderText), 1), "CharBackColor"));
    1189           2 : }
    1190             : 
    1191          18 : DECLARE_RTFIMPORT_TEST(testFdo42109, "fdo42109.rtf")
    1192             : {
    1193           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1194           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1195           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1196           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
    1197             :     // Make sure the page number is imported as a field in the B1 cell.
    1198           4 :     CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType"));
    1199           2 : }
    1200             : 
    1201          18 : DECLARE_RTFIMPORT_TEST(testFdo62977, "fdo62977.rtf")
    1202             : {
    1203             :     // The middle character was imported as '?' instead of the proper unicode value.
    1204           2 :     getRun(getParagraph(1), 1, OUString("\xE5\xB9\xB4\xEF\xBC\x94\xE6\x9C\x88", 9, RTL_TEXTENCODING_UTF8));
    1205           2 : }
    1206             : 
    1207          18 : DECLARE_RTFIMPORT_TEST(testN818997, "n818997.rtf")
    1208             : {
    1209             :     // \page was ignored between two \shp tokens.
    1210           2 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
    1211           2 : }
    1212             : 
    1213          18 : DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf")
    1214             : {
    1215             :     // Additional '}' was inserted before the special character.
    1216           2 :     getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
    1217           2 : }
    1218             : 
    1219          18 : DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
    1220             : {
    1221             :     // The problem was that \background was ignored.
    1222           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
    1223           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
    1224           2 : }
    1225             : 
    1226          18 : DECLARE_RTFIMPORT_TEST(testFdo81944, "fdo81944.rtf")
    1227             : {
    1228             :     // font properties in style were not imported
    1229             :     uno::Reference<beans::XPropertySet> xPropertySet(
    1230           2 :         getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
    1231           4 :     uno::Reference<style::XStyle> xStyle(xPropertySet, uno::UNO_QUERY);
    1232           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Segoe UI"), getProperty<OUString>(xStyle, "CharFontName"));
    1233           2 :     CPPUNIT_ASSERT_EQUAL(9.0f, getProperty<float>(xStyle, "CharHeight"));
    1234             :     // not sure if this should be set on Asian or Complex or both?
    1235           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty<OUString>(xStyle, "CharFontNameComplex"));
    1236           4 :     CPPUNIT_ASSERT_EQUAL(11.0f, getProperty<float>(xStyle, "CharHeightComplex"));
    1237           2 : }
    1238             : 
    1239          18 : DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
    1240             : {
    1241             :     // The problem was that RTF import during copy&paste did not ignore existing paragraph styles.
    1242           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    1243           4 :     uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
    1244           4 :     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
    1245           2 :     paste("fdo62044-paste.rtf", xEnd);
    1246             : 
    1247           4 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY);
    1248           4 :     CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
    1249           2 : }
    1250             : 
    1251          18 : DECLARE_RTFIMPORT_TEST(testFdo70578, "fdo70578.rtf")
    1252             : {
    1253             :     // Style without explicit \s0 was not imported as the default style
    1254             :     uno::Reference<beans::XPropertySet> xPropertySet(
    1255           2 :         getStyles("ParagraphStyles")->getByName("Subtitle"), uno::UNO_QUERY);
    1256           4 :     uno::Reference<style::XStyle> xStyle(xPropertySet, uno::UNO_QUERY);
    1257           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Standard"), xStyle->getParentStyle());
    1258           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "ParaTopMargin"));
    1259           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin"));
    1260           2 : }
    1261             : 
    1262          18 : DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf")
    1263             : {
    1264           2 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "HoriOrient"));
    1265           2 :     CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "VertOrient"));
    1266           2 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "FrameIsAutomaticHeight"));
    1267           2 : }
    1268             : 
    1269          18 : DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf")
    1270             : {
    1271             :     // The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0.
    1272           2 :     uno::Reference<beans::XPropertyState> xPropertyState(getShape(2), uno::UNO_QUERY);
    1273           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getShape(2), "BackColorTransparency"));
    1274           2 :     beans::PropertyState ePropertyState = xPropertyState->getPropertyState("BackColorTransparency");
    1275             :     // Was beans::PropertyState_DEFAULT_VALUE.
    1276           2 :     CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
    1277           2 : }
    1278             : 
    1279          18 : DECLARE_RTFIMPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf")
    1280             : {
    1281           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
    1282           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin"));
    1283             : 
    1284             :     // This was 353, i.e. bottom margin of the paragraph was 0.35cm instead of 0.
    1285             :     // The reason why this is 0 despite the default style containing \sa200
    1286             :     // is that Word will actually interpret \sN (or \pard which apparently
    1287             :     // implies \s0) as "set style N and for every attribute of that style,
    1288             :     // set an attribute with default value on the paragraph"
    1289           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
    1290           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
    1291           2 : }
    1292             : 
    1293          18 : DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf")
    1294             : {
    1295           2 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry");
    1296           4 :     uno::Sequence<beans::PropertyValue> aPathProps;
    1297           8 :     for (int i = 0; i < aProps.getLength(); ++i)
    1298             :     {
    1299           6 :         const beans::PropertyValue& rProp = aProps[i];
    1300           6 :         if (rProp.Name == "Path")
    1301           2 :             aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >();
    1302             :     }
    1303           4 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
    1304           6 :     for (int i = 0; i < aPathProps.getLength(); ++i)
    1305             :     {
    1306           4 :         const beans::PropertyValue& rProp = aPathProps[i];
    1307           4 :         if (rProp.Name == "Coordinates")
    1308           2 :             aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
    1309             :     }
    1310             :     // The first coordinate pair of this freeform shape was 286,0 instead of 0,286.
    1311           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(286), aCoordinates[0].Second.Value.get<sal_Int32>());
    1312           2 : }
    1313             : 
    1314          18 : DECLARE_RTFIMPORT_TEST(testFdo66040, "fdo66040.rtf")
    1315             : {
    1316           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1317           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1318             :     // This was 0 (no shapes were imported), we want two textframes.
    1319           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
    1320             : 
    1321             :     // The second paragraph of the first shape should be actually a table, with "A" in its A1 cell.
    1322           4 :     uno::Reference<text::XTextRange> xTextRange(xDraws->getByIndex(0), uno::UNO_QUERY);
    1323           4 :     uno::Reference<text::XText> xText = xTextRange->getText();
    1324           4 :     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2, xText), uno::UNO_QUERY);
    1325           2 :     CPPUNIT_ASSERT_EQUAL(OUString("A"), uno::Reference<text::XTextRange>(xTable->getCellByName("A1"), uno::UNO_QUERY)->getString());
    1326             : 
    1327             :     // Make sure the second shape has the correct position and size.
    1328           4 :     uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(1), uno::UNO_QUERY);
    1329           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(14420), getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
    1330           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1032), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
    1331           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(14000), xShape->getSize().Width);
    1332           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), xShape->getSize().Height);
    1333           2 : }
    1334             : 
    1335          18 : DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf")
    1336             : {
    1337           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
    1338           4 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
    1339           4 :     uno::Sequence<beans::PropertyValue> aProps;
    1340           2 :     xLevels->getByIndex(0) >>= aProps; // 1st level
    1341           4 :     awt::FontDescriptor aFont;
    1342             : 
    1343          34 :     for (int i = 0; i < aProps.getLength(); ++i)
    1344             :     {
    1345          32 :         const beans::PropertyValue& rProp = aProps[i];
    1346             : 
    1347          32 :         if (rProp.Name == "BulletFont")
    1348           2 :             aFont = rProp.Value.get<awt::FontDescriptor>();
    1349             :     }
    1350             :     // This was empty, i.e. no font name was set for the bullet numbering.
    1351           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), aFont.Name);
    1352           2 : }
    1353             : 
    1354          18 : DECLARE_RTFIMPORT_TEST(testFdo77996, "fdo77996.rtf")
    1355             : {
    1356             :     // all styles were imported as name "0"
    1357           2 :     uno::Reference<container::XNameAccess> xChars(getStyles("CharacterStyles"));
    1358           2 :     CPPUNIT_ASSERT(!xChars->hasByName("0"));
    1359           2 :     CPPUNIT_ASSERT(xChars->hasByName("strong"));
    1360           2 :     CPPUNIT_ASSERT(xChars->hasByName("author"));
    1361           4 :     uno::Reference<container::XNameAccess> xParas(getStyles("ParagraphStyles"));
    1362           2 :     CPPUNIT_ASSERT(!xParas->hasByName("0"));
    1363           2 :     CPPUNIT_ASSERT(xParas->hasByName("extract2"));
    1364             :     // some document properties were lost
    1365           4 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
    1366           4 :     uno::Reference<document::XDocumentProperties> xProps(xDocumentPropertiesSupplier->getDocumentProperties());
    1367           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Aln Lin (Bei Jing)"), xProps->getAuthor());
    1368           4 :     OUString aTitle("\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8", 30, RTL_TEXTENCODING_UTF8);
    1369           2 :     CPPUNIT_ASSERT_EQUAL(aTitle, xProps->getTitle());
    1370           4 :     uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(), uno::UNO_QUERY);
    1371           2 :     CPPUNIT_ASSERT_EQUAL(OUString("jay"), getProperty<OUString>(xUDProps, "Operator"));
    1372             : 
    1373             :     // fdo#80486 also check that the ftnsep doesn't insert paragraph breaks
    1374           4 :     getParagraph(1, aTitle);
    1375           2 : }
    1376             : 
    1377          18 : DECLARE_RTFIMPORT_TEST(testFdo47802, "fdo47802.rtf")
    1378             : {
    1379           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1380           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1381             :     // Shape inside table was ignored.
    1382           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1383           2 : }
    1384             : 
    1385          18 : DECLARE_RTFIMPORT_TEST(testFdo39001, "fdo39001.rtf")
    1386             : {
    1387             :     // Document was of 4 pages, \sect at the end of the doc wasn't ignored.
    1388           2 :     CPPUNIT_ASSERT_EQUAL(3, getPages());
    1389           2 : }
    1390             : 
    1391          18 : DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf")
    1392             : {
    1393           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1394           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1395             :     // There should be a single groupshape with 2 children.
    1396           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1397           4 :     uno::Reference<drawing::XShapes> xGroupshape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1398           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount());
    1399           2 : }
    1400             : 
    1401          18 : DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf")
    1402             : {
    1403           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1404           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1405             :     // There should be a single groupshape with 2 children.
    1406           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1407           4 :     uno::Reference<drawing::XShapes> xGroupshape(xDraws->getByIndex(0), uno::UNO_QUERY);
    1408           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount());
    1409           2 : }
    1410             : 
    1411          18 : DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf")
    1412             : {
    1413             :     // Number of tabstops in the paragraph should be 2, was 3.
    1414             :     uno::Sequence<style::TabStop> tabs(
    1415           2 :         getProperty< uno::Sequence<style::TabStop> >(getParagraph(1), "ParaTabStops"));
    1416           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabs.getLength());
    1417           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5808), tabs[0].Position);
    1418           2 :     CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[0].Alignment);
    1419           2 :     CPPUNIT_ASSERT_EQUAL(sal_Unicode(' '), tabs[0].FillChar);
    1420           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(16002), tabs[1].Position);
    1421           2 :     CPPUNIT_ASSERT_EQUAL(style::TabAlign_LEFT, tabs[1].Alignment);
    1422           2 :     CPPUNIT_ASSERT_EQUAL(sal_Unicode('_'), tabs[1].FillChar);
    1423           2 : }
    1424             : 
    1425          18 : DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf")
    1426             : {
    1427           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1428           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1429           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1430             :     // Cell width of A2 was 554, should be 453/14846*10000
    1431           4 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1432           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
    1433           2 : }
    1434             : 
    1435          18 : DECLARE_RTFIMPORT_TEST(testFdo54900, "fdo54900.rtf")
    1436             : {
    1437           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1438           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1439           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1440           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1441             :     // Paragraph was aligned to left, should be center.
    1442           4 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust")));
    1443           2 : }
    1444             : 
    1445          18 : DECLARE_RTFIMPORT_TEST(testFdo64637, "fdo64637.rtf")
    1446             : {
    1447             :     // The problem was that the custom "Company" property was added twice, the second invocation resulted in an exception.
    1448           2 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
    1449           4 :     uno::Reference<beans::XPropertySet> xPropertySet(xDocumentPropertiesSupplier->getDocumentProperties()->getUserDefinedProperties(), uno::UNO_QUERY);
    1450           4 :     CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty<OUString>(xPropertySet, "Company"));
    1451           2 : }
    1452             : 
    1453          18 : DECLARE_RTFIMPORT_TEST(testN820504, "n820504.rtf")
    1454             : {
    1455             :     // The shape was anchored at-page instead of at-character (that's incorrect as Word only supports at-character and as-character).
    1456           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
    1457           2 : }
    1458             : 
    1459          18 : DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf")
    1460             : {
    1461           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1462           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1463           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1464           4 :     uno::Reference<table::XTableRows> xRows = xTable->getRows();
    1465             :     // The table only had 3 rows.
    1466           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xRows->getCount());
    1467             :     // This was 4999, i.e. the two cells of the row had equal widths instead of a larger and a smaller cell.
    1468           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5290), getProperty< uno::Sequence<text::TableColumnSeparator> >(xRows->getByIndex(2), "TableColumnSeparators")[0].Position);
    1469           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY);
    1470             :     // Paragraph was aligned to center, should be left.
    1471           4 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust")));
    1472           2 : }
    1473             : 
    1474          18 : DECLARE_RTFIMPORT_TEST(testFdo67498, "fdo67498.rtf")
    1475             : {
    1476             :     // Left margin of the default page style wasn't set (was 2000).
    1477           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(5954)), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
    1478           2 : }
    1479             : 
    1480          18 : DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf")
    1481             : {
    1482             :     // Vertical and horizontal orientation of the picture wasn't imported (was text::RelOrientation::FRAME).
    1483           2 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation"));
    1484           2 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "VertOrientRelation"));
    1485           2 : }
    1486             : 
    1487          18 : DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf")
    1488             : {
    1489             :     // This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible.
    1490           2 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getShape(3), "FillStyle"));
    1491             : 
    1492             :     // This was a com.sun.star.drawing.CustomShape, which resulted in lack of word wrapping in the bugdoc.
    1493           2 :     uno::Reference<beans::XPropertySet> xShapeProperties(getShape(1), uno::UNO_QUERY);
    1494           4 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
    1495           4 :     CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
    1496           2 : }
    1497             : 
    1498          18 : DECLARE_RTFIMPORT_TEST(testFdo63428, "hello.rtf")
    1499             : {
    1500             :     // Pasting content that contained an annotation caused a crash.
    1501           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    1502           4 :     uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
    1503           4 :     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
    1504           2 :     paste("fdo63428.rtf", xEnd);
    1505             : 
    1506             :     // Additionally, commented range was imported as a normal comment.
    1507           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType"));
    1508           4 :     CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
    1509           2 : }
    1510             : 
    1511          18 : DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.rtf")
    1512             : {
    1513             :     // Rotation on groupshapes wasn't handled correctly, RotateAngle was 4500.
    1514           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle"));
    1515           2 : }
    1516             : 
    1517          18 : DECLARE_RTFIMPORT_TEST(testFdo44715, "fdo44715.rtf")
    1518             : {
    1519           2 :     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
    1520           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1521             :     // Style information wasn't reset, which caused character height to be 16.
    1522           4 :     CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(2, xCell->getText()), "CharHeight"));
    1523           2 : }
    1524             : 
    1525          18 : DECLARE_RTFIMPORT_TEST(testFdo68076, "fdo68076.rtf")
    1526             : {
    1527             :     // Encoding of the last char was wrong (more 'o' than 'y').
    1528           2 :     OUString aExpected("\xD0\x9E\xD0\xB1\xD1\x8A\xD0\xB5\xD0\xBA\xD1\x82 \xE2\x80\x93 \xD1\x83", 19, RTL_TEXTENCODING_UTF8);
    1529           2 :     getParagraph(1, aExpected);
    1530           2 : }
    1531             : 
    1532          18 : DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt")
    1533             : {
    1534           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    1535           4 :     uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
    1536           4 :     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
    1537           2 :     paste("fdo68291-paste.rtf", xEnd);
    1538             : 
    1539             :     // This was "Standard", causing an unwanted page break on next paste.
    1540           4 :     CPPUNIT_ASSERT_EQUAL(uno::Any(), uno::Reference<beans::XPropertySet>(getParagraph(1), uno::UNO_QUERY)->getPropertyValue("PageDescName"));
    1541           2 : }
    1542             : 
    1543          18 : DECLARE_RTFIMPORT_TEST(testFdo69384, "hello.rtf")
    1544             : {
    1545           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
    1546           4 :     uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
    1547           4 :     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
    1548           2 :     paste("fdo69384-paste.rtf", xEnd);
    1549             : 
    1550             :     // Import got interrupted in the middle of style sheet table import,
    1551             :     // resuling in missing styles and text.
    1552           4 :     getStyles("ParagraphStyles")->getByName("Text body justified");
    1553           2 : }
    1554             : 
    1555          18 : DECLARE_RTFIMPORT_TEST(testFdo70221, "fdo70221.rtf")
    1556             : {
    1557           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
    1558           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
    1559             :     // The picture was imported twice.
    1560           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
    1561           2 : }
    1562             : 
    1563          18 : DECLARE_RTFIMPORT_TEST(testCp1000018, "cp1000018.rtf")
    1564             : {
    1565             :     // The problem was that the empty paragraph at the end of the footnote got
    1566             :     // lost during import.
    1567           2 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
    1568           4 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
    1569           4 :     uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
    1570           4 :     OUString aExpected("Footnote first line.\n");
    1571           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
    1572           2 : }
    1573             : 
    1574             : #endif
    1575             : 
    1576          18 : DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf")
    1577             : {
    1578             :     // nested table in second cell was missing
    1579           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1580           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1581           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY);
    1582           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1583           4 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
    1584           4 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
    1585           4 :     uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
    1586           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Responsable Commercial:"), xPara->getString());
    1587           2 :     xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
    1588           2 :     xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
    1589           2 :     xParaEnum = xParaEnumAccess->createEnumeration();
    1590           2 :     xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
    1591           2 :     xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
    1592           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Nom: John Doe"), xPara->getString());
    1593             : 
    1594             :     // outer table: background color, borders for B1/B2 cell
    1595           2 :     xTable.set(xTables->getByIndex(2), uno::UNO_QUERY);
    1596           2 :     xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1597           2 :     CPPUNIT_ASSERT(xCell.is());
    1598           2 :     table::BorderLine2 fullPtSolid(1, 0, 35, 0, table::BorderLineStyle::SOLID, 35);
    1599           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
    1600           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1601           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
    1602           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1603           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
    1604           2 :                                 getProperty<table::BorderLine2>(xCell, "TopBorder"));
    1605           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
    1606           2 :                                 getProperty<table::BorderLine2>(xCell, "BottomBorder"));
    1607           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xCell, "BackColor"));
    1608           2 :     xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
    1609           2 :     CPPUNIT_ASSERT(xCell.is());
    1610           2 :     table::BorderLine2 halfPtSolid(/*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18);
    1611           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
    1612           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1613           4 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff),
    1614           2 :                          getProperty<sal_Int32>(xCell, "BackColor"));
    1615           2 :     xCell.set(xTable->getCellByName("B2"), uno::UNO_QUERY);
    1616           2 :     CPPUNIT_ASSERT(xCell.is());
    1617           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
    1618           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1619           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
    1620           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1621           4 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff),
    1622           2 :                          getProperty<sal_Int32>(xCell, "BackColor"));
    1623             : 
    1624             :     // \sect at the end resulted in spurious page break
    1625           4 :     CPPUNIT_ASSERT_EQUAL(1, getPages());
    1626           2 : }
    1627             : 
    1628          18 : DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf")
    1629             : {
    1630           2 :     uno::Reference<text::XTextRange> xParaSecond = getParagraph(2);
    1631           2 :     CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString());
    1632           4 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
    1633           2 :                          getProperty<style::BreakType>(xParaSecond, "BreakType"));
    1634           4 :     CPPUNIT_ASSERT_EQUAL(uno::Any(),
    1635           2 :                          uno::Reference<beans::XPropertySet>(xParaSecond, uno::UNO_QUERY)->getPropertyValue("PageDescName"));
    1636             :     // actually not sure how many paragraph there should be between
    1637             :     // SECOND and THIRD - important is that the page break is on there
    1638           4 :     uno::Reference<text::XTextRange> xParaNext = getParagraph(3);
    1639           2 :     CPPUNIT_ASSERT_EQUAL(OUString(""), xParaNext->getString());
    1640           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Converted1"),
    1641           2 :                          getProperty<OUString>(xParaNext, "PageDescName"));
    1642           4 :     uno::Reference<text::XTextRange> xParaThird = getParagraph(4);
    1643           2 :     CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString());
    1644           4 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
    1645           2 :                          getProperty<style::BreakType>(xParaThird, "BreakType"));
    1646           4 :     CPPUNIT_ASSERT_EQUAL(uno::Any(),
    1647           2 :                          uno::Reference<beans::XPropertySet>(xParaThird, uno::UNO_QUERY)->getPropertyValue("PageDescName"));
    1648             : 
    1649           4 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
    1650           2 : }
    1651             : 
    1652          18 : DECLARE_RTFIMPORT_TEST(testFooterPara, "footer-para.rtf")
    1653             : {
    1654             :     // check that paragraph properties in footer are imported
    1655             :     uno::Reference<text::XText> xFooterText =
    1656           2 :         getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("First Page"), "FooterText");
    1657             :     uno::Reference<text::XTextContent> xParagraph =
    1658           4 :         getParagraphOrTable(1, xFooterText);
    1659           4 :     CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."),
    1660           2 :                          uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString());
    1661           4 :     CPPUNIT_ASSERT_EQUAL((sal_Int16)style::ParagraphAdjust_CENTER,
    1662           4 :                          getProperty</*style::ParagraphAdjust*/sal_Int16>(xParagraph, "ParaAdjust"));
    1663           2 : }
    1664             : 
    1665          18 : DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf")
    1666             : {
    1667             :     // The single-line document had a second fake empty para on Windows.
    1668           2 :     bool bFound = true;
    1669             :     try
    1670             :     {
    1671           4 :         getParagraph(2);
    1672             :     }
    1673           4 :     catch (const container::NoSuchElementException&)
    1674             :     {
    1675           2 :         bFound = false;
    1676             :     }
    1677           2 :     CPPUNIT_ASSERT_EQUAL(false, bFound);
    1678           2 : }
    1679             : 
    1680          18 : DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf")
    1681             : {
    1682           2 :     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
    1683           4 :     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1684           4 :     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1685           4 :     uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
    1686             :     // The first row had 3 cells, instead of a horizontally merged one and a normal one (2 -> 1 separator).
    1687           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
    1688           2 : }
    1689             : 
    1690          18 : DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
    1691             : {
    1692             :     // table borders without \brdrw were not imported
    1693           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1694           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1695           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1696           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1697           2 :     CPPUNIT_ASSERT(xCell.is());
    1698           2 :     table::BorderLine2 solid(1, 0, 26, 0, table::BorderLineStyle::SOLID, 26);
    1699           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(solid,
    1700           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1701           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(solid,
    1702           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1703           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(solid,
    1704           2 :                                 getProperty<table::BorderLine2>(xCell, "TopBorder"));
    1705           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(solid,
    1706           2 :                                 getProperty<table::BorderLine2>(xCell, "BottomBorder"));
    1707             : 
    1708           2 :     xTable.set(xTables->getByIndex(1), uno::UNO_QUERY);
    1709           2 :     xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1710           2 :     CPPUNIT_ASSERT(xCell.is());
    1711           2 :     table::BorderLine2 dotted(1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26);
    1712           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
    1713           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1714           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
    1715           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1716           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
    1717           2 :                                 getProperty<table::BorderLine2>(xCell, "TopBorder"));
    1718           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
    1719           2 :                                 getProperty<table::BorderLine2>(xCell, "BottomBorder"));
    1720             : 
    1721           2 :     xTable.set(xTables->getByIndex(2), uno::UNO_QUERY);
    1722           2 :     xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1723           2 :     CPPUNIT_ASSERT(xCell.is());
    1724           2 :     table::BorderLine2 doubled(1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79);
    1725           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
    1726           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1727           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
    1728           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1729           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
    1730           2 :                                 getProperty<table::BorderLine2>(xCell, "TopBorder"));
    1731           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
    1732           2 :                                 getProperty<table::BorderLine2>(xCell, "BottomBorder"));
    1733             : 
    1734           2 :     xTable.set(xTables->getByIndex(3), uno::UNO_QUERY);
    1735           2 :     xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1736           2 :     CPPUNIT_ASSERT(xCell.is());
    1737           2 :     table::BorderLine2 thinThickMG(1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53);
    1738           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
    1739           2 :                                 getProperty<table::BorderLine2>(xCell, "LeftBorder"));
    1740           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
    1741           2 :                                 getProperty<table::BorderLine2>(xCell, "RightBorder"));
    1742           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
    1743           2 :                                 getProperty<table::BorderLine2>(xCell, "TopBorder"));
    1744           4 :     CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
    1745           4 :                                 getProperty<table::BorderLine2>(xCell, "BottomBorder"));
    1746           2 : }
    1747             : 
    1748          18 : DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf")
    1749             : {
    1750             :     // Test that shpz has priority over dhght and not the other way around.
    1751             :     // Drawpage is sorted by ZOrder, so first should be red (back).
    1752           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(getShape(1), "FillColor"));
    1753             :     // Second (front) should be green.
    1754           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(getShape(2), "FillColor"));
    1755           2 : }
    1756             : 
    1757          18 : DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf")
    1758             : {
    1759             :     // The first shape wasn't in the foreground.
    1760           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "Opaque")));
    1761           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque")));
    1762           2 : }
    1763             : 
    1764          18 : DECLARE_RTFIMPORT_TEST(testLevelfollow, "levelfollow.rtf")
    1765             : {
    1766           2 :     uno::Reference<container::XIndexAccess> xNum1Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
    1767           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::LISTTAB), comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, tab
    1768             : 
    1769           4 :     uno::Reference<container::XIndexAccess> xNum2Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum2"), "NumberingRules");
    1770           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::SPACE), comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, space
    1771             : 
    1772           4 :     uno::Reference<container::XIndexAccess> xNum3Levels = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum3"), "NumberingRules");
    1773           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(SvxNumberFormat::NOTHING), comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["LabelFollowedBy"].get<sal_Int16>()); // first level, nothing
    1774           2 : }
    1775             : 
    1776          18 : DECLARE_RTFIMPORT_TEST(testCharColor, "char-color.rtf")
    1777             : {
    1778             :     // This was -1: character color wasn't set.
    1779           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x365F91), getProperty<sal_Int32>(getParagraph(1), "CharColor"));
    1780           2 : }
    1781             : 
    1782          18 : DECLARE_RTFIMPORT_TEST(testFdo69289, "fdo69289.rtf")
    1783             : {
    1784           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1785           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1786           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1787           4 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1788             :     // There were only 2 cells (1 separators) in the table, should be 3 (2 separators).
    1789           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
    1790           2 : }
    1791             : 
    1792          18 : DECLARE_RTFIMPORT_TEST(testDptxbxRelation, "dptxbx-relation.rtf")
    1793             : {
    1794             :     // This was FRAME, not PAGE_FRAME, even if dobxpage is in the document.
    1795           2 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation"));
    1796           2 : }
    1797             : 
    1798          18 : DECLARE_RTFIMPORT_TEST(testDprectAnchor, "dprect-anchor.rtf")
    1799             : {
    1800             :     // This was at-page, which is not something Word supports, so clearly an import error.
    1801           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
    1802           2 : }
    1803             : 
    1804          18 : DECLARE_RTFIMPORT_TEST(testFdo76628, "fdo76628.rtf")
    1805             : {
    1806           2 :     OUString aExpected("\xd0\x9e\xd0\x91\xd0\xa0\xd0\x90\xd0\x97\xd0\x95\xd0\xa6", 14, RTL_TEXTENCODING_UTF8);
    1807             :     // Should be 'SAMPLE' in Russian, was garbage.
    1808           2 :     getParagraph(1, aExpected);
    1809             : 
    1810           4 :     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
    1811           4 :     OUString aExpectedHeader("\xd0\x9f\xd0\xbe\xd0\xb4\xd0\xb3\xd0\xbe\xd1\x82\xd0\xbe\xd0\xb2\xd0\xbb\xd0\xb5\xd0\xbd\xd0\xbe", 24, RTL_TEXTENCODING_UTF8);
    1812             :     // Should be 'prepared' in Russian, was garbage.
    1813           4 :     getParagraphOfText(1, xHeaderText, aExpectedHeader);
    1814           2 : }
    1815             : 
    1816          18 : DECLARE_RTFIMPORT_TEST(testFdo74823, "fdo74823.rtf")
    1817             : {
    1818           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1819           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1820           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1821             :     // Cell width of C2 was too large / column separator being 3749 too small (e.g. not set, around 3/7 of total width)
    1822           4 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
    1823           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5391), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[2].Position);
    1824           2 : }
    1825             : 
    1826          18 : DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf")
    1827             : {
    1828           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY);
    1829             :     // Writer default styles weren't disabled, so the color was gray, not default (black).
    1830           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(xPropertySet, "CharColor"));
    1831           2 : }
    1832             : 
    1833          18 : DECLARE_RTFIMPORT_TEST(testFdo77267, "fdo77267.rtf")
    1834             : {
    1835             :     // Paragraph was aligned to left, should be center.
    1836           2 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
    1837           2 : }
    1838             : 
    1839          18 : DECLARE_RTFIMPORT_TEST(testFdo75735, "fdo75735.rtf")
    1840             : {
    1841             :     // Number of tabstops in the second paragraph should be 3, was 6.
    1842           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< uno::Sequence<style::TabStop> >(getParagraph(2), "ParaTabStops").getLength());
    1843           2 : }
    1844             : 
    1845          18 : DECLARE_RTFIMPORT_TEST(testFontOverride, "font-override.rtf")
    1846             : {
    1847             :     // This was "Times New Roman".
    1848           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName"));
    1849           2 : }
    1850             : 
    1851          18 : DECLARE_RTFIMPORT_TEST(testColumnBreak, "column-break.rtf")
    1852             : {
    1853             :     // Column break at the very start of the document was ignored.
    1854           2 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
    1855           2 : }
    1856             : 
    1857          18 : DECLARE_RTFIMPORT_TEST(testFdo73241, "fdo73241.rtf")
    1858             : {
    1859             :     // This was 2, page break in table wasn't ignored.
    1860           2 :     CPPUNIT_ASSERT_EQUAL(1, getPages());
    1861           2 : }
    1862             : 
    1863          18 : DECLARE_RTFIMPORT_TEST(testFdo80905, "fdo80905.rtf")
    1864             : {
    1865           2 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
    1866           4 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
    1867           4 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
    1868           2 :     xFields->nextElement();
    1869             :     // The problem was that there was only one field in the document, but there should be true.
    1870           4 :     CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(xFields->hasMoreElements()));
    1871           2 : }
    1872             : 
    1873          18 : DECLARE_RTFIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.rtf")
    1874             : {
    1875           2 :     uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
    1876           4 :     uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
    1877             :     // This was false, we ignored the relevant compat setting to make this non-last section unbalanced.
    1878           4 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
    1879           2 : }
    1880             : 
    1881          18 : DECLARE_RTFIMPORT_TEST(testOleInline, "ole-inline.rtf")
    1882             : {
    1883             :     // Problem was that inline shape had at-page anchor.
    1884           2 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
    1885           2 : }
    1886             : 
    1887          18 : DECLARE_RTFIMPORT_TEST(testFdo80742, "fdo80742.rtf")
    1888             : {
    1889           2 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY);
    1890             :     // This was 0, outline level was body text.
    1891           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xPropertySet, "OutlineLevel"));
    1892           2 : }
    1893             : 
    1894          18 : DECLARE_RTFIMPORT_TEST(testFdo82106, "fdo82106.rtf")
    1895             : {
    1896             :     // Tab was missing after footnote not containing a tab.
    1897           2 :     getParagraph(2, "before\tafter");
    1898           2 : }
    1899             : 
    1900          18 : DECLARE_RTFIMPORT_TEST(testBehindDoc, "behind-doc.rtf")
    1901             : {
    1902             :     // The problem was that "behind doc" didn't result in the shape being in the background, only in being wrapped as "through".
    1903           2 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1904           2 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xShape, "Surround"));
    1905             :     // This was true.
    1906           2 :     CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xShape, "Opaque"));
    1907           2 : }
    1908             : 
    1909          18 : DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf")
    1910             : {
    1911           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1912           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1913           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1914           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1915             :     // This was 0, due to ignoring RTF_TRGAPH.
    1916           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), getProperty<sal_Int32>(xCell, "RightBorderDistance"));
    1917           2 : }
    1918             : 
    1919          18 : DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf")
    1920             : {
    1921             :     // This was false, as the style was imported as " Test", i.e. no whitespace stripping.
    1922           2 :     CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test")));
    1923           2 : }
    1924             : 
    1925          18 : DECLARE_RTFIMPORT_TEST(testFdo82078, "fdo82078.rtf")
    1926             : {
    1927             :     // This was awt::FontWeight::BOLD, i.e. the second run was bold, when it should be normal.
    1928           2 :     CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(getRun(getParagraph(1), 2), "CharWeight"));
    1929           2 : }
    1930             : 
    1931          18 : DECLARE_RTFIMPORT_TEST(testCsBold, "cs-bold.rtf")
    1932             : {
    1933             :     // This was awt::FontWeight::NORMAL, i.e. the first run was bold, when it should be bold (applied character style without direct formatting).
    1934           2 :     CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
    1935           2 : }
    1936             : 
    1937          18 : DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf")
    1938             : {
    1939           2 :     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Converted1"), "HeaderText");
    1940           4 :     OUString aActual = xHeaderText->getString();
    1941           4 :     OUString aExpected("First page header, section 2");
    1942             :     // This was 'Right page header, section 1'.
    1943           4 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
    1944           2 : }
    1945             : 
    1946          18 : DECLARE_RTFIMPORT_TEST(testFdo44984, "fdo44984.rtf")
    1947             : {
    1948           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1949           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1950           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1951           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1952             :     // This was Text, i.e. the checkbox field portion was missing.
    1953           4 :     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStartEnd"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType"));
    1954           2 : }
    1955             : 
    1956          18 : DECLARE_RTFIMPORT_TEST(testFdo84679, "fdo84679.rtf")
    1957             : {
    1958             :     // The problem was that the paragraph in A1 had some bottom margin, but it should not.
    1959           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    1960           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    1961           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    1962           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1963             :     // This was 282.
    1964           4 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
    1965           2 : }
    1966             : 
    1967          18 : DECLARE_RTFIMPORT_TEST(testFdo82071, "fdo82071.rtf")
    1968             : {
    1969             :     // The problem was that in TOC, chapter names were underlined, but they should not be.
    1970           2 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraph(2), 1);
    1971             :     // Make sure we test the right text portion.
    1972           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Chapter 1"), xRun->getString());
    1973             :     // This was awt::FontUnderline::SINGLE.
    1974           2 :     CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::NONE, getProperty<sal_Int16>(xRun, "CharUnderline"));
    1975           2 : }
    1976             : 
    1977          18 : DECLARE_RTFIMPORT_TEST(testFdo83464, "fdo83464.rtf")
    1978             : {
    1979             :     // Problem was that the text in the textfrme had wrong font.
    1980           2 :     uno::Reference<text::XTextRange> xFrameText(getShape(1), uno::UNO_QUERY);
    1981           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xFrameText->getString());
    1982             :     // This was Times New Roman.
    1983           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(getRun(getParagraphOfText(1, xFrameText->getText()), 1), "CharFontName"));
    1984           2 : }
    1985             : 
    1986          18 : DECLARE_RTFIMPORT_TEST(testFdo85179, "fdo85179.rtf")
    1987             : {
    1988             :     // This was 0, border around the picture was ignored on import.
    1989             :     // 360: EMU -> MM100
    1990           2 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(50800/360), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth);
    1991           2 : }
    1992             : 
    1993          18 : DECLARE_RTFIMPORT_TEST(testFdo82859, "fdo82859.rtf")
    1994             : {
    1995             :     // This was 0: "0xffffff" was converted to 0, i.e. the background was black instead of the default.
    1996           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(getShape(1), "BackColor"));
    1997           2 : }
    1998             : 
    1999          18 : DECLARE_RTFIMPORT_TEST(testFdo82076, "fdo82076.rtf")
    2000             : {
    2001             :     // Footnote position was wrong: should be at the end of the B1 cell.
    2002           2 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
    2003           4 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
    2004           4 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
    2005           4 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
    2006             :     // This resulted in container::NoSuchElementException: the footnote was at the start of the A1 cell.
    2007           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Footnote"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 2), "TextPortionType"));
    2008           2 : }
    2009             : 
    2010          18 : DECLARE_RTFIMPORT_TEST(testFdo82512, "fdo82512.rtf")
    2011             : {
    2012             :     // This was style::BreakType_NONE, column break was before the 3rd paragraph, not before the 2nd one.
    2013           2 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
    2014           2 : }
    2015             : 
    2016           8 : CPPUNIT_PLUGIN_IMPLEMENT();
    2017             : 
    2018             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10