LCOV - code coverage report
Current view: top level - sw/qa/extras/rtfexport - rtfexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 264 264 100.0 %
Date: 2012-08-25 Functions: 36 37 97.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 672 1338 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                 :            : 
      30                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      31                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      32                 :            : #include <com/sun/star/frame/XStorable.hpp>
      33                 :            : #include <com/sun/star/text/XPageCursor.hpp>
      34                 :            : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      35                 :            : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
      36                 :            : 
      37                 :            : #include <unotools/tempfile.hxx>
      38                 :            : #include <vcl/svapp.hxx>
      39                 :            : 
      40                 :            : using rtl::OString;
      41                 :            : using rtl::OUString;
      42                 :            : using rtl::OUStringBuffer;
      43                 :            : 
      44         [ -  + ]:        234 : class Test : public SwModelTestBase
      45                 :            : {
      46                 :            : public:
      47                 :            :     void testZoom();
      48                 :            :     void testFdo38176();
      49                 :            :     void testFdo49683();
      50                 :            :     void testFdo44174();
      51                 :            :     void testFdo50087();
      52                 :            :     void testFdo50831();
      53                 :            :     void testFdo48335();
      54                 :            :     void testFdo38244();
      55                 :            :     void testMathAccents();
      56                 :            :     void testMathEqarray();
      57                 :            :     void testMathD();
      58                 :            :     void testMathEscaping();
      59                 :            :     void testMathLim();
      60                 :            :     void testMathMatrix();
      61                 :            :     void testMathBox();
      62                 :            :     void testMathMso2007();
      63                 :            :     void testMathNary();
      64                 :            :     void testMathLimupp();
      65                 :            :     void testMathStrikeh();
      66                 :            :     void testMathPlaceholders();
      67                 :            :     void testMathRad();
      68                 :            :     void testMathSepchr();
      69                 :            :     void testMathSubscripts();
      70                 :            :     void testMathVerticalstacks();
      71                 :            :     void testMathRuns();
      72                 :            :     void testFdo53113();
      73                 :            : 
      74 [ +  - ][ +  - ]:          6 :     CPPUNIT_TEST_SUITE(Test);
         [ +  - ][ +  - ]
                 [ #  # ]
      75                 :            : #if !defined(MACOSX) && !defined(WNT)
      76 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testZoom);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      77 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo38176);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      78 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo49683);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      79 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo44174);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      80 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo50087);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      81 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo50831);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      82 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo48335);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      83 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo38244);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      84 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathAccents);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      85 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathEqarray);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      86 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathD);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      87 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathEscaping);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      88 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathLim);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      89 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathMatrix);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      90 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathBox);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      91 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathMso2007);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      92 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathNary);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      93 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathLimupp);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      94 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathStrikeh);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      95 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathPlaceholders);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      96 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathRad);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      97 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathSepchr);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      98 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathSubscripts);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      99 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathVerticalstacks);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     100 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testMathRuns);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     101 [ +  - ][ +  - ]:          3 :     CPPUNIT_TEST(testFdo53113);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     102                 :            : #endif
     103 [ +  - ][ +  - ]:          6 :     CPPUNIT_TEST_SUITE_END();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     104                 :            : 
     105                 :            : private:
     106                 :            :     void roundtrip(const OUString& rURL);
     107                 :            : };
     108                 :            : 
     109                 :         78 : void Test::roundtrip(const OUString& rFilename)
     110                 :            : {
     111 [ +  - ][ +  - ]:         78 :     uno::Reference<lang::XComponent> xImported = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtfexport/data/") + rFilename);
     112         [ +  - ]:         78 :     uno::Reference<frame::XStorable> xStorable(xImported, uno::UNO_QUERY);
     113         [ +  - ]:         78 :     uno::Sequence<beans::PropertyValue> aArgs(1);
     114         [ +  - ]:         78 :     aArgs[0].Name = "FilterName";
     115 [ +  - ][ +  - ]:         78 :     aArgs[0].Value <<= OUString("Rich Text Format");
     116         [ +  - ]:         78 :     utl::TempFile aTempFile;
     117                 :         78 :     aTempFile.EnableKillingFile();
     118 [ +  - ][ +  - ]:         78 :     xStorable->storeToURL(aTempFile.GetURL(), aArgs);
         [ +  - ][ +  - ]
                 [ +  - ]
     119 [ +  - ][ +  - ]:         78 :     mxComponent = loadFromDesktop(aTempFile.GetURL());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     120                 :         78 : }
     121                 :            : 
     122                 :          3 : void Test::testZoom()
     123                 :            : {
     124         [ +  - ]:          3 :     roundtrip("zoom.rtf");
     125                 :            : 
     126         [ +  - ]:          3 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     127 [ +  - ][ +  - ]:          3 :     uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
                 [ +  - ]
     128 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
     129                 :          3 :     sal_Int16 nValue = 0;
     130 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
     131 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     132                 :          3 : }
     133                 :            : 
     134                 :          3 : void Test::testFdo38176()
     135                 :            : {
     136         [ +  - ]:          3 :     roundtrip("fdo38176.rtf");
     137 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(9, getLength());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     138                 :          3 : }
     139                 :            : 
     140                 :          3 : void Test::testFdo49683()
     141                 :            : {
     142         [ +  - ]:          3 :     roundtrip("fdo49683.rtf");
     143                 :            : 
     144         [ +  - ]:          3 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     145 [ +  - ][ +  - ]:          3 :     uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
     146 [ +  - ][ +  - ]:          3 :     uno::Sequence<OUString> aKeywords(xDocumentProperties->getKeywords());
     147 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aKeywords.getLength());
         [ +  - ][ +  - ]
                 [ +  - ]
     148 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("one"), aKeywords[0]);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     149 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("two"), aKeywords[1]);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     150                 :          3 : }
     151                 :            : 
     152                 :          3 : void Test::testFdo44174()
     153                 :            : {
     154         [ +  - ]:          3 :     roundtrip("fdo44174.rtf");
     155                 :            : 
     156         [ +  - ]:          3 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     157 [ +  - ][ +  - ]:          3 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
                 [ +  - ]
     158 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
                 [ +  - ]
     159                 :          3 :     OUString aValue;
     160 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("PageStyleName") >>= aValue;
     161 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     162                 :          3 : }
     163                 :            : 
     164                 :          3 : void Test::testFdo50087()
     165                 :            : {
     166         [ +  - ]:          3 :     roundtrip("fdo50087.rtf");
     167                 :            : 
     168         [ +  - ]:          3 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     169 [ +  - ][ +  - ]:          3 :     uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
     170 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("Title"), xDocumentProperties->getTitle());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     171 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("Subject"), xDocumentProperties->getSubject());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     172 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), xDocumentProperties->getDescription());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     173                 :          3 : }
     174                 :            : 
     175                 :          3 : void Test::testFdo50831()
     176                 :            : {
     177         [ +  - ]:          3 :     roundtrip("fdo50831.rtf");
     178                 :            : 
     179         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     180 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     181 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     182 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     183                 :          3 :     float fValue = 0;
     184 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("CharHeight") >>= fValue;
     185 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(10.f, fValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     186                 :          3 : }
     187                 :            : 
     188                 :          3 : void Test::testFdo48335()
     189                 :            : {
     190                 :            :     /*
     191                 :            :      * The problem was that we exported a fake pagebreak, make sure it's just a soft one now.
     192                 :            :      *
     193                 :            :      * oParas = ThisComponent.Text.createEnumeration
     194                 :            :      * oPara = oParas.nextElement
     195                 :            :      * oPara = oParas.nextElement
     196                 :            :      * oPara = oParas.nextElement
     197                 :            :      * oRuns = oPara.createEnumeration
     198                 :            :      * oRun = oRuns.nextElement
     199                 :            :      * xray oRun.TextPortionType 'was Text, should be SoftPageBreak
     200                 :            :      */
     201         [ +  - ]:          3 :     roundtrip("fdo48335.odt");
     202                 :            : 
     203         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     204 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     205 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     206         [ +  + ]:          9 :     for (int i = 0; i < 2; i++)
     207 [ +  - ][ +  - ]:          6 :         xParaEnum->nextElement();
     208 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     209 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     210 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     211                 :          3 :     OUString aValue;
     212 [ +  - ][ +  - ]:          3 :     xPropertySet->getPropertyValue("TextPortionType") >>= aValue;
     213 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("SoftPageBreak"), aValue);
         [ +  - ][ +  - ]
                 [ +  - ]
     214                 :          3 : }
     215                 :            : 
     216                 :          3 : void Test::testFdo38244()
     217                 :            : {
     218                 :            :     // See ooxmlexport's testFdo38244().
     219         [ +  - ]:          3 :     roundtrip("fdo38244.rtf");
     220                 :            : 
     221                 :            :     // Test comment range feature.
     222         [ +  - ]:          3 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     223 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
                 [ +  - ]
     224 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     225 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     226 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     227 [ +  - ][ +  - ]:          3 :     xRunEnum->nextElement();
     228 [ +  - ][ +  - ]:          3 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     229 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     230 [ +  - ][ +  - ]:          3 :     xRunEnum->nextElement();
     231 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     232 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     233                 :            : 
     234                 :            :     // Test initials.
     235         [ +  - ]:          3 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     236 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     237 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     238 [ +  - ][ +  - ]:          3 :     xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
     239 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     240                 :          3 : }
     241                 :            : 
     242                 :          3 : void Test::testMathAccents()
     243                 :            : {
     244         [ +  - ]:          3 :     roundtrip("math-accents.rtf");
     245 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     246                 :          3 :     OUString aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde {a} underline {a}");
     247 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     248                 :          3 : }
     249                 :            : 
     250                 :          3 : void Test::testMathEqarray()
     251                 :            : {
     252         [ +  - ]:          3 :     roundtrip("math-eqarray.rtf");
     253 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     254                 :          3 :     OUString aExpected("y = left lbrace stack { 0, x < 0 # 1, x = 0 # {x} ^ {2} , x > 0 } right none");
     255 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     256                 :          3 : }
     257                 :            : 
     258                 :          3 : void Test::testMathD()
     259                 :            : {
     260         [ +  - ]:          3 :     roundtrip("math-d.rtf");
     261 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     262                 :          3 :     OUString aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 right rdline left langle 6 right rangle left langle a mline b right rangle left ({x} over {y} right )");
     263 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     264                 :          3 : }
     265                 :            : 
     266                 :          3 : void Test::testMathEscaping()
     267                 :            : {
     268         [ +  - ]:          3 :     roundtrip("math-escaping.rtf");
     269 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     270         [ +  - ]:          3 :     OUString aExpected("á \\{", 5, RTL_TEXTENCODING_UTF8);
     271 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     272                 :          3 : }
     273                 :            : 
     274                 :          3 : void Test::testMathLim()
     275                 :            : {
     276         [ +  - ]:          3 :     roundtrip("math-lim.rtf");
     277 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     278         [ +  - ]:          3 :     OUString aExpected("lim from {x → 1} {x}", 22, RTL_TEXTENCODING_UTF8);
     279 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     280                 :          3 : }
     281                 :            : 
     282                 :          3 : void Test::testMathMatrix()
     283                 :            : {
     284         [ +  - ]:          3 :     roundtrip("math-matrix.rtf");
     285 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     286                 :          3 :     OUString aExpected("left [matrix {1 # 2 ## 3 # 4} right ]");
     287 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     288                 :          3 : }
     289                 :            : 
     290                 :          3 : void Test::testMathBox()
     291                 :            : {
     292         [ +  - ]:          3 :     roundtrip("math-mbox.rtf");
     293 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     294                 :          3 :     OUString aExpected("a");
     295 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     296                 :          3 : }
     297                 :            : 
     298                 :          3 : void Test::testMathMso2007()
     299                 :            : {
     300         [ +  - ]:          3 :     roundtrip("math-mso2007.rtf");
     301 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     302         [ +  - ]:          3 :     OUString aExpected("A = π {r} ^ {2}", 16, RTL_TEXTENCODING_UTF8);
     303 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     304                 :            : 
     305 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(2), 1));
                 [ +  - ]
     306         [ +  - ]:          3 :     aExpected = OUString("{left (x + a right )} ^ {n} = sum from {k = 0} to {n} {left (stack { n # k } right ) {x} ^ {k} {a} ^ {n − k}}", 111, RTL_TEXTENCODING_UTF8);
     307 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     308                 :            : 
     309 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(3), 1));
                 [ +  - ]
     310         [ +  - ]:          3 :     aExpected = OUString("{left (1 + x right )} ^ {n} = 1 + {nx} over {1 !} + {n left (n − 1 right ) {x} ^ {2}} over {2 !} + …", 104, RTL_TEXTENCODING_UTF8);
     311 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     312                 :            : 
     313 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(4), 1));
                 [ +  - ]
     314                 :            :     aExpected = OUString("f left (x right ) = {a} rsub {0} + sum from {n = 1} to {∞} {left ({a} rsub {n} cos {nπx} over {L} + {b} rsub {n} sin {nπx} over {L} right )}", 144,
     315         [ +  - ]:          3 :             RTL_TEXTENCODING_UTF8);
     316 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     317                 :            : 
     318 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(5), 1));
                 [ +  - ]
     319                 :          3 :     aExpected = "{a} ^ {2} + {b} ^ {2} = {c} ^ {2}";
     320 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     321                 :            : 
     322 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(6), 1));
                 [ +  - ]
     323         [ +  - ]:          3 :     aExpected = OUString("x = {− b ± sqrt {{b} ^ {2} − 4 ac}} over {2 a}", 51, RTL_TEXTENCODING_UTF8);
     324 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     325                 :            : 
     326 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(7), 1));
                 [ +  - ]
     327         [ +  - ]:          3 :     aExpected = OUString("{e} ^ {x} = 1 + {x} over {1 !} + {{x} ^ {2}} over {2 !} + {{x} ^ {3}} over {3 !} + … , − ∞ < x < ∞", 106, RTL_TEXTENCODING_UTF8);
     328 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     329                 :            : 
     330 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(8), 1));
                 [ +  - ]
     331         [ +  - ]:          3 :     aExpected = OUString("sin α ± sin β = 2 sin {1} over {2} left (α ± β right ) cos {1} over {2} left (α ∓ β right )", 101, RTL_TEXTENCODING_UTF8);
     332 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     333                 :            : 
     334 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(9), 1));
                 [ +  - ]
     335         [ +  - ]:          3 :     aExpected = OUString("cos α + cos β = 2 cos {1} over {2} left (α + β right ) cos {1} over {2} left (α − β right )", 99, RTL_TEXTENCODING_UTF8);
     336 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     337                 :          3 : }
     338                 :            : 
     339                 :          3 : void Test::testMathNary()
     340                 :            : {
     341         [ +  - ]:          3 :     roundtrip("math-nary.rtf");
     342 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     343                 :          3 :     OUString aExpected("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}");
     344 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     345                 :          3 : }
     346                 :            : 
     347                 :          3 : void Test::testMathLimupp()
     348                 :            : {
     349         [ +  - ]:          3 :     roundtrip("math-limupp.rtf");
     350 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     351 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("{abcd} overbrace {4}"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     352                 :            : 
     353 [ +  - ][ +  - ]:          3 :     aActual = getFormula(getRun(getParagraph(2), 1));
                 [ +  - ]
     354 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("{xyz} underbrace {3}"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     355                 :          3 : }
     356                 :            : 
     357                 :          3 : void Test::testMathStrikeh()
     358                 :            : {
     359         [ +  - ]:          3 :     roundtrip("math-strikeh.rtf");
     360 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     361 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("overstrike {abc}"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     362                 :          3 : }
     363                 :            : 
     364                 :          3 : void Test::testMathPlaceholders()
     365                 :            : {
     366         [ +  - ]:          3 :     roundtrip("math-placeholders.rtf");
     367 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     368 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("sum from <?> to <?> <?>"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     369                 :          3 : }
     370                 :            : 
     371                 :          3 : void Test::testMathRad()
     372                 :            : {
     373         [ +  - ]:          3 :     roundtrip("math-rad.rtf");
     374 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     375 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("sqrt {4} nroot {3} {x + 1}"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     376                 :          3 : }
     377                 :            : 
     378                 :          3 : void Test::testMathSepchr()
     379                 :            : {
     380         [ +  - ]:          3 :     roundtrip("math-sepchr.rtf");
     381 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     382 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("AxByBzC"), aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     383                 :          3 : }
     384                 :            : 
     385                 :          3 : void Test::testMathSubscripts()
     386                 :            : {
     387         [ +  - ]:          3 :     roundtrip("math-subscripts.rtf");
     388 [ +  - ][ +  - ]:          3 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
                 [ +  - ]
     389                 :          3 :     OUString aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} {x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub {2} rsup {1}");
     390 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
         [ +  - ][ +  - ]
                 [ +  - ]
     391                 :          3 : }
     392                 :            : 
     393                 :          3 : void Test::testMathVerticalstacks()
     394                 :            : {
     395         [ +  - ]:          3 :     roundtrip("math-vertical-stacks.rtf");
     396 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("{a} over {b}"), getFormula(getRun(getParagraph(1), 1)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     397 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("{a} / {b}"), getFormula(getRun(getParagraph(2), 1)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     398 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("stack { a # b }"), getFormula(getRun(getParagraph(3), 1)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     399 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("stack { a # stack { b # c } }"), getFormula(getRun(getParagraph(4), 1)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     400                 :          3 : }
     401                 :            : 
     402                 :          3 : void Test::testMathRuns()
     403                 :            : {
     404         [ +  - ]:          3 :     roundtrip("math-runs.rtf");
     405                 :            :     // was [](){}, i.e. first curly bracket had an incorrect position
     406 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     407                 :          3 : }
     408                 :            : 
     409                 :          3 : void Test::testFdo53113()
     410                 :            : {
     411                 :            :     /*
     412                 :            :      * The problem was that a custom shape was missings its second (and all the other remaining) coordinates.
     413                 :            :      *
     414                 :            :      * oShape = ThisComponent.DrawPage(0)
     415                 :            :      * oPathPropVec = oShape.CustomShapeGeometry(1).Value
     416                 :            :      * oCoordinates = oPathPropVec(0).Value
     417                 :            :      * xray oCoordinates(1).First.Value ' 535
     418                 :            :      * xray oCoordinates(1).Second.Value ' 102
     419                 :            :      */
     420                 :            : 
     421         [ +  - ]:          3 :     roundtrip("fdo53113.odt");
     422         [ +  - ]:          3 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     423 [ +  - ][ +  - ]:          3 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
                 [ +  - ]
     424 [ +  - ][ +  - ]:          3 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xDraws->getByIndex(0), "CustomShapeGeometry");
                 [ +  - ]
     425         [ +  + ]:          9 :     for (int i = 0; i < aProps.getLength(); ++i)
     426                 :            :     {
     427         [ +  - ]:          6 :         const beans::PropertyValue& rProp = aProps[i];
     428         [ +  + ]:          6 :         if (rProp.Name == "Path")
     429         [ +  - ]:          3 :             rProp.Value >>= aProps;
     430                 :            :     }
     431         [ +  - ]:          3 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
     432         [ +  + ]:          9 :     for (int i = 0; i < aProps.getLength(); ++i)
     433                 :            :     {
     434         [ +  - ]:          6 :         const beans::PropertyValue& rProp = aProps[i];
     435         [ +  + ]:          6 :         if (rProp.Name == "Coordinates")
     436         [ +  - ]:          3 :             rProp.Value >>= aPairs;
     437                 :            :     }
     438 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(16), aPairs.getLength());
         [ +  - ][ +  - ]
                 [ +  - ]
     439 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(535), aPairs[1].First.Value.get<sal_Int32>());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     440 [ +  - ][ +  - ]:          3 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(102), aPairs[1].Second.Value.get<sal_Int32>());
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     441                 :          3 : }
     442                 :            : 
     443                 :          3 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     444                 :            : 
     445 [ +  - ][ +  - ]:         12 : CPPUNIT_PLUGIN_IMPLEMENT();
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     446                 :            : 
     447                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10