LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlimport - ooxmlimport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 385 385 100.0 %
Date: 2012-08-25 Functions: 35 36 97.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 965 1922 50.2 %

           Branch data     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 "../swmodeltestbase.hxx"
      29                 :            : #include "bordertest.hxx"
      30                 :            : 
      31                 :            : #include <com/sun/star/awt/XBitmap.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      34                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      35                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      36                 :            : #include <com/sun/star/text/HoriOrientation.hpp>
      37                 :            : #include <com/sun/star/text/SetVariableType.hpp>
      38                 :            : #include <com/sun/star/text/TextContentAnchorType.hpp>
      39                 :            : #include <com/sun/star/text/WrapTextMode.hpp>
      40                 :            : #include <com/sun/star/text/XDependentTextField.hpp>
      41                 :            : #include <com/sun/star/text/XFormField.hpp>
      42                 :            : #include <com/sun/star/text/XPageCursor.hpp>
      43                 :            : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      44                 :            : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      45                 :            : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      46                 :            : #include <com/sun/star/style/ParagraphAdjust.hpp>
      47                 :            : 
      48                 :            : 
      49                 :            : #include <vcl/svapp.hxx>
      50                 :            : 
      51                 :            : #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
      52                 :            : 
      53                 :            : 
      54                 :            : 
      55                 :            : using rtl::OString;
      56                 :            : using rtl::OUString;
      57                 :            : using rtl::OUStringBuffer;
      58                 :            : 
      59         [ -  + ]:        225 : class Test : public SwModelTestBase
      60                 :            : {
      61                 :            : public:
      62                 :            :     void testN751054();
      63                 :            :     void testN751117();
      64                 :            :     void testN751017();
      65                 :            :     void testN750935();
      66                 :            :     void testN757890();
      67                 :            :     void testFdo49940();
      68                 :            :     void testN751077();
      69                 :            :     void testN705956_1();
      70                 :            :     void testN705956_2();
      71                 :            :     void testN747461();
      72                 :            :     void testN750255();
      73                 :            :     void testN652364();
      74                 :            :     void testN760764();
      75                 :            :     void testN764005();
      76                 :            :     void testSmartart();
      77                 :            :     void testN764745();
      78                 :            :     void testN766477();
      79                 :            :     void testN758883();
      80                 :            :     void testN766481();
      81                 :            :     void testN766487();
      82                 :            :     void testN693238();
      83                 :            :     void testNumbering1();
      84                 :            :     void testBnc773061();
      85                 :            :     void testAllGapsWord();
      86                 :            :     void testN775906();
      87                 :            : 
      88 [ +  - ][ +  - ]:          6 :     CPPUNIT_TEST_SUITE(Test);
         [ +  - ][ +  - ]
                 [ #  # ]
      89                 :            : #if !defined(MACOSX) && !defined(WNT)
      90 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN751054);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      91 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN751117);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      92 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN751017);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      93 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN750935);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      94 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN757890);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      95 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo49940);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      96 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN751077);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      97 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN705956_1);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      98 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN705956_2);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      99 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN747461);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     100 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN750255);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     101 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN652364);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     102 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN760764);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     103 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN764005);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     104 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testSmartart);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     105 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN764745);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     106 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN766477);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     107 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN758883);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     108 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN766481);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     109 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN766487);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     110 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN693238);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     111 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testNumbering1);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     112 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testBnc773061);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     113 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testAllGapsWord);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     114 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testN775906);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     115                 :            : #endif
     116 [ +  - ][ +  - ]:          6 :     CPPUNIT_TEST_SUITE_END();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     117                 :            : 
     118                 :            : private:
     119                 :            :     /// Load an OOXML file and make the document available via mxComponent.
     120                 :            :     void load(const OUString& rURL);
     121                 :            : };
     122                 :            : 
     123                 :         75 : void Test::load(const OUString& rFilename)
     124                 :            : {
     125 [ +  - ][ +  - ]:         75 :     mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlimport/data/") + rFilename);
     126                 :         75 : }
     127                 :            : 
     128                 :          3 : void Test::testN751054()
     129                 :            : {
     130         [ +  - ]:          3 :     load("n751054.docx");
     131                 :            : 
     132         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     133 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     134 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     135                 :            :     text::TextContentAnchorType eValue;
     136 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorType") >>= eValue;
                 [ +  - ]
     137 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     138                 :          3 : }
     139                 :            : 
     140                 :          3 : void Test::testN751117()
     141                 :            : {
     142         [ +  - ]:          3 :     load("n751117.docx");
     143                 :            : 
     144         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     145 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     146                 :            : 
     147                 :            :     // First shape: the end should be an arrow, should be rotated and should be flipped.
     148 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     149                 :          3 :     OUString aValue;
     150 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("LineEndName") >>= aValue;
     151 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(aValue.indexOf("Arrow") != -1);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     152                 :            : 
     153                 :          3 :     sal_Int32 nValue = 0;
     154 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("RotateAngle") >>= nValue;
     155 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(90 * 100), nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     156                 :            : 
     157         [ +  - ]:          3 :     uno::Reference<drawing::XShape> xShape(xPropertySet, uno::UNO_QUERY);
     158 [ +  - ][ +  - ]:          3 :     awt::Size aActualSize(xShape->getSize());
     159 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(aActualSize.Width < 0);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     160                 :            : 
     161                 :            :     // The second shape should be a line
     162 [ +  - ][ +  - ]:          3 :     uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(1), uno::UNO_QUERY);
                 [ +  - ]
     163 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.LineShape"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     164                 :          3 : }
     165                 :            : 
     166                 :          3 : void Test::testN751017()
     167                 :            : {
     168         [ +  - ]:          3 :     load("n751017.docx");
     169         [ +  - ]:          3 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     170 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XNameAccess> xMasters(xTextFieldsSupplier->getTextFieldMasters());
     171                 :            :     // Make sure we have a variable named foo.
     172 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(xMasters->hasByName("com.sun.star.text.FieldMaster.SetExpression.foo"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     173                 :            : 
     174 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     175 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     176                 :          3 :     bool bFoundSet(false), bFoundGet(false);
     177 [ +  - ][ +  - ]:          9 :     while (xFields->hasMoreElements())
                 [ +  + ]
     178                 :            :     {
     179 [ +  - ][ +  - ]:          6 :         uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     180         [ +  - ]:          6 :         uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY);
     181                 :          6 :         sal_Int16 nValue = 0;
     182                 :          6 :         OUString aValue;
     183 [ +  - ][ +  + ]:          6 :         if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"))
                 [ +  - ]
     184                 :            :         {
     185                 :          3 :             bFoundSet = true;
     186         [ +  - ]:          3 :             uno::Reference<text::XDependentTextField> xDependentTextField(xServiceInfo, uno::UNO_QUERY);
     187 [ +  - ][ +  - ]:          3 :             uno::Reference<beans::XPropertySet> xMasterProps(xDependentTextField->getTextFieldMaster());
     188                 :            : 
     189                 :            :             // First step: did we set foo to "bar"?
     190 [ +  - ][ +  - ]:          3 :             xMasterProps->getPropertyValue("Name") >>= aValue;
     191 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     192 [ +  - ][ +  - ]:          3 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     193 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     194 [ +  - ][ +  - ]:          3 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     195 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     196                 :            :         }
     197 [ +  - ][ +  - ]:          3 :         else if (xServiceInfo->supportsService("com.sun.star.text.TextField.GetExpression"))
                 [ +  - ]
     198                 :            :         {
     199                 :            :             // Second step: check the value of foo.
     200                 :          3 :             bFoundGet = true;
     201 [ +  - ][ +  - ]:          3 :             xPropertySet->getPropertyValue("Content") >>= aValue;
     202 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     203 [ +  - ][ +  - ]:          3 :             xPropertySet->getPropertyValue("SubType") >>= nValue;
     204 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     205 [ +  - ][ +  - ]:          3 :             xPropertySet->getPropertyValue("CurrentPresentation") >>= aValue;
     206 [ +  - ][ +  - ]:          3 :             CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     207                 :            :         }
     208                 :          6 :     }
     209 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(bFoundSet);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     210 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(bFoundGet);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     211                 :          3 : }
     212                 :            : 
     213                 :          3 : void Test::testN750935()
     214                 :            : {
     215         [ +  - ]:          3 :     load("n750935.docx");
     216         [ +  - ]:          3 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     217 [ +  - ][ +  - ]:          3 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
                 [ +  - ]
     218 [ +  - ][ +  - ]:          3 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
                 [ +  - ]
     219 [ +  - ][ +  - ]:          3 :     xCursor->jumpToLastPage();
     220                 :            :     // Some page break types were ignores, resulting in less pages.
     221 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     222                 :            : 
     223                 :            :     /*
     224                 :            :      * The problem was that the header and footer was not shared.
     225                 :            :      *
     226                 :            :      * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
     227                 :            :      */
     228 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     229                 :          3 :     sal_Bool bValue = false;
     230 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
     231 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     232 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
     233 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     234                 :          3 : }
     235                 :            : 
     236                 :          3 : void Test::testN757890()
     237                 :            : {
     238         [ +  - ]:          3 :     load("n757890.docx");
     239                 :            : 
     240                 :            :     // The w:pStyle token affected the text outside the textbox.
     241         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     242 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     243 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     244 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     245                 :          3 :     OUString aValue;
     246 [ +  - ][ +  - ]:          3 :     xPara->getPropertyValue("ParaStyleName") >>= aValue;
     247 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     248                 :            : 
     249                 :            :     // This wan't centered
     250         [ +  - ]:          3 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     251 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
                 [ +  - ]
     252 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     253                 :            :     sal_Int16 nValue;
     254 [ +  - ][ +  - ]:          3 :     xFrame->getPropertyValue("HoriOrient") >>= nValue;
     255 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     256                 :          3 : }
     257                 :            : 
     258                 :          3 : void Test::testFdo49940()
     259                 :            : {
     260         [ +  - ]:          3 :     load("fdo49940.docx");
     261                 :            : 
     262         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     263 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     264 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     265 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     266                 :          3 :     OUString aValue;
     267 [ +  - ][ +  - ]:          3 :     xPara->getPropertyValue("PageStyleName") >>= aValue;
     268 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     269                 :          3 : }
     270                 :            : 
     271                 :          3 : void Test::testN751077()
     272                 :            : {
     273         [ +  - ]:          3 :     load( "n751077.docx" );
     274                 :            : 
     275                 :            : /*
     276                 :            : enum = ThisComponent.Text.createEnumeration
     277                 :            : enum.NextElement
     278                 :            : para = enum.NextElement
     279                 :            : xray para.String
     280                 :            : xray para.PageStyleName
     281                 :            : */
     282         [ +  - ]:          3 :     uno::Reference<uno::XInterface> paragraph(getParagraph( 2, "TEXT1" ));
     283                 :            :     // we want to test the paragraph is on the first page (it was put onto another page without the fix),
     284                 :            :     // use a small trick and instead of checking the page layout, check the page style
     285         [ +  - ]:          3 :     OUString pageStyle = getProperty< OUString >( paragraph, "PageStyleName" );
     286 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "First Page" ), pageStyle );
         [ +  - ][ +  - ]
                 [ +  - ]
     287                 :          3 : }
     288                 :            : 
     289                 :          3 : void Test::testN705956_1()
     290                 :            : {
     291         [ +  - ]:          3 :     load( "n705956-1.docx" );
     292                 :            : /*
     293                 :            : Get the first image in the document and check it's the one image in the document.
     294                 :            : It should be also anchored inline (as character).
     295                 :            : image = ThisComponent.DrawPage.getByIndex(0)
     296                 :            : graphic = image.Graphic
     297                 :            : xray graphic.Size
     298                 :            : xray image.AnchorType
     299                 :            : */
     300         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     301         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     302 [ +  - ][ +  - ]:          3 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     303 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), drawPage->getCount());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     304                 :          3 :     uno::Reference<drawing::XShape> image;
     305 [ +  - ][ +  - ]:          3 :     drawPage->getByIndex(0) >>= image;
                 [ +  - ]
     306         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     307                 :          3 :     uno::Reference<graphic::XGraphic> graphic;
     308 [ +  - ][ +  - ]:          3 :     imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
                 [ +  - ]
     309         [ +  - ]:          3 :     uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
     310 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(120), bitmap->getSize().Width );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     311 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(106), bitmap->getSize().Height );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     312                 :            :     text::TextContentAnchorType anchorType;
     313 [ +  - ][ +  - ]:          3 :     imageProperties->getPropertyValue( "AnchorType" ) >>= anchorType;
                 [ +  - ]
     314 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( text::TextContentAnchorType_AS_CHARACTER, anchorType );
         [ +  - ][ +  - ]
                 [ +  - ]
     315                 :          3 : }
     316                 :            : 
     317                 :          3 : void Test::testN705956_2()
     318                 :            : {
     319         [ +  - ]:          3 :     load( "n705956-2.docx" );
     320                 :            : /*
     321                 :            : <v:shapetype> must be global, reachable even from <v:shape> inside another <w:pict>
     322                 :            : image = ThisComponent.DrawPage.getByIndex(0)
     323                 :            : xray image.FillColor
     324                 :            : */
     325         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     326         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     327 [ +  - ][ +  - ]:          3 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     328                 :          3 :     uno::Reference<drawing::XShape> image;
     329 [ +  - ][ +  - ]:          3 :     drawPage->getByIndex(0) >>= image;
                 [ +  - ]
     330         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     331                 :            :     sal_Int32 fillColor;
     332 [ +  - ][ +  - ]:          3 :     imageProperties->getPropertyValue( "FillColor" ) >>= fillColor;
     333 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0xc0504d ), fillColor );
         [ +  - ][ +  - ]
                 [ +  - ]
     334                 :          3 : }
     335                 :            : 
     336                 :          3 : void Test::testN747461()
     337                 :            : {
     338         [ +  - ]:          3 :     load( "n747461.docx" );
     339                 :            : /*
     340                 :            : The document contains 3 images (Red, Black, Green, in this order), with explicit
     341                 :            : w:relativeHeight (300, 0, 225763766). Check that they are in the right ZOrder
     342                 :            : after they are loaded.
     343                 :            : */
     344         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
     345         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
     346 [ +  - ][ +  - ]:          3 :     uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
     347                 :          3 :     uno::Reference<drawing::XShape> image1, image2, image3;
     348 [ +  - ][ +  - ]:          3 :     drawPage->getByIndex( 0 ) >>= image1;
                 [ +  - ]
     349 [ +  - ][ +  - ]:          3 :     drawPage->getByIndex( 1 ) >>= image2;
                 [ +  - ]
     350 [ +  - ][ +  - ]:          3 :     drawPage->getByIndex( 2 ) >>= image3;
                 [ +  - ]
     351                 :            :     sal_Int32 zOrder1, zOrder2, zOrder3;
     352                 :          3 :     OUString descr1, descr2, descr3;
     353         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> imageProperties1(image1, uno::UNO_QUERY);
     354 [ +  - ][ +  - ]:          3 :     imageProperties1->getPropertyValue( "ZOrder" ) >>= zOrder1;
     355 [ +  - ][ +  - ]:          3 :     imageProperties1->getPropertyValue( "Description" ) >>= descr1;
     356         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> imageProperties2(image2, uno::UNO_QUERY);
     357 [ +  - ][ +  - ]:          3 :     imageProperties2->getPropertyValue( "ZOrder" ) >>= zOrder2;
     358 [ +  - ][ +  - ]:          3 :     imageProperties2->getPropertyValue( "Description" ) >>= descr2;
     359         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> imageProperties3(image3, uno::UNO_QUERY);
     360 [ +  - ][ +  - ]:          3 :     imageProperties3->getPropertyValue( "ZOrder" ) >>= zOrder3;
     361 [ +  - ][ +  - ]:          3 :     imageProperties3->getPropertyValue( "Description" ) >>= descr3;
     362 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), zOrder1 );
         [ +  - ][ +  - ]
                 [ +  - ]
     363 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), zOrder2 );
         [ +  - ][ +  - ]
                 [ +  - ]
     364 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2 ), zOrder3 );
         [ +  - ][ +  - ]
                 [ +  - ]
     365 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Black" ), descr1 );
         [ +  - ][ +  - ]
                 [ +  - ]
     366 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2 );
         [ +  - ][ +  - ]
                 [ +  - ]
     367 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 );
         [ +  - ][ +  - ]
                 [ +  - ]
     368                 :          3 : }
     369                 :            : 
     370                 :          3 : void Test::testN750255()
     371                 :            : {
     372         [ +  - ]:          3 :     load( "n750255.docx" );
     373                 :            : 
     374                 :            : /*
     375                 :            : Column break without columns on the page is a page break, so check those paragraphs
     376                 :            : are on page 2 (page style 'Converted1') and page 3 (page style 'Converted2')
     377                 :            : enum = ThisComponent.Text.createEnumeration
     378                 :            : enum.nextElement
     379                 :            : para1 = enum.nextElement
     380                 :            : xray para1.String
     381                 :            : xray para1.PageStyleName
     382                 :            : para2 = enum.nextElement
     383                 :            : xray para2.String
     384                 :            : xray para2.PageStyleName
     385                 :            : */
     386                 :            :     // get the 2nd and 3rd paragraph
     387         [ +  - ]:          3 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "one" ));
     388         [ +  - ]:          3 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 3, "two" ));
     389         [ +  - ]:          3 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     390         [ +  - ]:          3 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     391 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted1" ), pageStyle1 );
         [ +  - ][ +  - ]
                 [ +  - ]
     392 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Converted2" ), pageStyle2 );
         [ +  - ][ +  - ]
                 [ +  - ]
     393                 :            : 
     394                 :          3 : }
     395                 :            : 
     396                 :          3 : void Test::testN652364()
     397                 :            : {
     398         [ +  - ]:          3 :     load( "n652364.docx" );
     399                 :            : 
     400                 :            : /*
     401                 :            : Related to 750255 above, column break with columns on the page however should be a column break.
     402                 :            : enum = ThisComponent.Text.createEnumeration
     403                 :            : enum.nextElement
     404                 :            : para1 = enum.nextElement
     405                 :            : xray para1.String
     406                 :            : xray para1.PageStyleName
     407                 :            : enum.nextElement
     408                 :            : para2 = enum.nextElement
     409                 :            : xray para2.String
     410                 :            : xray para2.PageStyleName
     411                 :            : */
     412                 :            :     // get the 2nd and 4th paragraph
     413         [ +  - ]:          3 :     uno::Reference<uno::XInterface> paragraph1(getParagraph( 2, "text1" ));
     414         [ +  - ]:          3 :     uno::Reference<uno::XInterface> paragraph2(getParagraph( 4, "text2" ));
     415         [ +  - ]:          3 :     OUString pageStyle1 = getProperty< OUString >( paragraph1, "PageStyleName" );
     416         [ +  - ]:          3 :     OUString pageStyle2 = getProperty< OUString >( paragraph2, "PageStyleName" );
     417                 :            :     // "Standard" is the style for the first page (2nd is "Converted1").
     418 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 );
         [ +  - ][ +  - ]
                 [ +  - ]
     419 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 );
         [ +  - ][ +  - ]
                 [ +  - ]
     420                 :          3 : }
     421                 :            : 
     422                 :          3 : void Test::testN760764()
     423                 :            : {
     424         [ +  - ]:          3 :     load("n760764.docx");
     425                 :            : 
     426         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     427 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     428 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     429 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     430 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     431                 :            : 
     432                 :            :     // Access the second run, which is a textfield
     433 [ +  - ][ +  - ]:          3 :     xRunEnum->nextElement();
     434 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     435                 :            :     float fValue;
     436 [ +  - ][ +  - ]:          3 :     xRun->getPropertyValue("CharHeight") >>= fValue;
     437                 :            :     // This used to be 11, as character properties were ignored.
     438 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(8.f, fValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     439                 :          3 : }
     440                 :            : 
     441                 :          3 : void Test::testN764005()
     442                 :            : {
     443         [ +  - ]:          3 :     load("n764005.docx");
     444                 :            : 
     445         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     446 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     447 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     448                 :            : 
     449                 :            :     // The picture in the header wasn't absolutely positioned and wasn't in the background.
     450                 :            :     text::TextContentAnchorType eValue;
     451 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorType") >>= eValue;
                 [ +  - ]
     452 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     453                 :          3 :     sal_Bool bValue = sal_True;
     454 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("Opaque") >>= bValue;
     455 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_False, bValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     456                 :          3 : }
     457                 :            : 
     458                 :          3 : void Test::testSmartart()
     459                 :            : {
     460         [ +  - ]:          3 :     load("smartart.docx");
     461                 :            : 
     462         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     463 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     464 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     465                 :            : 
     466 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xGroup(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     467 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     468                 :            : 
     469 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
                 [ +  - ]
     470                 :          3 :     sal_Int32 nValue(0);
     471 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("FillColor") >>= nValue;
     472 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
         [ +  - ][ +  - ]
                 [ +  - ]
     473                 :            : 
     474 [ +  - ][ +  - ]:          3 :     uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
                 [ +  - ]
     475 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     476                 :            : 
     477 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
                 [ +  - ]
     478 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     479 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     480 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("ParaAdjust") >>= nValue;
     481 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
         [ +  - ][ +  - ]
                 [ +  - ]
     482                 :          3 : }
     483                 :            : 
     484                 :          3 : void Test::testN764745()
     485                 :            : {
     486         [ +  - ]:          3 :     load( "n764745-alignment.docx" );
     487                 :            : /*
     488                 :            : shape = ThisComponent.DrawPage.getByIndex(0)
     489                 :            : xray shape.AnchorType
     490                 :            : xray shape.AnchorPosition.X
     491                 :            : xray ThisComponent.StyleFamilies.PageStyles.Default.Width
     492                 :            : */
     493         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     494 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     495 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     496                 :            :     // The paragraph is right-aligned and the picture does not explicitly specify position,
     497                 :            :     // so check it's anchored as character and in the right side of the document.
     498                 :            :     text::TextContentAnchorType anchorType;
     499 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorType") >>= anchorType;
                 [ +  - ]
     500 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, anchorType);
         [ +  - ][ +  - ]
                 [ +  - ]
     501                 :          3 :     awt::Point pos;
     502 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorPosition") >>= pos;
                 [ +  - ]
     503         [ +  - ]:          3 :     uno::Reference<style::XStyleFamiliesSupplier> styleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
     504 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XNameAccess> styleFamilies = styleFamiliesSupplier->getStyleFamilies();
     505                 :          3 :     uno::Reference<container::XNameAccess> pageStyles;
     506 [ +  - ][ +  - ]:          3 :     styleFamilies->getByName("PageStyles") >>= pageStyles;
                 [ +  - ]
     507                 :          3 :     uno::Reference<uno::XInterface> defaultStyle;
     508 [ +  - ][ +  - ]:          3 :     pageStyles->getByName("Default") >>= defaultStyle;
                 [ +  - ]
     509         [ +  - ]:          3 :     uno::Reference<beans::XPropertySet> styleProperties( defaultStyle, uno::UNO_QUERY );
     510                 :          3 :     sal_Int32 width = 0;
     511 [ +  - ][ +  - ]:          3 :     styleProperties->getPropertyValue( "Width" ) >>= width;
     512 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT( pos.X > width / 2 );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     513                 :          3 : }
     514                 :            : 
     515                 :          3 : void Test::testN766477()
     516                 :            : {
     517                 :            :     /*
     518                 :            :      * The problem was that the checkbox was not checked.
     519                 :            :      *
     520                 :            :      * oParas = ThisComponent.Text.createEnumeration
     521                 :            :      * oPara = oParas.nextElement
     522                 :            :      * oRuns = oPara.createEnumeration
     523                 :            :      * oRun = oRuns.nextElement
     524                 :            :      * xray oRun.Bookmark.Parameters.ElementNames(0) 'Checkbox_Checked
     525                 :            :      */
     526         [ +  - ]:          3 :     load("n766477.docx");
     527         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     528 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     529 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     530 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     531 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     532 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     533 [ +  - ][ +  - ]:          3 :     uno::Reference<text::XFormField> xFormField(xRun->getPropertyValue("Bookmark"), uno::UNO_QUERY);
                 [ +  - ]
     534 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
     535 [ +  - ][ +  - ]:          3 :     uno::Sequence<OUString> aElementNames(xParameters->getElementNames());
     536 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     537                 :          3 : }
     538                 :            : 
     539                 :          3 : void Test::testN758883()
     540                 :            : {
     541         [ +  - ]:          3 :     load("n758883.docx");
     542                 :            : 
     543                 :            :     /*
     544                 :            :      * The problem was that direct formatting of the paragraph was not applied
     545                 :            :      * to the numbering. This is easier to test using a layout dump.
     546                 :            :      */
     547         [ +  - ]:          3 :     OUString aHeight = parseDump("/root/page/body/txt/Special", "nHeight");
     548 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(220), aHeight.toInt32()); // It was 280
         [ +  - ][ +  - ]
                 [ +  - ]
     549                 :            : 
     550                 :            :     /*
     551                 :            :      * Next problem was that the page margin contained the width of the page border as well.
     552                 :            :      *
     553                 :            :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin
     554                 :            :      */
     555 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     556                 :          3 :     sal_Int32 nValue = 0;
     557 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     558 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(794), nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     559                 :            : 
     560                 :            :     // No assert for the 3rd problem: see the comment in the test doc.
     561                 :            : 
     562                 :            :     /*
     563                 :            :      * 4th problem: Wrap type of the textwrape was not 'through'.
     564                 :            :      *
     565                 :            :      * xray ThisComponent.DrawPage(0).Surround ' was 2, should be 1
     566                 :            :      */
     567         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     568 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     569 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xDraws->getByIndex(0), uno::UNO_QUERY);
                 [ +  - ]
     570                 :            :     text::WrapTextMode eValue;
     571 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("Surround") >>= eValue;
                 [ +  - ]
     572 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_THROUGHT);
         [ +  - ][ +  - ]
                 [ +  - ]
     573                 :            : 
     574                 :            :     /*
     575                 :            :      * 5th problem: anchor type of the second textbox was wrong.
     576                 :            :      *
     577                 :            :      * xray ThisComponent.DrawPage(1).AnchorType ' was 1, should be 4
     578                 :            :      */
     579 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xDraws->getByIndex(1), uno::UNO_QUERY);
                 [ +  - ]
     580                 :            :     text::TextContentAnchorType eAnchorType;
     581 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
                 [ +  - ]
     582 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
         [ +  - ][ +  - ]
                 [ +  - ]
     583                 :            : 
     584                 :            :     // 6th problem: xray ThisComponent.DrawPage(2).AnchorType ' was 2, should be 4
     585 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xDraws->getByIndex(2), uno::UNO_QUERY);
                 [ +  - ]
     586 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType;
                 [ +  - ]
     587 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
         [ +  - ][ +  - ]
                 [ +  - ]
     588                 :          3 : }
     589                 :            : 
     590                 :          3 : void Test::testN766481()
     591                 :            : {
     592                 :            :     /*
     593                 :            :      * The problem was that we had an additional paragraph before the pagebreak.
     594                 :            :      *
     595                 :            :      * oParas = ThisComponent.Text.createEnumeration
     596                 :            :      * oPara = oParas.nextElement
     597                 :            :      * oPara = oParas.nextElement
     598                 :            :      * xray oParas.hasMoreElements ' should be false
     599                 :            :      */
     600         [ +  - ]:          3 :     load("n766481.docx");
     601         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     602 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     603 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     604         [ +  + ]:          9 :     for (int i = 0; i < 2; ++i)
     605 [ +  - ][ +  - ]:          6 :         xParaEnum->nextElement();
     606 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     607                 :          3 : }
     608                 :            : 
     609                 :          3 : void Test::testN766487()
     610                 :            : {
     611                 :            :     /*
     612                 :            :      * The problem was that 1) the font size of the first para was too large 2) numbering had no first-line-indent.
     613                 :            :      *
     614                 :            :      * oParas = ThisComponent.Text.createEnumeration
     615                 :            :      * oPara = oParas.nextElement
     616                 :            :      * oRuns = oPara.createEnumeration
     617                 :            :      * oRun = oRuns.nextElement
     618                 :            :      * xray oRun.CharHeight ' 12, was larger
     619                 :            :      * oPara = oParas.nextElement
     620                 :            :      * xray oPara.ParaFirstLineIndent ' -635, was 0
     621                 :            :      */
     622         [ +  - ]:          3 :     load("n766487.docx");
     623         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     624 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     625 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
     626                 :            : 
     627 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     628 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
     629 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     630                 :          3 :     float fValue = 0;
     631 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("CharHeight") >>= fValue;
     632 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(12.f, fValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     633                 :            : 
     634 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     635                 :          3 :     sal_Int32 nValue = 0;
     636 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue;
     637 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-360)), nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     638                 :          3 : }
     639                 :            : 
     640                 :          3 : void Test::testN693238()
     641                 :            : {
     642                 :            :     /*
     643                 :            :      * The problem was that a continous section break at the end of the doc caused the margins to be ignored.
     644                 :            :      *
     645                 :            :      * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin ' was 2000, should be 635
     646                 :            :      */
     647         [ +  - ]:          3 :     load("n693238.docx");
     648 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     649                 :          3 :     sal_Int32 nValue = 0;
     650 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
     651 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     652                 :          3 : }
     653                 :            : 
     654                 :          3 : void Test::testNumbering1()
     655                 :            : {
     656         [ +  - ]:          3 :     load( "numbering1.docx" );
     657                 :            : /* <w:numPr> in the paragraph itself was overriden by <w:numpr> introduced by the paragraph's <w:pStyle>
     658                 :            : enum = ThisComponent.Text.createEnumeration
     659                 :            : para = enum.NextElement
     660                 :            : xray para.NumberingStyleName
     661                 :            : numberingstyle = ThisComponent.NumberingRules.getByIndex(6)
     662                 :            : xray numberingstyle.name   - should match name above
     663                 :            : numbering = numberingstyle.getByIndex(0)
     664                 :            : xray numbering(11)  - should be 4, arabic
     665                 :            : note that the indexes may get off as the implementation evolves, C++ code seaches in loops
     666                 :            : */
     667         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     668         [ +  - ]:          3 :     uno::Reference< text::XTextRange > paragraph(getParagraph( 1, "Text1." ));
     669         [ +  - ]:          3 :     OUString numberingStyleName = getProperty< OUString >( paragraph, "NumberingStyleName" );
     670         [ +  - ]:          3 :     uno::Reference<text::XNumberingRulesSupplier> xNumberingRulesSupplier(mxComponent, uno::UNO_QUERY);
     671 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> numberingRules(xNumberingRulesSupplier->getNumberingRules(), uno::UNO_QUERY);
                 [ +  - ]
     672                 :          3 :     uno::Reference<container::XIndexAccess> numberingRule;
     673         [ +  - ]:         45 :     for( int i = 0;
     674 [ +  - ][ +  - ]:         21 :          i < numberingRules->getCount();
     675                 :            :          ++i )
     676                 :            :     {
     677 [ +  - ][ +  - ]:         21 :         OUString name = getProperty< OUString >( numberingRules->getByIndex( i ), "Name" );
                 [ +  - ]
     678         [ +  + ]:         21 :         if( name == numberingStyleName )
     679                 :            :         {
     680 [ +  - ][ +  - ]:         21 :             numberingRule.set( numberingRules->getByIndex( i ), uno::UNO_QUERY );
                 [ +  - ]
     681                 :            :             break;
     682                 :            :         }
     683         [ +  + ]:         21 :     }
     684 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT( numberingRule.is());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     685         [ +  - ]:          3 :     uno::Sequence< beans::PropertyValue > numbering;
     686 [ +  - ][ +  - ]:          3 :     numberingRule->getByIndex( 0 ) >>= numbering;
                 [ +  - ]
     687                 :          3 :     sal_Int16 numberingType = style::NumberingType::NUMBER_NONE;
     688         [ +  - ]:         72 :     for( int i = 0;
     689                 :         36 :          i < numbering.getLength();
     690                 :            :          ++i )
     691                 :            :         {
     692 [ +  - ][ +  + ]:         36 :         if( numbering[ i ].Name == "NumberingType" )
     693                 :            :             {
     694         [ +  - ]:          3 :             numbering[ i ].Value >>= numberingType;
     695                 :          3 :             break;
     696                 :            :             }
     697                 :            :         }
     698 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( style::NumberingType::ARABIC, numberingType );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     699                 :          3 : }
     700                 :            : 
     701                 :          3 : void Test::testBnc773061()
     702                 :            : {
     703         [ +  - ]:          3 :     load( "bnc773061.docx" );
     704         [ +  - ]:          3 :     uno::Reference< text::XTextRange > paragraph = getParagraph( 1 );
     705         [ +  - ]:          3 :     uno::Reference< text::XTextRange > normal = getRun( paragraph, 1, "Normal " );
     706         [ +  - ]:          3 :     uno::Reference< text::XTextRange > raised = getRun( paragraph, 2, "Raised" );
     707         [ +  - ]:          3 :     uno::Reference< text::XTextRange > lowered = getRun( paragraph, 4, "Lowered" );
     708 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( normal, "CharEscapement" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     709 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 50 ), getProperty< sal_Int32 >( raised, "CharEscapement" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     710 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( -25 ), getProperty< sal_Int32 >( lowered, "CharEscapement" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     711 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( normal, "CharEscapementHeight" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     712 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( raised, "CharEscapementHeight" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     713 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( lowered, "CharEscapementHeight" ));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     714                 :          3 : }
     715                 :            : 
     716                 :          3 : void Test::testAllGapsWord()
     717                 :            : {
     718         [ +  - ]:          3 :     load("all_gaps_word.docx");
     719                 :          3 :     BorderTest borderTest;
     720         [ +  - ]:          3 :     borderTest.testTheBorders(mxComponent);
     721                 :          3 : }
     722                 :            : 
     723                 :          3 : void Test::testN775906()
     724                 :            : {
     725                 :            :     /*
     726                 :            :      * The problem was that right margin (via direct formatting) erased the left/first margin (inherited from numbering style).
     727                 :            :      *
     728                 :            :      * oParas = ThisComponent.Text.createEnumeration
     729                 :            :      * oPara = oParas.nextElement
     730                 :            :      * xray oPara.ParaFirstLineIndent ' was 0
     731                 :            :      * xray oPara.ParaLeftMargin ' was 0
     732                 :            :      */
     733         [ +  - ]:          3 :     load("n775906.docx");
     734                 :            : 
     735 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-635), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     736 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     737                 :          3 : }
     738                 :            : 
     739                 :          3 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     740                 :            : 
     741 [ +  - ][ +  - ]:         12 : CPPUNIT_PLUGIN_IMPLEMENT();
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     742                 :            : 
     743                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10