LCOV - code coverage report
Current view: top level - libreoffice/sw/qa/extras/rtfimport - rtfimport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 504 506 99.6 %
Date: 2012-12-27 Functions: 76 77 98.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       3             :  *
       4             :  * The contents of this file are subject to the Mozilla Public License Version
       5             :  * 1.1 (the "License"); you may not use this file except in compliance with
       6             :  * the License. You may obtain a copy of the License at
       7             :  * http://www.mozilla.org/MPL/
       8             :  *
       9             :  * Software distributed under the License is distributed on an "AS IS" basis,
      10             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11             :  * for the specific language governing rights and limitations under the
      12             :  * License.
      13             :  *
      14             :  * The Initial Developer of the Original Code is
      15             :  *       Miklos Vajna <vmiklos@suse.cz> (SUSE, Inc.)
      16             :  * Portions created by the Initial Developer are Copyright (C) 2012 the
      17             :  * Initial Developer. All Rights Reserved.
      18             :  *
      19             :  * Contributor(s):
      20             :  *
      21             :  * Alternatively, the contents of this file may be used under the terms of
      22             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      23             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      24             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      25             :  * instead of those above.
      26             :  */
      27             : 
      28             : #include <com/sun/star/document/XFilter.hpp>
      29             : #include <com/sun/star/document/XImporter.hpp>
      30             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      31             : #include <com/sun/star/drawing/LineStyle.hpp>
      32             : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      33             : #include <com/sun/star/graphic/GraphicType.hpp>
      34             : #include <com/sun/star/lang/XServiceInfo.hpp>
      35             : #include <com/sun/star/style/CaseMap.hpp>
      36             : #include <com/sun/star/style/LineSpacing.hpp>
      37             : #include <com/sun/star/style/LineSpacingMode.hpp>
      38             : #include <com/sun/star/table/BorderLine2.hpp>
      39             : #include <com/sun/star/table/BorderLineStyle.hpp>
      40             : #include <com/sun/star/text/RelOrientation.hpp>
      41             : #include <com/sun/star/text/SizeType.hpp>
      42             : #include <com/sun/star/text/TableColumnSeparator.hpp>
      43             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      44             : #include <com/sun/star/text/XFootnotesSupplier.hpp>
      45             : #include <com/sun/star/text/XPageCursor.hpp>
      46             : #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
      47             : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      48             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      49             : #include <com/sun/star/text/XTextTablesSupplier.hpp>
      50             : #include <com/sun/star/text/XTextTable.hpp>
      51             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      52             : #include <com/sun/star/text/WrapTextMode.hpp>
      53             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      54             : 
      55             : #include <rtl/ustring.hxx>
      56             : #include <vcl/outdev.hxx>
      57             : #include <vcl/svapp.hxx>
      58             : #include <unotools/ucbstreamhelper.hxx>
      59             : #include <unotools/streamwrap.hxx>
      60             : 
      61             : #include <swmodeltestbase.hxx>
      62             : #include <bordertest.hxx>
      63             : 
      64             : #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
      65             : 
      66           3 : class Test : public SwModelTestBase
      67             : {
      68             : public:
      69             :     void testFdo45553();
      70             :     void testN192129();
      71             :     void testFdo45543();
      72             :     void testN695479();
      73             :     void testFdo42465();
      74             :     void testFdo45187();
      75             :     void testFdo46662();
      76             :     void testN750757();
      77             :     void testFdo45563();
      78             :     void testFdo43965();
      79             :     void testN751020();
      80             :     void testFdo47326();
      81             :     void testFdo47036();
      82             :     void testFdo46955();
      83             :     void testFdo45394();
      84             :     void testFdo48104();
      85             :     void testFdo47107();
      86             :     void testFdo45182();
      87             :     void testFdo44176();
      88             :     void testFdo39053();
      89             :     void testFdo48356();
      90             :     void testFdo48023();
      91             :     void testFdo48876();
      92             :     void testFdo48193();
      93             :     void testFdo44211();
      94             :     void testFdo48037();
      95             :     void testFdo47764();
      96             :     void testFdo38786();
      97             :     void testN757651();
      98             :     void testFdo49501();
      99             :     void testFdo49271();
     100             :     void testFdo49692();
     101             :     void testFdo45190();
     102             :     void testFdo50539();
     103             :     void testFdo50665();
     104             :     void testFdo49659();
     105             :     void testFdo46966();
     106             :     void testFdo52066();
     107             :     void testFdo48033();
     108             :     void testFdo36089();
     109             :     void testFdo49892();
     110             :     void testFdo48446();
     111             :     void testFdo47495();
     112             :     void testAllGapsWord();
     113             :     void testFdo52052();
     114             :     void testInk();
     115             :     void testFdo52389();
     116             :     void testFdo49655();
     117             :     void testFdo52475();
     118             :     void testFdo55493();
     119             :     void testCopyPastePageStyle();
     120             :     void testShptxtPard();
     121             :     void testDoDhgt();
     122             :     void testDplinehollow();
     123             :     void testLeftmarginDefault();
     124             :     void testDppolyline();
     125             :     void testFdo56512();
     126             :     void testFdo52989();
     127             :     void testFdo48442();
     128             :     void testFdo55525();
     129             :     void testFdo57708();
     130             :     void testFdo54473();
     131             :     void testFdo49934();
     132             :     void testFdo57886();
     133             :     void testFdo58076();
     134             : 
     135           2 :     CPPUNIT_TEST_SUITE(Test);
     136             : #if !defined(MACOSX) && !defined(WNT)
     137           1 :     CPPUNIT_TEST(run);
     138             : #endif
     139           2 :     CPPUNIT_TEST_SUITE_END();
     140             : 
     141             : private:
     142             :     void run();
     143             :     /// Get page count.
     144             :     int getPages();
     145             : };
     146             : 
     147           1 : void Test::run()
     148             : {
     149             :     MethodEntry<Test> aMethods[] = {
     150             :         {"fdo45553.rtf", &Test::testFdo45553},
     151             :         {"n192129.rtf", &Test::testN192129},
     152             :         {"fdo45543.rtf", &Test::testFdo45543},
     153             :         {"n695479.rtf", &Test::testN695479},
     154             :         {"fdo42465.rtf", &Test::testFdo42465},
     155             :         {"fdo45187.rtf", &Test::testFdo45187},
     156             :         {"fdo46662.rtf", &Test::testFdo46662},
     157             :         {"n750757.rtf", &Test::testN750757},
     158             :         {"fdo45563.rtf", &Test::testFdo45563},
     159             :         {"fdo43965.rtf", &Test::testFdo43965},
     160             :         {"n751020.rtf", &Test::testN751020},
     161             :         {"fdo47326.rtf", &Test::testFdo47326},
     162             :         {"fdo47036.rtf", &Test::testFdo47036},
     163             :         {"fdo46955.rtf", &Test::testFdo46955},
     164             :         {"fdo45394.rtf", &Test::testFdo45394},
     165             :         {"fdo48104.rtf", &Test::testFdo48104},
     166             :         {"fdo47107.rtf", &Test::testFdo47107},
     167             :         {"fdo45182.rtf", &Test::testFdo45182},
     168             :         {"fdo44176.rtf", &Test::testFdo44176},
     169             :         {"fdo39053.rtf", &Test::testFdo39053},
     170             :         {"fdo48356.rtf", &Test::testFdo48356},
     171             :         {"fdo48023.rtf", &Test::testFdo48023},
     172             :         {"fdo48876.rtf", &Test::testFdo48876},
     173             :         {"fdo48193.rtf", &Test::testFdo48193},
     174             :         {"fdo44211.rtf", &Test::testFdo44211},
     175             :         {"fdo48037.rtf", &Test::testFdo48037},
     176             :         {"fdo47764.rtf", &Test::testFdo47764},
     177             :         {"fdo38786.rtf", &Test::testFdo38786},
     178             :         {"n757651.rtf", &Test::testN757651},
     179             :         {"fdo49501.rtf", &Test::testFdo49501},
     180             :         {"fdo49271.rtf", &Test::testFdo49271},
     181             :         {"fdo49692.rtf", &Test::testFdo49692},
     182             :         {"fdo45190.rtf", &Test::testFdo45190},
     183             :         {"fdo50539.rtf", &Test::testFdo50539},
     184             :         {"fdo50665.rtf", &Test::testFdo50665},
     185             :         {"fdo49659.rtf", &Test::testFdo49659},
     186             :         {"fdo46966.rtf", &Test::testFdo46966},
     187             :         {"fdo52066.rtf", &Test::testFdo52066},
     188             :         {"fdo48033.rtf", &Test::testFdo48033},
     189             :         {"fdo36089.rtf", &Test::testFdo36089},
     190             :         {"fdo49892.rtf", &Test::testFdo49892},
     191             :         {"fdo48446.rtf", &Test::testFdo48446},
     192             :         {"fdo47495.rtf", &Test::testFdo47495},
     193             :         {"all_gaps_word.rtf", &Test::testAllGapsWord},
     194             :         {"fdo52052.rtf", &Test::testFdo52052},
     195             :         {"ink.rtf", &Test::testInk},
     196             :         {"fdo52389.rtf", &Test::testFdo52389},
     197             :         {"fdo49655.rtf", &Test::testFdo49655},
     198             :         {"fdo52475.rtf", &Test::testFdo52475},
     199             :         {"fdo55493.rtf", &Test::testFdo55493},
     200             :         {"copypaste-pagestyle.rtf", &Test::testCopyPastePageStyle},
     201             :         {"shptxt-pard.rtf", &Test::testShptxtPard},
     202             :         {"do-dhgt.rtf", &Test::testDoDhgt},
     203             :         {"dplinehollow.rtf", &Test::testDplinehollow},
     204             :         {"leftmargin-default.rtf", &Test::testLeftmarginDefault},
     205             :         {"dppolyline.rtf", &Test::testDppolyline},
     206             :         {"fdo56512.rtf", &Test::testFdo56512},
     207             :         {"fdo52989.rtf", &Test::testFdo52989},
     208             :         {"fdo48442.rtf", &Test::testFdo48442},
     209             :         {"fdo55525.rtf", &Test::testFdo55525},
     210             :         {"fdo57708.rtf", &Test::testFdo57708},
     211             :         {"fdo54473.rtf", &Test::testFdo54473},
     212             :         {"fdo49934.rtf", &Test::testFdo49934},
     213             :         {"fdo57886.rtf", &Test::testFdo57886},
     214             :         {"fdo58076.rtf", &Test::testFdo58076},
     215           1 :     };
     216           1 :     header();
     217          66 :     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     218             :     {
     219          65 :         MethodEntry<Test>& rEntry = aMethods[i];
     220          65 :         AllSettings aSavedSettings(Application::GetSettings());
     221          65 :         if (OString(rEntry.pName) == "fdo48023.rtf")
     222             :         {
     223           1 :             AllSettings aSettings(aSavedSettings);
     224           1 :             aSettings.SetLanguageTag(LanguageTag("ru"));
     225           1 :             Application::SetSettings(aSettings);
     226             :         }
     227          64 :         else if (OString(rEntry.pName) == "fdo44211.rtf")
     228             :         {
     229           1 :             AllSettings aSettings(aSavedSettings);
     230           1 :             aSettings.SetLanguageTag(LanguageTag("lt"));
     231           1 :             Application::SetSettings(aSettings);
     232             :         }
     233          65 :         load("/sw/qa/extras/rtfimport/data/", rEntry.pName);
     234          65 :         if (OString(rEntry.pName) == "fdo48023.rtf" || OString(rEntry.pName) == "fdo44211.rtf")
     235           2 :             Application::SetSettings(aSavedSettings);
     236          65 :         (this->*rEntry.pMethod)();
     237          65 :         finish();
     238          65 :     }
     239           1 : }
     240             : 
     241           4 : int Test::getPages()
     242             : {
     243           4 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     244           4 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     245           4 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     246           4 :     xCursor->jumpToLastPage();
     247           4 :     return xCursor->getPage();
     248             : }
     249             : 
     250           1 : void Test::testFdo45553()
     251             : {
     252           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     253           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     254           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     255           4 :     while (xParaEnum->hasMoreElements())
     256             :     {
     257           2 :         uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     258           2 :         uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     259           6 :         while (xRangeEnum->hasMoreElements())
     260             :         {
     261           2 :             uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
     262           2 :             OUString aStr = xRange->getString();
     263           2 :             if ( aStr == "space-before" )
     264           1 :                 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(120)), getProperty<sal_Int32>(xRange, "ParaTopMargin"));
     265           1 :             else if ( aStr == "space-after" )
     266           1 :                 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(240)), getProperty<sal_Int32>(xRange, "ParaBottomMargin"));
     267           2 :         }
     268           3 :     }
     269           1 : }
     270             : 
     271           1 : void Test::testN192129()
     272             : {
     273             :     // We expect that the result will be 16x16px.
     274           1 :     Size aExpectedSize(16, 16);
     275           1 :     MapMode aMap(MAP_100TH_MM);
     276           1 :     aExpectedSize = Application::GetDefaultDevice()->PixelToLogic( aExpectedSize, aMap );
     277             : 
     278           1 :     uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY);
     279           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
     280           1 :     uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     281           1 :     awt::Size aActualSize(xShape->getSize());
     282             : 
     283           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width);
     284           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
     285           1 : }
     286             : 
     287           1 : void Test::testFdo45543()
     288             : {
     289           1 :     CPPUNIT_ASSERT_EQUAL(5, getLength());
     290           1 : }
     291             : 
     292           1 : void Test::testN695479()
     293             : {
     294           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     295           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     296           1 :     uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     297             : 
     298             :     // Negative ABSH should mean fixed size.
     299           1 :     CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xPropertySet, "SizeType"));
     300           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), getProperty<sal_Int32>(xPropertySet, "Height"));
     301             : 
     302           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     303           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     304           1 :     bool bFrameFound = false, bDrawFound = false;
     305           4 :     for (int i = 0; i < xDraws->getCount(); ++i)
     306             :     {
     307           3 :         uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(i), uno::UNO_QUERY);
     308           3 :         if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
     309             :         {
     310             :             // Both frames should be anchored to the first paragraph.
     311           2 :             bFrameFound = true;
     312           2 :             uno::Reference<text::XTextContent> xTextContent(xServiceInfo, uno::UNO_QUERY);
     313           2 :             uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
     314           2 :             uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
     315           2 :             CPPUNIT_ASSERT_EQUAL(OUString("plain"), xText->getString());
     316             : 
     317           2 :             if (i == 0)
     318             :                 // Additonally, the frist frame should have double border at the bottom.
     319           0 :                 CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, getProperty<table::BorderLine2>(xPropertySet, "BottomBorder").LineStyle);
     320             :         }
     321           1 :         else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape"))
     322             :         {
     323             :             // The older "drawing objects" syntax should be recognized.
     324           1 :             bDrawFound = true;
     325           1 :             xPropertySet.set(xServiceInfo, uno::UNO_QUERY);
     326           1 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xPropertySet, "HoriOrientRelation"));
     327           1 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xPropertySet, "VertOrientRelation"));
     328             :         }
     329           3 :     }
     330           1 :     CPPUNIT_ASSERT(bFrameFound);
     331           1 :     CPPUNIT_ASSERT(bDrawFound);
     332           1 : }
     333             : 
     334           1 : void Test::testFdo42465()
     335             : {
     336           1 :     CPPUNIT_ASSERT_EQUAL(3, getLength());
     337           1 : }
     338             : 
     339           1 : void Test::testFdo45187()
     340             : {
     341           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     342           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     343             :     // There should be two shapes.
     344           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
     345             :     // They should be anchored to different paragraphs.
     346           1 :     CPPUNIT_ASSERT(getProperty<awt::Point>(xDraws->getByIndex(0), "AnchorPosition").Y != getProperty<awt::Point>(xDraws->getByIndex(1), "AnchorPosition").Y);
     347           1 : }
     348             : 
     349           1 : void Test::testFdo46662()
     350             : {
     351           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
     352           1 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
     353           1 :     uno::Sequence<beans::PropertyValue> aProps;
     354           1 :     xLevels->getByIndex(1) >>= aProps; // 2nd level
     355             : 
     356          13 :     for (int i = 0; i < aProps.getLength(); ++i)
     357             :     {
     358          12 :         const beans::PropertyValue& rProp = aProps[i];
     359             : 
     360          12 :         if ( rProp.Name == "ParentNumbering" )
     361           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get<sal_Int16>());
     362          11 :         else if ( rProp.Name == "Suffix" )
     363           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
     364           1 :     }
     365           1 : }
     366             : 
     367           1 : void Test::testN750757()
     368             : {
     369           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     370           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     371           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     372             : 
     373           1 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(false), getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin"));
     374           1 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(true), getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin"));
     375           1 : }
     376             : 
     377           1 : void Test::testFdo45563()
     378             : {
     379           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     380           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     381           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     382           1 :     int i = 0;
     383           6 :     while (xParaEnum->hasMoreElements())
     384             :     {
     385           4 :         xParaEnum->nextElement();
     386           4 :         i++;
     387             :     }
     388           1 :     CPPUNIT_ASSERT_EQUAL(4, i);
     389           1 : }
     390             : 
     391           1 : void Test::testFdo43965()
     392             : {
     393           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     394           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     395           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     396             : 
     397             :     // First paragraph: the parameter of \up was ignored
     398           1 :     uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     399           1 :     uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     400           1 :     uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
     401           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty<sal_Int32>(xPropertySet, "CharEscapement"));
     402           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight"));
     403             : 
     404             :     // Second paragraph: Word vs Writer border default problem
     405           1 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth);
     406             : 
     407             :     // Finally, make sure that we have two pages
     408           1 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     409           1 : }
     410             : 
     411           1 : void Test::testN751020()
     412             : {
     413           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     414           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     415           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     416           1 :     CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
     417           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin"));
     418           1 : }
     419             : 
     420           1 : void Test::testFdo47326()
     421             : {
     422             :     // This was 15 only, as \super buffered text, then the contents of it got lost.
     423           1 :     CPPUNIT_ASSERT_EQUAL(19, getLength());
     424           1 : }
     425             : 
     426           1 : void Test::testFdo47036()
     427             : {
     428           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     429           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     430           1 :     int nAtCharacter = 0;
     431           4 :     for (int i = 0; i < xDraws->getCount(); ++i)
     432             :     {
     433           3 :         if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AT_CHARACTER)
     434           1 :             nAtCharacter++;
     435             :     }
     436             :     // The image at the document start was ignored.
     437           1 :     CPPUNIT_ASSERT_EQUAL(1, nAtCharacter);
     438             : 
     439             :     // There should be 2 textboxes, not 4
     440           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     441           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     442           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
     443           1 : }
     444             : 
     445           1 : void Test::testFdo46955()
     446             : {
     447           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     448           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     449           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     450           3 :     while (xParaEnum->hasMoreElements())
     451             :     {
     452           1 :         uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     453           1 :         uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
     454           3 :         while (xRangeEnum->hasMoreElements())
     455           1 :             CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap"));
     456           2 :     }
     457           1 : }
     458             : 
     459           1 : void Test::testFdo45394()
     460             : {
     461           1 :     uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
     462           1 :     OUString aActual = xHeaderText->getString();
     463             :     // Encoding in the header was wrong.
     464           1 :     OUString aExpected("ПК РИК", 11, RTL_TEXTENCODING_UTF8);
     465           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     466             : 
     467           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     468           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     469           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     470           1 : }
     471             : 
     472           1 : void Test::testFdo48104()
     473             : {
     474           1 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     475           1 : }
     476             : 
     477           1 : void Test::testFdo47107()
     478             : {
     479           1 :     uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
     480             :     // Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
     481           1 :     xNumberingStyles->getByName("WWNum1");
     482           1 :     xNumberingStyles->getByName("WWNum2");
     483           1 : }
     484             : 
     485           1 : void Test::testFdo45182()
     486             : {
     487           1 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     488           1 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
     489           1 :     uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
     490             :     // Encoding in the footnote was wrong.
     491           1 :     OUString aExpected("živností", 10, RTL_TEXTENCODING_UTF8);
     492           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     493           1 : }
     494             : 
     495           1 : void Test::testFdo44176()
     496             : {
     497           1 :     uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
     498           1 :     uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
     499           1 :     uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     500           1 :     sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
     501           1 :     xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
     502           1 :     xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
     503           1 :     xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
     504           1 :     CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
     505           1 : }
     506             : 
     507           1 : void Test::testFdo39053()
     508             : {
     509           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     510           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     511           1 :     int nAsCharacter = 0;
     512           2 :     for (int i = 0; i < xDraws->getCount(); ++i)
     513           1 :         if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AS_CHARACTER)
     514           1 :             nAsCharacter++;
     515             :     // The image in binary format was ignored.
     516           1 :     CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
     517           1 : }
     518             : 
     519           1 : void Test::testFdo48356()
     520             : {
     521           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     522           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     523           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     524           1 :     OUStringBuffer aBuf;
     525           1 :     int i = 0;
     526           3 :     while (xParaEnum->hasMoreElements())
     527             :     {
     528           1 :         xParaEnum->nextElement();
     529           1 :         i++;
     530             :     }
     531             :     // The document used to be imported as two paragraphs.
     532           1 :     CPPUNIT_ASSERT_EQUAL(1, i);
     533           1 : }
     534             : 
     535           1 : void Test::testFdo48023()
     536             : {
     537           1 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
     538             : 
     539             :     // Implicit encoding detection based on locale was missing
     540           1 :     OUString aExpected("Программист", 22, RTL_TEXTENCODING_UTF8);
     541           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     542           1 : }
     543             : 
     544           1 : void Test::testFdo48876()
     545             : {
     546           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     547           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     548           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     549           1 :     CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
     550           1 :     CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode);
     551           1 : }
     552             : 
     553           1 : void Test::testFdo48193()
     554             : {
     555           1 :     CPPUNIT_ASSERT_EQUAL(7, getLength());
     556           1 : }
     557             : 
     558           1 : void Test::testFdo44211()
     559             : {
     560           1 :     uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
     561             : 
     562           1 :     OUString aExpected("ąčę", 6, RTL_TEXTENCODING_UTF8);
     563           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     564           1 : }
     565             : 
     566           1 : void Test::testFdo48037()
     567             : {
     568           1 :     uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
     569           1 :     lang::Locale aUSLocale, aFRLocale;
     570           1 :     aUSLocale.Language = "en";
     571           1 :     aFRLocale.Language = "fr";
     572           1 :     sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale);
     573             : 
     574           1 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     575           1 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     576           1 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     577           1 :     uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
     578           1 :     sal_Int32 nActual = 0;
     579           1 :     xPropertySet->getPropertyValue("NumberFormat") >>= nActual;
     580             : 
     581           1 :     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
     582           1 : }
     583             : 
     584           1 : void Test::testFdo47764()
     585             : {
     586             :     // \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
     587           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getParagraph(1), "ParaBackColor"));
     588           1 : }
     589             : 
     590           1 : void Test::testFdo38786()
     591             : {
     592           1 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     593           1 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     594           1 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     595             :     // \chpgn was ignored, so exception was thrown
     596           1 :     xFields->nextElement();
     597           1 : }
     598             : 
     599           1 : void Test::testN757651()
     600             : {
     601             :     // The bug was that due to buggy layout the text expanded to two pages.
     602           1 :     if (Application::GetDefaultDevice()->IsFontAvailable(OUString("Times New Roman")))
     603           0 :         CPPUNIT_ASSERT_EQUAL(1, getPages());
     604           1 : }
     605             : 
     606           1 : void Test::testFdo49501()
     607             : {
     608           1 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     609             : 
     610           1 :     CPPUNIT_ASSERT_EQUAL(sal_True, getProperty<sal_Bool>(xStyle, "IsLandscape"));
     611           1 :     sal_Int32 nExpected(TWIP_TO_MM100(567));
     612           1 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "LeftMargin"));
     613           1 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "RightMargin"));
     614           1 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "TopMargin"));
     615           1 :     CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "BottomMargin"));
     616           1 : }
     617             : 
     618           1 : void Test::testFdo49271()
     619             : {
     620           1 :     CPPUNIT_ASSERT_EQUAL(25.f, getProperty<float>(getParagraph(2), "CharHeight"));
     621           1 : }
     622             : 
     623           1 : void Test::testFdo49692()
     624             : {
     625           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
     626           1 :     uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
     627           1 :     uno::Sequence<beans::PropertyValue> aProps;
     628           1 :     xLevels->getByIndex(0) >>= aProps; // 1st level
     629             : 
     630          13 :     for (int i = 0; i < aProps.getLength(); ++i)
     631             :     {
     632          12 :         const beans::PropertyValue& rProp = aProps[i];
     633             : 
     634          12 :         if (rProp.Name == "Suffix")
     635           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength());
     636           1 :     }
     637           1 : }
     638             : 
     639           1 : void Test::testFdo45190()
     640             : {
     641             :     // inherited \fi should be reset
     642           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
     643             : 
     644             :     // but direct one not
     645           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent"));
     646           1 : }
     647             : 
     648           1 : void Test::testFdo50539()
     649             : {
     650             :     // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black)
     651           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor"));
     652           1 : }
     653             : 
     654           1 : void Test::testFdo50665()
     655             : {
     656             :     // Access the second run, which is a textfield
     657           1 :     uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY);
     658             :     // This used to be the default, as character properties were ignored.
     659           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty<OUString>(xRun, "CharFontName"));
     660           1 : }
     661             : 
     662           1 : void Test::testFdo49659()
     663             : {
     664             :     // Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc
     665           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     666           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     667           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
     668             : 
     669             :     // The graphic was also empty
     670           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     671           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     672           1 :     uno::Reference<beans::XPropertySet> xGraphic(getProperty< uno::Reference<beans::XPropertySet> >(xDraws->getByIndex(0), "Graphic"), uno::UNO_QUERY);
     673           1 :     CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType"));
     674           1 : }
     675             : 
     676           1 : void Test::testFdo46966()
     677             : {
     678             :     /*
     679             :      * The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
     680             :      *
     681             :      * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
     682             :      */
     683           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     684           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
     685           1 : }
     686             : 
     687           1 : void Test::testFdo52066()
     688             : {
     689             :     /*
     690             :      * The problem was that the height of the shape was too big.
     691             :      *
     692             :      * xray ThisComponent.DrawPage(0).Size.Height
     693             :      */
     694           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     695           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     696           1 :     uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
     697           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height);
     698           1 : }
     699             : 
     700           1 : void Test::testFdo48033()
     701             : {
     702             :     /*
     703             :      * The problem was that the picture was in the first cell, instead of the second one.
     704             :      *
     705             :      * oTable = ThisComponent.TextTables(0)
     706             :      * oParas = oTable.getCellByName("B1").Text.createEnumeration
     707             :      * oPara = oParas.nextElement
     708             :      * oRuns = oPara.createEnumeration
     709             :      * oRun = oRuns.nextElement
     710             :      * xray oRun.TextPortionType ' Frame, was Text
     711             :      */
     712           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     713           1 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     714           1 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     715           1 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
     716           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
     717           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     718           1 :     uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
     719           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
     720           1 : }
     721             : 
     722           1 : void Test::testFdo36089()
     723             : {
     724           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
     725           1 : }
     726             : 
     727           1 : void Test::testFdo49892()
     728             : {
     729           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     730           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     731           6 :     for (int i = 0; i < xDraws->getCount(); ++i)
     732             :     {
     733           5 :         OUString aDescription = getProperty<OUString>(xDraws->getByIndex(i), "Description");
     734           5 :         if (aDescription == "red")
     735           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     736           4 :         else if (aDescription == "green")
     737           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     738           3 :         else if (aDescription == "blue")
     739           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     740           2 :         else if (aDescription == "rect")
     741             :         {
     742           1 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation"));
     743           1 :             CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation"));
     744             :         }
     745           6 :     }
     746           1 : }
     747             : 
     748           1 : void Test::testFdo48446()
     749             : {
     750           1 :     OUString aExpected("Имя", 6, RTL_TEXTENCODING_UTF8);
     751           1 :     getParagraph(1, aExpected);
     752           1 : }
     753             : 
     754           1 : void Test::testFdo47495()
     755             : {
     756             :     // Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
     757           1 :     CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
     758           1 : }
     759             : 
     760           1 : void Test::testAllGapsWord()
     761             : {
     762           1 :     BorderTest borderTest;
     763           1 :     borderTest.testTheBorders(mxComponent);
     764           1 : }
     765             : 
     766           1 : void Test::testFdo52052()
     767             : {
     768             :     // Make sure the textframe containing the text "third" appears on the 3rd page.
     769           1 :     CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()"));
     770           1 : }
     771             : 
     772           1 : void Test::testInk()
     773             : {
     774             :     /*
     775             :      * The problem was that the second segment had wrong command count and wrap type.
     776             :      *
     777             :      * oShape = ThisComponent.DrawPage(0)
     778             :      * oPathPropVec = oShape.CustomShapeGeometry(1).Value
     779             :      * oSegments = oPathPropVec(1).Value
     780             :      * msgbox oSegments(1).Count ' was 0x2000 | 10, should be 10
     781             :      * msgbox oShape.Surround ' was 2, should be 1
     782             :      */
     783           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     784           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     785           1 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xDraws->getByIndex(0), "CustomShapeGeometry");
     786           1 :     uno::Sequence<beans::PropertyValue> aPathProps;
     787           4 :     for (int i = 0; i < aProps.getLength(); ++i)
     788             :     {
     789           3 :         const beans::PropertyValue& rProp = aProps[i];
     790           3 :         if (rProp.Name == "Path")
     791           1 :             rProp.Value >>= aPathProps;
     792             :     }
     793           1 :     uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
     794           3 :     for (int i = 0; i < aPathProps.getLength(); ++i)
     795             :     {
     796           2 :         const beans::PropertyValue& rProp = aPathProps[i];
     797           2 :         if (rProp.Name == "Segments")
     798           1 :             rProp.Value >>= aSegments;
     799             :     }
     800           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(10), aSegments[1].Count);
     801           1 :     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xDraws->getByIndex(0), "Surround"));
     802           1 : }
     803             : 
     804           1 : void Test::testFdo52389()
     805             : {
     806             :     // The last '!' character at the end of the document was lost
     807           1 :     CPPUNIT_ASSERT_EQUAL(6, getLength());
     808           1 : }
     809             : 
     810           1 : void Test::testFdo49655()
     811             : {
     812             :     /*
     813             :      * The problem was that the table was not imported due to the '  ' string in the middle of the table definition.
     814             :      *
     815             :      * xray ThisComponent.TextTables.Count 'was 0
     816             :      */
     817           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     818           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     819           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
     820           1 : }
     821             : 
     822           1 : void Test::testFdo52475()
     823             : {
     824             :     // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
     825           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
     826           1 : }
     827             : 
     828           1 : void Test::testFdo55493()
     829             : {
     830             :     // The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
     831           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     832           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     833           1 :     uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
     834           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
     835           1 : }
     836             : 
     837           1 : void Test::testCopyPastePageStyle()
     838             : {
     839             :     // The problem was that RTF import during copy&paste did not ignore page styles.
     840             :     // Once we have more copy&paste tests, makes sense to refactor this to some helper method.
     841           1 :     uno::Reference<uno::XInterface> xInterface(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
     842           1 :     uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
     843           1 :     xImporter->setTargetDocument(mxComponent);
     844           1 :     uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
     845           1 :     uno::Sequence<beans::PropertyValue> aDescriptor(2);
     846           1 :     aDescriptor[0].Name = "InputStream";
     847           1 :     SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + "copypaste-pagestyle-paste.rtf", STREAM_WRITE);
     848           1 :     uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream));
     849           1 :     aDescriptor[0].Value <<= xStream;
     850           1 :     aDescriptor[1].Name = "IsNewDoc";
     851           1 :     aDescriptor[1].Value <<= sal_False;
     852           1 :     xFilter->filter(aDescriptor);
     853             : 
     854           1 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     855           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
     856           1 : }
     857             : 
     858           1 : void Test::testShptxtPard()
     859             : {
     860             :     // The problem was that \pard inside \shptxt caused loss of shape text
     861           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     862           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     863           1 :     uno::Reference<text::XText> xText(xDraws->getByIndex(0), uno::UNO_QUERY);
     864           1 :     CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
     865           1 : }
     866             : 
     867           1 : void Test::testDoDhgt()
     868             : {
     869           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     870           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     871           4 :     for (int i = 0; i < xDraws->getCount(); ++i)
     872             :     {
     873           3 :         sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor");
     874           3 :         if (nFillColor == 0xc0504d) // red
     875           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     876           2 :         else if (nFillColor == 0x9bbb59) // green
     877           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     878           1 :         else if (nFillColor == 0x4f81bd) // blue
     879           1 :             CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
     880           1 :     }
     881           1 : }
     882             : 
     883           1 : void Test::testDplinehollow()
     884             : {
     885           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     886           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     887           1 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
     888           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle"));
     889           1 : }
     890             : 
     891           1 : void Test::testLeftmarginDefault()
     892             : {
     893             :     // The default left/right margin was incorrect when the top margin was set to zero.
     894           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
     895           1 : }
     896             : 
     897           1 : void Test::testDppolyline()
     898             : {
     899             :     // This was completely ignored, for now, just make sure we have all 4 lines.
     900           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     901           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     902           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
     903           1 : }
     904             : 
     905           1 : void Test::testFdo56512()
     906             : {
     907           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     908           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     909           1 :     uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     910           1 :     OUString aExpected("עוסק מורשה ", 20, RTL_TEXTENCODING_UTF8);
     911           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
     912           1 : }
     913             : 
     914           1 : void Test::testFdo52989()
     915             : {
     916             :     // Same as n#192129, but for JPEG files.
     917           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     918           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     919           1 :     uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
     920           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width);
     921           1 : }
     922             : 
     923           1 : void Test::testFdo48442()
     924             : {
     925             :     // The problem was that \pvmrg is the default in RTF, but not in Writer.
     926           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     927           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     928           1 :     uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
     929           1 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME
     930           1 : }
     931             : 
     932           1 : void Test::testFdo55525()
     933             : {
     934           1 :     uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
     935           1 :     uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
     936           1 :     uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
     937             :     // Negative left margin was ~missing, -191
     938           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty<sal_Int32>(xTable, "LeftMargin"));
     939             :     // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width)
     940           1 :     uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
     941           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1016), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
     942           1 : }
     943             : 
     944           1 : void Test::testFdo57708()
     945             : {
     946             :     // There were two issues: the doc was of 2 pages and the picture was missing.
     947           1 :     CPPUNIT_ASSERT_EQUAL(1, getPages());
     948           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     949           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     950             :     // Two objects: a picture and a textframe.
     951           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
     952           1 : }
     953             : 
     954           1 : void Test::testFdo54473()
     955             : {
     956             :     // The problem was that character styles were not imported due to a typo.
     957           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
     958           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
     959           1 : }
     960             : 
     961           1 : void Test::testFdo49934()
     962             : {
     963             :     // Column break without columns defined should be a page break, but it was just ignored.
     964           1 :     CPPUNIT_ASSERT_EQUAL(2, getPages());
     965           1 : }
     966             : 
     967           1 : void Test::testFdo57886()
     968             : {
     969             :     // Was 'int from <?> to <?> <?>'.
     970           1 :     CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1)));
     971           1 : }
     972             : 
     973           1 : void Test::testFdo58076()
     974             : {
     975             :     // An additional section was created, so the default page style didn't have the custom margins.
     976           1 :     uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     977           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty<sal_Int32>(xStyle, "LeftMargin"));
     978           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty<sal_Int32>(xStyle, "RightMargin"));
     979           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "TopMargin"));
     980           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
     981           1 : }
     982             : 
     983           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     984             : 
     985           4 : CPPUNIT_PLUGIN_IMPLEMENT();
     986             : 
     987             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10