LCOV - code coverage report
Current view: top level - libreoffice/sw/qa/extras/rtfexport - rtfexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 235 235 100.0 %
Date: 2012-12-27 Functions: 39 40 97.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       3             :  *
       4             :  * The contents of this file are subject to the Mozilla Public License Version
       5             :  * 1.1 (the "License"); you may not use this file except in compliance with
       6             :  * the License. You may obtain a copy of the License at
       7             :  * http://www.mozilla.org/MPL/
       8             :  *
       9             :  * Software distributed under the License is distributed on an "AS IS" basis,
      10             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11             :  * for the specific language governing rights and limitations under the
      12             :  * License.
      13             :  *
      14             :  * The Initial Developer of the Original Code is
      15             :  *       Miklos Vajna <vmiklos@suse.cz> (SUSE, Inc.)
      16             :  * Portions created by the Initial Developer are Copyright (C) 2012 the
      17             :  * Initial Developer. All Rights Reserved.
      18             :  *
      19             :  * Contributor(s):
      20             :  *
      21             :  * Alternatively, the contents of this file may be used under the terms of
      22             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      23             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      24             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      25             :  * instead of those above.
      26             :  */
      27             : 
      28             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      29             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      30             : #include <com/sun/star/frame/XStorable.hpp>
      31             : #include <com/sun/star/text/XFootnotesSupplier.hpp>
      32             : #include <com/sun/star/text/XPageCursor.hpp>
      33             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      34             : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
      35             : 
      36             : #include <vcl/svapp.hxx>
      37             : #include <swmodeltestbase.hxx>
      38             : 
      39           3 : class Test : public SwModelTestBase
      40             : {
      41             : public:
      42             :     void testZoom();
      43             :     void testFdo38176();
      44             :     void testFdo49683();
      45             :     void testFdo44174();
      46             :     void testFdo50087();
      47             :     void testFdo50831();
      48             :     void testFdo48335();
      49             :     void testFdo38244();
      50             :     void testMathAccents();
      51             :     void testMathEqarray();
      52             :     void testMathD();
      53             :     void testMathEscaping();
      54             :     void testMathLim();
      55             :     void testMathMatrix();
      56             :     void testMathBox();
      57             :     void testMathMso2007();
      58             :     void testMathNary();
      59             :     void testMathLimupp();
      60             :     void testMathStrikeh();
      61             :     void testMathPlaceholders();
      62             :     void testMathRad();
      63             :     void testMathSepchr();
      64             :     void testMathSubscripts();
      65             :     void testMathVerticalstacks();
      66             :     void testMathRuns();
      67             :     void testFdo53113();
      68             :     void testFdo55939();
      69             :     void testTextFrames();
      70             :     void testFdo53604();
      71             : 
      72           2 :     CPPUNIT_TEST_SUITE(Test);
      73             : #if !defined(MACOSX) && !defined(WNT)
      74           1 :     CPPUNIT_TEST(run);
      75             : #endif
      76           2 :     CPPUNIT_TEST_SUITE_END();
      77             : 
      78             : private:
      79             :     void run();
      80             : };
      81             : 
      82           1 : void Test::run()
      83             : {
      84             :     MethodEntry<Test> aMethods[] = {
      85             :         {"zoom.rtf", &Test::testZoom},
      86             :         {"fdo38176.rtf", &Test::testFdo38176},
      87             :         {"fdo49683.rtf", &Test::testFdo49683},
      88             :         {"fdo44174.rtf", &Test::testFdo44174},
      89             :         {"fdo50087.rtf", &Test::testFdo50087},
      90             :         {"fdo50831.rtf", &Test::testFdo50831},
      91             :         {"fdo48335.odt", &Test::testFdo48335},
      92             :         {"fdo38244.rtf", &Test::testFdo38244},
      93             :         {"math-accents.rtf", &Test::testMathAccents},
      94             :         {"math-eqarray.rtf", &Test::testMathEqarray},
      95             :         {"math-d.rtf", &Test::testMathD},
      96             :         {"math-escaping.rtf", &Test::testMathEscaping},
      97             :         {"math-lim.rtf", &Test::testMathLim},
      98             :         {"math-matrix.rtf", &Test::testMathMatrix},
      99             :         {"math-mbox.rtf", &Test::testMathBox},
     100             :         {"math-mso2007.rtf", &Test::testMathMso2007},
     101             :         {"math-nary.rtf", &Test::testMathNary},
     102             :         {"math-limupp.rtf", &Test::testMathLimupp},
     103             :         {"math-strikeh.rtf", &Test::testMathStrikeh},
     104             :         {"math-placeholders.rtf", &Test::testMathPlaceholders},
     105             :         {"math-rad.rtf", &Test::testMathRad},
     106             :         {"math-sepchr.rtf", &Test::testMathSepchr},
     107             :         {"math-subscripts.rtf", &Test::testMathSubscripts},
     108             :         {"math-vertical-stacks.rtf", &Test::testMathVerticalstacks},
     109             :         {"math-runs.rtf", &Test::testMathRuns},
     110             :         {"fdo53113.odt", &Test::testFdo53113},
     111             :         {"fdo55939.odt", &Test::testFdo55939},
     112             :         {"textframes.odt", &Test::testTextFrames},
     113             :         {"fdo53604.odt", &Test::testFdo53604},
     114           1 :     };
     115             :     // Don't test the first import of these, for some reason those tests fail
     116             :     const char* aBlacklist[] = {
     117             :         "math-eqarray.rtf",
     118             :         "math-escaping.rtf",
     119             :         "math-lim.rtf",
     120             :         "math-mso2007.rtf",
     121             :         "math-nary.rtf",
     122             :         "math-rad.rtf",
     123             :         "math-vertical-stacks.rtf",
     124             :         "math-runs.rtf",
     125           1 :     };
     126           1 :     std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
     127           1 :     header();
     128          30 :     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     129             :     {
     130          29 :         MethodEntry<Test>& rEntry = aMethods[i];
     131          29 :         load("/sw/qa/extras/rtfexport/data/", rEntry.pName);
     132             :         // If the testcase is stored in some other format, it's pointless to test.
     133          29 :         if (OString(rEntry.pName).endsWith(".rtf") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
     134          16 :             (this->*rEntry.pMethod)();
     135          29 :         reload("Rich Text Format");
     136          29 :         (this->*rEntry.pMethod)();
     137          29 :         finish();
     138           1 :     }
     139           1 : }
     140             : 
     141           2 : void Test::testZoom()
     142             : {
     143           2 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     144           2 :     uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     145           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
     146           2 :     sal_Int16 nValue = 0;
     147           2 :     xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
     148           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
     149           2 : }
     150             : 
     151           2 : void Test::testFdo38176()
     152             : {
     153           2 :     CPPUNIT_ASSERT_EQUAL(9, getLength());
     154           2 : }
     155             : 
     156           2 : void Test::testFdo49683()
     157             : {
     158           2 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     159           2 :     uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
     160           2 :     uno::Sequence<OUString> aKeywords(xDocumentProperties->getKeywords());
     161           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aKeywords.getLength());
     162           2 :     CPPUNIT_ASSERT_EQUAL(OUString("one"), aKeywords[0]);
     163           2 :     CPPUNIT_ASSERT_EQUAL(OUString("two"), aKeywords[1]);
     164           2 : }
     165             : 
     166           2 : void Test::testFdo44174()
     167             : {
     168           2 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     169           2 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     170           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     171           2 :     OUString aValue;
     172           2 :     xPropertySet->getPropertyValue("PageStyleName") >>= aValue;
     173           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
     174           2 : }
     175             : 
     176           2 : void Test::testFdo50087()
     177             : {
     178           2 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     179           2 :     uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
     180           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Title"), xDocumentProperties->getTitle());
     181           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Subject"), xDocumentProperties->getSubject());
     182           2 :     CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), xDocumentProperties->getDescription());
     183           2 : }
     184             : 
     185           2 : void Test::testFdo50831()
     186             : {
     187           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     188           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     189           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     190           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
     191           2 :     float fValue = 0;
     192           2 :     xPropertySet->getPropertyValue("CharHeight") >>= fValue;
     193           2 :     CPPUNIT_ASSERT_EQUAL(10.f, fValue);
     194           2 : }
     195             : 
     196           1 : void Test::testFdo48335()
     197             : {
     198             :     /*
     199             :      * The problem was that we exported a fake pagebreak, make sure it's just a soft one now.
     200             :      *
     201             :      * oParas = ThisComponent.Text.createEnumeration
     202             :      * oPara = oParas.nextElement
     203             :      * oPara = oParas.nextElement
     204             :      * oPara = oParas.nextElement
     205             :      * oRuns = oPara.createEnumeration
     206             :      * oRun = oRuns.nextElement
     207             :      * xray oRun.TextPortionType 'was Text, should be SoftPageBreak
     208             :      */
     209           1 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     210           1 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     211           1 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     212           3 :     for (int i = 0; i < 2; i++)
     213           2 :         xParaEnum->nextElement();
     214           1 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     215           1 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     216           1 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
     217           1 :     OUString aValue;
     218           1 :     xPropertySet->getPropertyValue("TextPortionType") >>= aValue;
     219           1 :     CPPUNIT_ASSERT_EQUAL(OUString("SoftPageBreak"), aValue);
     220           1 : }
     221             : 
     222           2 : void Test::testFdo38244()
     223             : {
     224             :     // See ooxmlexport's testFdo38244().
     225             :     // Test comment range feature.
     226           2 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     227           2 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     228           2 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     229           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
     230           2 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     231           2 :     xRunEnum->nextElement();
     232           2 :     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
     233           2 :     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     234           2 :     xRunEnum->nextElement();
     235           2 :     xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
     236           2 :     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
     237             : 
     238             :     // Test initials.
     239           2 :     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
     240           2 :     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     241           2 :     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     242           2 :     xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
     243           2 :     CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
     244           2 : }
     245             : 
     246           2 : void Test::testMathAccents()
     247             : {
     248           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     249           2 :     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}");
     250           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     251           2 : }
     252             : 
     253           1 : void Test::testMathEqarray()
     254             : {
     255           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     256           1 :     OUString aExpected("y = left lbrace stack { 0, x < 0 # 1, x = 0 # {x} ^ {2} , x > 0 } right none");
     257           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     258           1 : }
     259             : 
     260           2 : void Test::testMathD()
     261             : {
     262           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     263           2 :     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 )");
     264           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     265           2 : }
     266             : 
     267           1 : void Test::testMathEscaping()
     268             : {
     269           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     270           1 :     OUString aExpected("á \\{", 5, RTL_TEXTENCODING_UTF8);
     271           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     272           1 : }
     273             : 
     274           1 : void Test::testMathLim()
     275             : {
     276           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     277           1 :     OUString aExpected("lim from {x → 1} {x}", 22, RTL_TEXTENCODING_UTF8);
     278           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     279           1 : }
     280             : 
     281           2 : void Test::testMathMatrix()
     282             : {
     283           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     284           2 :     OUString aExpected("left [matrix {1 # 2 ## 3 # 4} right ]");
     285           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     286           2 : }
     287             : 
     288           2 : void Test::testMathBox()
     289             : {
     290           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     291           2 :     OUString aExpected("a");
     292           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     293           2 : }
     294             : 
     295           1 : void Test::testMathMso2007()
     296             : {
     297           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     298           1 :     OUString aExpected("A = π {r} ^ {2}", 16, RTL_TEXTENCODING_UTF8);
     299           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     300             : 
     301           1 :     aActual = getFormula(getRun(getParagraph(2), 1));
     302           1 :     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);
     303           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     304             : 
     305           1 :     aActual = getFormula(getRun(getParagraph(3), 1));
     306           1 :     aExpected = OUString("{left (1 + x right )} ^ {n} = 1 + {nx} over {1 !} + {n left (n − 1 right ) {x} ^ {2}} over {2 !} + …", 104, RTL_TEXTENCODING_UTF8);
     307           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     308             : 
     309           1 :     aActual = getFormula(getRun(getParagraph(4), 1));
     310             :     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,
     311           1 :             RTL_TEXTENCODING_UTF8);
     312           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     313             : 
     314           1 :     aActual = getFormula(getRun(getParagraph(5), 1));
     315           1 :     aExpected = "{a} ^ {2} + {b} ^ {2} = {c} ^ {2}";
     316           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     317             : 
     318           1 :     aActual = getFormula(getRun(getParagraph(6), 1));
     319           1 :     aExpected = OUString("x = {− b ± sqrt {{b} ^ {2} − 4 ac}} over {2 a}", 51, RTL_TEXTENCODING_UTF8);
     320           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     321             : 
     322           1 :     aActual = getFormula(getRun(getParagraph(7), 1));
     323           1 :     aExpected = OUString("{e} ^ {x} = 1 + {x} over {1 !} + {{x} ^ {2}} over {2 !} + {{x} ^ {3}} over {3 !} + … , − ∞ < x < ∞", 106, RTL_TEXTENCODING_UTF8);
     324           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     325             : 
     326           1 :     aActual = getFormula(getRun(getParagraph(8), 1));
     327           1 :     aExpected = OUString("sin α ± sin β = 2 sin {1} over {2} left (α ± β right ) cos {1} over {2} left (α ∓ β right )", 101, RTL_TEXTENCODING_UTF8);
     328           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     329             : 
     330           1 :     aActual = getFormula(getRun(getParagraph(9), 1));
     331           1 :     aExpected = OUString("cos α + cos β = 2 cos {1} over {2} left (α + β right ) cos {1} over {2} left (α − β right )", 99, RTL_TEXTENCODING_UTF8);
     332           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     333           1 : }
     334             : 
     335           1 : void Test::testMathNary()
     336             : {
     337           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     338           1 :     OUString aExpected("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}");
     339           1 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     340           1 : }
     341             : 
     342           2 : void Test::testMathLimupp()
     343             : {
     344           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     345           2 :     CPPUNIT_ASSERT_EQUAL(OUString("{abcd} overbrace {4}"), aActual);
     346             : 
     347           2 :     aActual = getFormula(getRun(getParagraph(2), 1));
     348           2 :     CPPUNIT_ASSERT_EQUAL(OUString("{xyz} underbrace {3}"), aActual);
     349           2 : }
     350             : 
     351           2 : void Test::testMathStrikeh()
     352             : {
     353           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     354           2 :     CPPUNIT_ASSERT_EQUAL(OUString("overstrike {abc}"), aActual);
     355           2 : }
     356             : 
     357           2 : void Test::testMathPlaceholders()
     358             : {
     359           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     360           2 :     CPPUNIT_ASSERT_EQUAL(OUString("sum from <?> to <?> <?>"), aActual);
     361           2 : }
     362             : 
     363           1 : void Test::testMathRad()
     364             : {
     365           1 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     366           1 :     CPPUNIT_ASSERT_EQUAL(OUString("sqrt {4} nroot {3} {x + 1}"), aActual);
     367           1 : }
     368             : 
     369           2 : void Test::testMathSepchr()
     370             : {
     371           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     372           2 :     CPPUNIT_ASSERT_EQUAL(OUString("AxByBzC"), aActual);
     373           2 : }
     374             : 
     375           2 : void Test::testMathSubscripts()
     376             : {
     377           2 :     OUString aActual = getFormula(getRun(getParagraph(1), 1));
     378           2 :     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}");
     379           2 :     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
     380           2 : }
     381             : 
     382           1 : void Test::testMathVerticalstacks()
     383             : {
     384           1 :     CPPUNIT_ASSERT_EQUAL(OUString("{a} over {b}"), getFormula(getRun(getParagraph(1), 1)));
     385           1 :     CPPUNIT_ASSERT_EQUAL(OUString("{a} / {b}"), getFormula(getRun(getParagraph(2), 1)));
     386           1 :     CPPUNIT_ASSERT_EQUAL(OUString("stack { a # b }"), getFormula(getRun(getParagraph(3), 1)));
     387           1 :     CPPUNIT_ASSERT_EQUAL(OUString("stack { a # stack { b # c } }"), getFormula(getRun(getParagraph(4), 1)));
     388           1 : }
     389             : 
     390           1 : void Test::testMathRuns()
     391             : {
     392             :     // was [](){}, i.e. first curly bracket had an incorrect position
     393           1 :     CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
     394           1 : }
     395             : 
     396           1 : void Test::testFdo53113()
     397             : {
     398             :     /*
     399             :      * The problem was that a custom shape was missings its second (and all the other remaining) coordinates.
     400             :      *
     401             :      * oShape = ThisComponent.DrawPage(0)
     402             :      * oPathPropVec = oShape.CustomShapeGeometry(1).Value
     403             :      * oCoordinates = oPathPropVec(0).Value
     404             :      * xray oCoordinates(1).First.Value ' 535
     405             :      * xray oCoordinates(1).Second.Value ' 102
     406             :      */
     407             : 
     408           1 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     409           1 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     410           1 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xDraws->getByIndex(0), "CustomShapeGeometry");
     411           1 :     uno::Sequence<beans::PropertyValue> aPathProps;
     412           4 :     for (int i = 0; i < aProps.getLength(); ++i)
     413             :     {
     414           3 :         const beans::PropertyValue& rProp = aProps[i];
     415           3 :         if (rProp.Name == "Path")
     416           1 :             rProp.Value >>= aPathProps;
     417             :     }
     418           1 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
     419           3 :     for (int i = 0; i < aPathProps.getLength(); ++i)
     420             :     {
     421           2 :         const beans::PropertyValue& rProp = aPathProps[i];
     422           2 :         if (rProp.Name == "Coordinates")
     423           1 :             rProp.Value >>= aPairs;
     424             :     }
     425           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(16), aPairs.getLength());
     426           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(535), aPairs[1].First.Value.get<sal_Int32>());
     427           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(102), aPairs[1].Second.Value.get<sal_Int32>());
     428           1 : }
     429             : 
     430           1 : void Test::testFdo55939()
     431             : {
     432             :     // The problem was that the exported RTF was invalid.
     433           1 :     uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
     434           1 :     getRun(xParagraph, 1, "Main text before footnote.");
     435             :     // Why the tab has to be removed here?
     436           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."),
     437           1 :             getProperty< uno::Reference<text::XTextRange> >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", ""));
     438           1 :     getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK.
     439           1 : }
     440             : 
     441           1 : void Test::testTextFrames()
     442             : {
     443             :     // The output was simply invalid, so let's check if all 3 frames were imported back.
     444           1 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     445           1 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     446           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount());
     447           1 : }
     448             : 
     449           1 : void Test::testFdo53604()
     450             : {
     451             :     // Invalid output on empty footnote.
     452           1 :     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     453           1 :     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
     454           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount());
     455           1 : }
     456             : 
     457           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     458             : 
     459           4 : CPPUNIT_PLUGIN_IMPLEMENT();
     460             : 
     461             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10