LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlexport - ooxmlexport3.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 546 549 99.5 %
Date: 2014-11-03 Functions: 375 418 89.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <swmodeltestbase.hxx>
      11             : 
      12             : #include <com/sun/star/awt/XBitmap.hpp>
      13             : #include <com/sun/star/graphic/XGraphic.hpp>
      14             : #include <com/sun/star/frame/XStorable.hpp>
      15             : #include <com/sun/star/drawing/FillStyle.hpp>
      16             : #include <com/sun/star/drawing/LineJoint.hpp>
      17             : #include <com/sun/star/drawing/LineStyle.hpp>
      18             : #include <com/sun/star/drawing/XControlShape.hpp>
      19             : #include <com/sun/star/awt/Gradient.hpp>
      20             : #include <com/sun/star/style/TabStop.hpp>
      21             : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
      22             : #include <com/sun/star/text/RelOrientation.hpp>
      23             : #include <com/sun/star/text/XTextFrame.hpp>
      24             : #include <com/sun/star/text/XTextTable.hpp>
      25             : #include <com/sun/star/text/XTextFramesSupplier.hpp>
      26             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      27             : #include <com/sun/star/text/XTextSection.hpp>
      28             : #include <com/sun/star/style/CaseMap.hpp>
      29             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      30             : #include <com/sun/star/style/LineSpacing.hpp>
      31             : #include <com/sun/star/style/LineSpacingMode.hpp>
      32             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      33             : #include <com/sun/star/table/BorderLine2.hpp>
      34             : #include <com/sun/star/table/ShadowFormat.hpp>
      35             : #include <com/sun/star/text/GraphicCrop.hpp>
      36             : #include <com/sun/star/text/XPageCursor.hpp>
      37             : #include <com/sun/star/awt/FontWeight.hpp>
      38             : #include <com/sun/star/awt/FontUnderline.hpp>
      39             : #include <com/sun/star/awt/FontSlant.hpp>
      40             : #include <com/sun/star/text/WritingMode2.hpp>
      41             : #include <com/sun/star/text/WrapTextMode.hpp>
      42             : #include <com/sun/star/xml/dom/XDocument.hpp>
      43             : #include <com/sun/star/style/BreakType.hpp>
      44             : #include <unotools/tempfile.hxx>
      45             : #include <comphelper/sequenceashashmap.hxx>
      46             : #include <com/sun/star/text/XDocumentIndex.hpp>
      47             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      48             : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
      49             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      50             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      51             : #include <com/sun/star/drawing/Hatch.hpp>
      52             : 
      53             : #include <string>
      54             : 
      55         164 : class Test : public SwModelTestBase
      56             : {
      57             : public:
      58         164 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
      59             : 
      60             : protected:
      61             :     /**
      62             :      * Blacklist handling
      63             :      */
      64          82 :     bool mustTestImportOf(const char* filename) const SAL_OVERRIDE {
      65             :         const char* aBlacklist[] = {
      66             :             "math-escape.docx",
      67             :             "math-mso2k7.docx",
      68             :             "ImageCrop.docx",
      69             :             "test_GIF_ImageCrop.docx",
      70             :             "test_PNG_ImageCrop.docx"
      71          82 :         };
      72          82 :         std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
      73             : 
      74             :         // If the testcase is stored in some other format, it's pointless to test.
      75          82 :         return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end());
      76             :     }
      77             : };
      78             : 
      79             : #if !defined(WNT)
      80             : 
      81          28 : DECLARE_OOXMLEXPORT_TEST(testFdo68418, "fdo68418.docx")
      82             : {
      83             :     // The problem was that in 'MSWordExportBase::SectionProperties' function in 'wrt8sty.cxx'
      84             :     // it checked if it 'IsPlausableSingleWordSection'.
      85             :     // The 'IsPlausableSingleWordSection' compared different aspects of 2 'SwFrmFmt' objects.
      86             :     // One of the checks was 'do both formats have the same distance from the top and bottom ?'
      87             :     // This check is correct if both have headers or both don't have headers.
      88             :     // However - if one has a header, and the other one has an empty header (no header) - it is not correct to compare
      89             :     // between them (same goes for 'footer').
      90           4 :     uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "FooterText");
      91           8 :     uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText );
      92             : 
      93             :     // First page footer is empty, second page footer is 'aaaa'
      94           8 :     CPPUNIT_ASSERT_EQUAL(OUString("aaaa"), xFooterParagraph->getString());        // I get an error that it expects ''
      95           4 : }
      96             : 
      97          28 : DECLARE_OOXMLEXPORT_TEST(testA4AndBorders, "a4andborders.docx")
      98             : {
      99             :     /*
     100             :      * The problem was that in case of a document with borders, the pgSz attribute
     101             :      * was exported as a child of pgBorders, thus being ignored on reload.
     102             :      * We assert dimension against A4 size in mm (to avoid minor rounding errors)
     103             :      */
     104           4 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     105           4 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Width (mm)", sal_Int32(210), getProperty<sal_Int32>(xPageStyle, "Width") / 100);
     106           4 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Height (mm)", sal_Int32(297), getProperty<sal_Int32>(xPageStyle, "Height") / 100);
     107           4 : }
     108             : 
     109          28 : DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx")
     110             : {
     111           4 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     112             :     // This was 25, the 'lack of w:separator' <-> '0 line width' mapping was missing.
     113           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth"));
     114           4 : }
     115             : 
     116          26 : DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt")
     117             : {
     118           2 :     uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY);
     119             :     // OOXML has just one border attribute (<w:bdr>) for text border so all side has
     120             :     // the same border with the same padding
     121             :     // Border
     122             :     {
     123           2 :         const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder");
     124           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF6600,0,318,0,0,318), aTopBorder);
     125           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder"));
     126           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder"));
     127           2 :         CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder"));
     128             :     }
     129             : 
     130             :     // Padding (w:space)
     131             :     {
     132           2 :         const sal_Int32 nTopPadding = getProperty<sal_Int32>(xRun,"CharTopBorderDistance");
     133             :         // In the original ODT the padding is 150, but the unit conversion round it down.
     134           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(141), nTopPadding);
     135           2 :         CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharLeftBorderDistance"));
     136           2 :         CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharBottomBorderDistance"));
     137           2 :         CPPUNIT_ASSERT_EQUAL(nTopPadding, getProperty<sal_Int32>(xRun,"CharRightBorderDistance"));
     138             :     }
     139             : 
     140             :     // Shadow (w:shadow)
     141             :     /* OOXML use just one bool value for shadow so the next conversions
     142             :        are made during an export-import round
     143             :        color: any -> black
     144             :        location: any -> bottom-right
     145             :        width: any -> border width */
     146             :     {
     147           2 :         const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
     148           2 :         CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
     149           2 :         CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
     150           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
     151             :     }
     152             : 
     153             :     // Also check shadow when it is in middle of the paragraph
     154             :     // (problem can be during export with SwWW8AttrIter::HasTextItem())
     155             :     {
     156           2 :         uno::Reference<beans::XPropertySet> xMiddleRun(getRun(getParagraph(2),2), uno::UNO_QUERY);
     157           2 :         const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xMiddleRun, "CharShadowFormat");
     158           2 :         CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color));
     159           2 :         CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
     160           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
     161             :     }
     162             : 
     163           2 :     if (xmlDocPtr pXmlStyles = parseExport("word/styles.xml"))
     164             :     {
     165             :         // Make sure we write qFormat for custom style names.
     166           2 :         assertXPath(pXmlStyles, "//w:style[@w:styleId='Heading']/w:qFormat", 1);
     167           2 :     }
     168           2 : }
     169             : 
     170          28 : DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, "style-inheritance.docx")
     171             : {
     172             :     // Check that now styleId's are more like what MSO produces
     173           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     174           4 :     if (!pXmlStyles)
     175           6 :         return;
     176             :     // the 1st style always must be Normal
     177           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[1]", "styleId", "Normal");
     178             :     // some random style later
     179           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[4]", "styleId", "Heading3");
     180             : 
     181             :     // Check that we do _not_ export w:next for styles that point to themselves.
     182           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:next", 0);
     183             : 
     184             :     // Check that we roundtrip <w:next> correctly - on XML level
     185           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[2]/w:next", "val", "Normal");
     186             :     // And to be REALLY sure, check it on the API level too ;-)
     187           2 :     uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles");
     188           4 :     uno::Reference< beans::XPropertySet > properties(paragraphStyles->getByName("Heading 1"), uno::UNO_QUERY);
     189           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(properties, "FollowStyle"));
     190             : 
     191             :     // This was 0, as export of w:outlineLvl was missing.
     192           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(properties, "OutlineLevel"));
     193             : 
     194           2 :     properties = uno::Reference< beans::XPropertySet >(paragraphStyles->getByName("Heading 11"), uno::UNO_QUERY);
     195           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty<OUString>(properties, "FollowStyle"));
     196             : 
     197             :     // Make sure style #2 is Heading 1.
     198           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[2]", "styleId", "Heading1");
     199             :     // w:ind was copied from the parent (Normal) style without a good reason.
     200           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[2]/w:pPr/w:ind", 0);
     201             : 
     202             :     // We output exactly 2 properties in rPrDefault, nothing else was
     203             :     // introduced as an additional default
     204           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 2);
     205             :     // Check that we output real content of rPrDefault
     206           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "ascii", "Times New Roman");
     207           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:lang", "bidi", "ar-SA");
     208             :     // pPrDefault is empty
     209           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:pPrDefault/w:pPr/*", 0);
     210             : 
     211             :     // Check latent styles
     212           4 :     uno::Sequence<beans::PropertyValue> aGrabBag = getProperty< uno::Sequence<beans::PropertyValue> >(mxComponent, "InteropGrabBag");
     213           4 :     uno::Sequence<beans::PropertyValue> aLatentStyles;
     214          26 :     for (sal_Int32 i = 0; i < aGrabBag.getLength(); ++i)
     215          24 :         if (aGrabBag[i].Name == "latentStyles")
     216           2 :             aGrabBag[i].Value >>= aLatentStyles;
     217           2 :     CPPUNIT_ASSERT(aLatentStyles.getLength()); // document should have latent styles
     218             : 
     219             :     // Check latent style default attributes
     220           4 :     OUString aCount;
     221           4 :     uno::Sequence<beans::PropertyValue> aLatentStyleExceptions;
     222          16 :     for (sal_Int32 i = 0; i < aLatentStyles.getLength(); ++i)
     223             :     {
     224          14 :         if (aLatentStyles[i].Name == "count")
     225           2 :             aCount = aLatentStyles[i].Value.get<OUString>();
     226          12 :         else if (aLatentStyles[i].Name == "lsdExceptions")
     227           2 :             aLatentStyles[i].Value >>= aLatentStyleExceptions;
     228             :     }
     229           2 :     CPPUNIT_ASSERT_EQUAL(OUString("371"), aCount); // This check the "count" attribute.
     230             : 
     231             :     // Check exceptions to the latent style defaults.
     232           4 :     uno::Sequence<beans::PropertyValue> aLatentStyleException;
     233           2 :     aLatentStyleExceptions[0].Value >>= aLatentStyleException;
     234           4 :     OUString aName;
     235           8 :     for (sal_Int32 i = 0; i < aLatentStyleException.getLength(); ++i)
     236           6 :         if (aLatentStyleException[i].Name == "name")
     237           2 :             aName = aLatentStyleException[i].Value.get<OUString>();
     238           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Normal"), aName); // This checks the "name" attribute of the first exception.
     239             : 
     240             :     // This numbering style wasn't roundtripped.
     241           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']/w:name", "val", "No List");
     242             : 
     243             :     // Table style wasn't roundtripped.
     244           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:tblPr/w:tblCellMar/w:left", "w", "108");
     245           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:semiHidden", 1);
     246           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:unhideWhenUsed", 1);
     247             : 
     248             :     // Additional para style properties should be also roundtripped.
     249           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListParagraph']/w:uiPriority", "val", "34");
     250           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:qFormat", 1);
     251           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:rsid", "val", "00780346");
     252           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']", "default", "1");
     253             : 
     254           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:link", "val", "Heading1Char");
     255           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:locked", 1);
     256             : 
     257           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']", "customStyle", "1");
     258           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']/w:autoRedefine", 1);
     259             : 
     260             :     // Additional char style properties should be also roundtripped.
     261           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DefaultParagraphFont']", "default", "1");
     262             : 
     263             :     // Finally check the same for numbering styles.
     264           4 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']", "default", "1");
     265             : }
     266             : 
     267          28 : DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx")
     268             : {
     269             :     // Document has a non-trivial table style, test the roundtrip of it.
     270           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     271           4 :     if (!pXmlStyles)
     272           6 :         return;
     273           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:basedOn", "val", "TableNormal");
     274           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:rsid", "val", "00903003");
     275           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblPr/w:tblStyleColBandSize", "val", "1");
     276           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tcPr/w:shd", "val", "clear");
     277             : 
     278             :     // Table style lost its paragraph / run properties.
     279           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:pPr/w:spacing", "lineRule", "auto");
     280           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:rPr/w:lang", "eastAsia", "ja-JP");
     281             : 
     282             :     // Table style lost its conditional table formatting properties.
     283           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:pPr/w:wordWrap", 1);
     284           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:rFonts", "hAnsiTheme", "minorHAnsi");
     285           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tblPr", 1);
     286           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:vAlign", "val", "bottom");
     287           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='lastRow']/w:tcPr/w:tcBorders/w:tr2bl", "val", "nil");
     288           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcBorders/w:top", "themeColor", "text1");
     289             : 
     290             :     // w:tblLook element and its attributes were missing.
     291           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     292           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "firstRow", "1");
     293           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastRow", "0");
     294           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastColumn", "0");
     295           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "firstColumn", "1");
     296           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "noHBand", "0");
     297           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "noVBand", "1");
     298           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "val", "04a0");
     299             : }
     300             : 
     301          28 : DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
     302             : {
     303             :     // Problem was that CharCaseMap was style::CaseMap::NONE.
     304           4 :     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
     305           6 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
     306           4 :     CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharCaseMap"));
     307             :     // Font size in the second row was 11.
     308           4 :     xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
     309           4 :     CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
     310             :     // Font size in the third row was 11 as well.
     311           4 :     xCell.set(xTable->getCellByName("B3"), uno::UNO_QUERY);
     312           4 :     CPPUNIT_ASSERT_EQUAL(14.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
     313             : 
     314             :     // This paragraph property was missing in table style.
     315           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     316           4 :     if (!pXmlStyles)
     317           6 :         return;
     318           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:pPr/w:jc", "val", "center");
     319             : 
     320             :     // These run properties were missing
     321           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "val", "en-US");
     322           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "bidi", "ar-SA");
     323           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:caps", 1);
     324           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:smallCaps", "val", "0");
     325           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeColor", "accent1");
     326           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:spacing", "val", "20");
     327             : 
     328             :     // Table borders were also missing
     329           4 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblPr/w:tblBorders/w:insideV", "themeTint", "99");
     330             : }
     331             : 
     332          28 : DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx")
     333             : {
     334             :     //fdo#76635 : Table borders are not getting preserved.
     335             : 
     336           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     337           4 :     if (!pXmlDocument)
     338           6 :         return;
     339             : 
     340           2 :        assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:val = 'single']",1);
     341           2 :        assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:sz = 4]", 1);
     342           2 :        assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:space = 0]", 1);
     343           2 :        assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:color = 808080]", 1);
     344             : 
     345             : }
     346             : 
     347          28 : DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx")
     348             : {
     349           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     350           4 :     if (!pXmlStyles)
     351           6 :         return;
     352             : 
     353             :     // These were missing in the Calendar3 table style.
     354           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:rFonts", "cstheme", "majorBidi");
     355           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:color", "themeTint", "80");
     356           2 :     CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeShade").equalsIgnoreAsciiCase("BF"));
     357             : 
     358             :     // Calendar4.
     359           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:pPr/w:snapToGrid", "val", "0");
     360           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:rPr/w:bCs", 1);
     361           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFill", "accent1");
     362           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFillShade", "80");
     363           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "rightChars", "0");
     364           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "right", "144");
     365           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcMar/w:bottom", "w", "86");
     366             : 
     367             :     // LightList.
     368           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='LightList']/w:tblStylePr[@w:type='firstRow']/w:pPr/w:spacing", "before", "0");
     369             : 
     370             :     // MediumList2-Accent1.
     371           2 :     CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumList2-Accent1']/w:tblStylePr[@w:type='band1Vert']/w:tcPr/w:shd", "themeFillTint").equalsIgnoreAsciiCase("3F"));
     372             : 
     373             :     // MediumShading2-Accent5.
     374           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumShading2-Accent5']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:tcBorders/w:top", "color", "auto");
     375             : }
     376             : 
     377          28 : DECLARE_OOXMLEXPORT_TEST(testFdo71302, "fdo71302.docx")
     378             : {
     379           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     380           4 :     if (!pXmlStyles)
     381           6 :         return;
     382             : 
     383             :     // This got renamed to "Strong Emphasis" without a good reason.
     384           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Strong']", 1);
     385             : }
     386             : 
     387             : 
     388             : 
     389             : 
     390             : 
     391          28 : DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
     392             : {
     393           4 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     394           8 :     uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
     395           8 :     uno::Sequence<beans::PropertyValue> aGrabBag(0);
     396           4 :     xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
     397           4 :     CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
     398             : 
     399           4 :     bool bTheme = false;
     400          52 :     for(int i = 0; i < aGrabBag.getLength(); ++i)
     401             :     {
     402          48 :       if (aGrabBag[i].Name == "OOXTheme")
     403             :       {
     404           4 :         bTheme = true;
     405           4 :         uno::Reference<xml::dom::XDocument> aThemeDom;
     406           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= aThemeDom); // PropertyValue of proper type
     407           4 :         CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty
     408             :       }
     409             :     }
     410           4 :     CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements
     411             : 
     412           8 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     413           8 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     414           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
     415             : 
     416           8 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     417           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xGroup->getCount()); // 1 rendered bitmap from the original shapes
     418             : 
     419           8 :     uno::Reference<beans::XPropertySet> xGroupPropertySet(getShape(1), uno::UNO_QUERY);
     420           4 :     xGroupPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
     421           4 :     CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
     422             : 
     423           4 :     bool bData = false, bLayout = false, bQStyle = false, bColor = false, bDrawing = false;
     424          24 :     for(int i = 0; i < aGrabBag.getLength(); ++i)
     425             :     {
     426          20 :       if (aGrabBag[i].Name == "OOXData")
     427             :       {
     428           4 :         bData = true;
     429           4 :         uno::Reference<xml::dom::XDocument> aDataDom;
     430           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= aDataDom); // PropertyValue of proper type
     431           4 :         CPPUNIT_ASSERT(aDataDom.get()); // Reference not empty
     432             :       }
     433          16 :       else if (aGrabBag[i].Name == "OOXLayout")
     434             :       {
     435           4 :         bLayout = true;
     436           4 :         uno::Reference<xml::dom::XDocument> aLayoutDom;
     437           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= aLayoutDom); // PropertyValue of proper type
     438           4 :         CPPUNIT_ASSERT(aLayoutDom.get()); // Reference not empty
     439             :       }
     440          12 :       else if (aGrabBag[i].Name == "OOXStyle")
     441             :       {
     442           4 :         bQStyle = true;
     443           4 :         uno::Reference<xml::dom::XDocument> aStyleDom;
     444           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= aStyleDom); // PropertyValue of proper type
     445           4 :         CPPUNIT_ASSERT(aStyleDom.get()); // Reference not empty
     446             :       }
     447           8 :       else if (aGrabBag[i].Name == "OOXColor")
     448             :       {
     449           4 :         bColor = true;
     450           4 :         uno::Reference<xml::dom::XDocument> aColorDom;
     451           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= aColorDom); // PropertyValue of proper type
     452           4 :         CPPUNIT_ASSERT(aColorDom.get()); // Reference not empty
     453             :       }
     454           4 :       else if (aGrabBag[i].Name == "OOXDrawing")
     455             :       {
     456           4 :         bDrawing = true;
     457           4 :         uno::Sequence< uno::Any > diagramDrawing;
     458           8 :         uno::Reference<xml::dom::XDocument> aDrawingDom;
     459           4 :         CPPUNIT_ASSERT(aGrabBag[i].Value >>= diagramDrawing);
     460           4 :         CPPUNIT_ASSERT(diagramDrawing[0] >>= aDrawingDom); // PropertyValue of proper type
     461           8 :         CPPUNIT_ASSERT(aDrawingDom.get()); // Reference not empty
     462             :       }
     463             :     }
     464           4 :     CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements
     465             : 
     466           8 :     uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(0), uno::UNO_QUERY);
     467           8 :     OUString nValue;
     468           4 :     xPropertySet->getPropertyValue("Name") >>= nValue;
     469           8 :     CPPUNIT_ASSERT_EQUAL(OUString("RenderedShapes"), nValue); // Rendered bitmap has the proper name
     470           4 : }
     471             : 
     472             : /*
     473             : DECLARE_OOXMLEXPORT_TEST(testCharHighlight, "char_highlight.docx")
     474             : {
     475             :     const uno::Reference< text::XTextRange > xPara = getParagraph(1);
     476             :     // Both highlight and background
     477             :     const sal_Int32 nBackColor(0x4F81BD);
     478             :     for( int nRun = 1; nRun <= 16; ++nRun )
     479             :     {
     480             :         const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,nRun), uno::UNO_QUERY);
     481             :         sal_Int32 nHighlightColor = 0;
     482             :         switch( nRun )
     483             :         {
     484             :             case 1: nHighlightColor = 0x000000; break; //black
     485             :             case 2: nHighlightColor = 0x0000ff; break; //blue
     486             :             case 3: nHighlightColor = 0x00ffff; break; //cyan
     487             :             case 4: nHighlightColor = 0x00ff00; break; //green
     488             :             case 5: nHighlightColor = 0xff00ff; break; //magenta
     489             :             case 6: nHighlightColor = 0xff0000; break; //red
     490             :             case 7: nHighlightColor = 0xffff00; break; //yellow
     491             :             case 8: nHighlightColor = 0xffffff; break; //white
     492             :             case 9: nHighlightColor = 0x000080;  break;//dark blue
     493             :             case 10: nHighlightColor = 0x008080; break; //dark cyan
     494             :             case 11: nHighlightColor = 0x008000; break; //dark green
     495             :             case 12: nHighlightColor = 0x800080; break; //dark magenta
     496             :             case 13: nHighlightColor = 0x800000; break; //dark red
     497             :             case 14: nHighlightColor = 0x808000; break; //dark yellow
     498             :             case 15: nHighlightColor = 0x808080; break; //dark gray
     499             :             case 16: nHighlightColor = 0xC0C0C0; break; //light gray
     500             :         }
     501             :         CPPUNIT_ASSERT_EQUAL(nHighlightColor, getProperty<sal_Int32>(xRun,"CharHighlight"));
     502             :         CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor"));
     503             :     }
     504             : 
     505             :     // Only highlight
     506             :     {
     507             :         const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,17), uno::UNO_QUERY);
     508             :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0C0C0), getProperty<sal_Int32>(xRun,"CharHighlight"));
     509             :         CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor"));
     510             :     }
     511             : 
     512             :     // Only background
     513             :     {
     514             :         const uno::Reference<beans::XPropertySet> xRun(getRun(xPara,18), uno::UNO_QUERY);
     515             :         CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighlight"));
     516             :         CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), getProperty<sal_Int32>(xRun,"CharBackColor"));
     517             :     }
     518             : }
     519             : */
     520             : 
     521          28 : DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx")
     522             : {
     523             :     // Check no empty font name is exported
     524             :     // This test does not fail, if the document contains a font with empty name.
     525             : 
     526           4 :     xmlDocPtr pXmlFontTable = parseExport("word/fontTable.xml");
     527           4 :     if (!pXmlFontTable)
     528           6 :         return;
     529           2 :     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlFontTable, "/w:fonts/w:font");
     530           2 :     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
     531           2 :     sal_Int32 length = xmlXPathNodeSetGetLength(pXmlNodes);
     532          22 :     for(sal_Int32 index = 0; index < length; index++){
     533          20 :         xmlNodePtr pXmlNode = pXmlNodes->nodeTab[index];
     534          20 :         OUString attrVal = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST("name")));
     535          20 :          if (attrVal == ""){
     536           0 :             CPPUNIT_FAIL("Font name is empty.");
     537             :         }
     538          20 :     }
     539           2 :     xmlXPathFreeObject(pXmlObj);
     540             : }
     541             : 
     542          28 : DECLARE_OOXMLEXPORT_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
     543             : {
     544             :     // Check for the Column Separator value.It should be FALSE as the document doesnt contains separator line.
     545           4 :     xmlDocPtr pXmlDoc = parseExport();
     546           4 :     if (!pXmlDoc)
     547           6 :         return;
     548           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:sectPr/w:cols","sep","false");
     549             : }
     550             : 
     551          28 : DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx")
     552             : {
     553             :    // The problem was that item[n].xml and itemProps[n].xml and .rels files for item[n].xml
     554             :    // files were missing from docx file after saving file.
     555             :    // This test case tests whether customxml files grabbagged properly in correct object.
     556             : 
     557           4 :    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     558           8 :    uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
     559           8 :    uno::Sequence<beans::PropertyValue> aGrabBag(0);
     560           4 :    xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
     561           4 :    CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
     562           4 :    bool CustomXml = false;
     563          52 :    for(int i = 0; i < aGrabBag.getLength(); ++i)
     564             :    {
     565          48 :        if (aGrabBag[i].Name == "OOXCustomXml" || aGrabBag[i].Name == "OOXCustomXmlProps")
     566             :        {
     567           8 :            CustomXml = true;
     568           8 :            uno::Reference<xml::dom::XDocument> aCustomXmlDom;
     569          16 :            uno::Sequence<uno::Reference<xml::dom::XDocument> > aCustomXmlDomList;
     570           8 :            CPPUNIT_ASSERT(aGrabBag[i].Value >>= aCustomXmlDomList); // PropertyValue of proper type
     571           8 :            sal_Int32 length = aCustomXmlDomList.getLength();
     572           8 :            CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length);
     573           8 :            aCustomXmlDom = aCustomXmlDomList[0];
     574          16 :            CPPUNIT_ASSERT(aCustomXmlDom.get()); // Reference not empty
     575             :        }
     576             :    }
     577           8 :    CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements
     578           4 : }
     579             : 
     580          28 : DECLARE_OOXMLEXPORT_TEST(testActiveXGrabBag, "activex.docx")
     581             : {
     582             :    // The problem was that activeX.xml files were missing from docx file after saving file.
     583             :    // This test case tests whether activex files grabbagged properly in correct object.
     584             : 
     585           4 :    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     586           8 :    uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
     587           8 :    uno::Sequence<beans::PropertyValue> aGrabBag(0);
     588           4 :    xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
     589           4 :    CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
     590           4 :    bool bActiveX = false;
     591          52 :    for(int i = 0; i < aGrabBag.getLength(); ++i)
     592             :    {
     593          48 :        if (aGrabBag[i].Name == "OOXActiveX")
     594             :        {
     595           4 :            bActiveX = true;
     596           4 :            uno::Reference<xml::dom::XDocument> aActiveXDom;
     597           8 :            uno::Sequence<uno::Reference<xml::dom::XDocument> > aActiveXDomList;
     598           4 :            CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXDomList); // PropertyValue of proper type
     599           4 :            sal_Int32 length = aActiveXDomList.getLength();
     600           4 :            CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length);
     601           4 :            aActiveXDom = aActiveXDomList[0];
     602           8 :            CPPUNIT_ASSERT(aActiveXDom.get()); // Reference not empty
     603             :        }
     604             :    }
     605           8 :    CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements
     606           4 : }
     607             : 
     608          28 : DECLARE_OOXMLEXPORT_TEST(testActiveXBinGrabBag, "activexbin.docx")
     609             : {
     610             :    // The problem was that activeX.bin files were missing from docx file after saving file.
     611             :    // This test case tests whether activex bin files grabbagged properly in correct object.
     612             : 
     613           4 :    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     614           8 :    uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY);
     615           8 :    uno::Sequence<beans::PropertyValue> aGrabBag(0);
     616           4 :    xTextDocumentPropertySet->getPropertyValue(OUString("InteropGrabBag")) >>= aGrabBag;
     617           4 :    CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
     618           4 :    bool bActiveX = false;
     619          52 :    for(int i = 0; i < aGrabBag.getLength(); ++i)
     620             :    {
     621          48 :        if (aGrabBag[i].Name == "OOXActiveXBin")
     622             :        {
     623           4 :            bActiveX = true;
     624           4 :            uno::Reference<io::XInputStream> aActiveXBin;
     625           8 :            uno::Sequence<uno::Reference<io::XInputStream> > aActiveXBinList;
     626           4 :            CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXBinList); // PropertyValue of proper type
     627           4 :            sal_Int32 length = aActiveXBinList.getLength();
     628           4 :            CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length);
     629           4 :            aActiveXBin = aActiveXBinList[0];
     630           8 :            CPPUNIT_ASSERT(aActiveXBin.get()); // Reference not empty
     631             :        }
     632             :    }
     633           8 :    CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements
     634           4 : }
     635             : 
     636          28 : DECLARE_OOXMLEXPORT_TEST(testFdo69644, "fdo69644.docx")
     637             : {
     638             :     // The problem was that the exporter exported the table definition
     639             :     // with only 3 columns, instead of 5 columns.
     640             :     // Check that the table grid is exported with 5 columns
     641           4 :     xmlDocPtr pXmlDoc = parseExport();
     642           4 :     if (!pXmlDoc)
     643           6 :         return;
     644           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 5);
     645             : }
     646             : 
     647          28 : DECLARE_OOXMLEXPORT_TEST(testFdo70812, "fdo70812.docx")
     648             : {
     649             :     // Import just crashed.
     650           4 :     getParagraph(1, "Sample pages document.");
     651           4 : }
     652             : 
     653          28 : DECLARE_OOXMLEXPORT_TEST(testPgMargin, "testPgMargin.docx")
     654             : {
     655           4 :     xmlDocPtr pXmlDoc = parseExport();
     656           4 :     if (!pXmlDoc)
     657           6 :         return;
     658           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "left", "1440");
     659             : }
     660             : 
     661          26 : DECLARE_OOXMLEXPORT_TEST(testImageCrop, "ImageCrop.docx")
     662             : {
     663           2 :     uno::Reference<drawing::XShape> image = getShape(1);
     664           4 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     665           2 :     ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
     666             : 
     667           2 :     imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
     668             : 
     669           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2955 ), aGraphicCropStruct.Left );
     670           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 5477 ), aGraphicCropStruct.Right );
     671           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2856 ), aGraphicCropStruct.Top );
     672             :     // FIXME import test is disabled (we only check after import-export-import)
     673             :     // The reason is that after import this is 2291 -- rounding error?
     674           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 2290 ), aGraphicCropStruct.Bottom );
     675           2 : }
     676             : 
     677          28 : DECLARE_OOXMLEXPORT_TEST(testLineSpacingexport, "test_line_spacing.docx")
     678             : {
     679             :      // The Problem was that the w:line attribute value in w:spacing tag was incorrect
     680           4 :     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     681           8 :     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
     682           8 :     uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
     683           8 :     CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
     684             : 
     685             :     // FIXME The test passes on most machines (including Linux x86_64 with gcc-4.7), but fails on various configs:
     686             :     // Linux arm, Linux x86_64 with gcc-4.8 and Mac. Need to figure out what goes wrong and fix that.
     687             : #if 0
     688             :     style::LineSpacing alineSpacing = getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing");
     689             :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(13200), static_cast<sal_Int16>(alineSpacing.Height));
     690             :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     691             :     if (!pXmlDoc)
     692             :         return;
     693             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "line", "31680");
     694             : #endif
     695           4 : }
     696             : 
     697          28 : DECLARE_OOXMLEXPORT_TEST(testTextBoxGradientAngle, "fdo65295.docx")
     698             : {
     699           4 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     700           8 :     uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     701           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndexAccess->getCount());
     702             : 
     703             :     // Angle of frame#1 is 135 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     704           8 :     uno::Reference<beans::XPropertySet> xFrame1(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     705           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame1, "FillStyle"));
     706           4 :     awt::Gradient aGradient1 = getProperty<awt::Gradient>(xFrame1, "FillGradient");
     707           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(135 * 10), aGradient1.Angle);
     708             : 
     709             :     // Angle of frame#2 is 180 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     710           8 :     uno::Reference<beans::XPropertySet> xFrame2(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
     711           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame2, "FillStyle"));
     712           4 :     awt::Gradient aGradient2 = getProperty<awt::Gradient>(xFrame2, "FillGradient");
     713           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(180 * 10), aGradient2.Angle);
     714             : 
     715             :     // Angle of frame#3 is  90 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     716           8 :     uno::Reference<beans::XPropertySet> xFrame3(xIndexAccess->getByIndex(2), uno::UNO_QUERY);
     717           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame3, "FillStyle"));
     718           4 :     awt::Gradient aGradient3 = getProperty<awt::Gradient>(xFrame3, "FillGradient");
     719           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16( 90 * 10), aGradient3.Angle);
     720             : 
     721             :     // Angle of frame#4 is 225 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     722           8 :     uno::Reference<beans::XPropertySet> xFrame4(xIndexAccess->getByIndex(3), uno::UNO_QUERY);
     723           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame4, "FillStyle"));
     724           4 :     awt::Gradient aGradient4 = getProperty<awt::Gradient>(xFrame4, "FillGradient");
     725           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(225 * 10), aGradient4.Angle);
     726             : 
     727             :     // Angle of frame#5 is 270 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     728           8 :     uno::Reference<beans::XPropertySet> xFrame5(xIndexAccess->getByIndex(4), uno::UNO_QUERY);
     729           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame5, "FillStyle"));
     730           4 :     awt::Gradient aGradient5 = getProperty<awt::Gradient>(xFrame5, "FillGradient");
     731           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(270 * 10), aGradient5.Angle);
     732             : 
     733             :     // Angle of frame#6 is 315 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     734           8 :     uno::Reference<beans::XPropertySet> xFrame6(xIndexAccess->getByIndex(5), uno::UNO_QUERY);
     735           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame6, "FillStyle"));
     736           4 :     awt::Gradient aGradient6 = getProperty<awt::Gradient>(xFrame6, "FillGradient");
     737           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(315 * 10), aGradient6.Angle);
     738             : 
     739             :     // Angle of frame#7 is   0 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     740           8 :     uno::Reference<beans::XPropertySet> xFrame7(xIndexAccess->getByIndex(6), uno::UNO_QUERY);
     741           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame7, "FillStyle"));
     742           4 :     awt::Gradient aGradient7 = getProperty<awt::Gradient>(xFrame7, "FillGradient");
     743           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(  0 * 10), aGradient7.Angle);
     744             : 
     745             :     // Angle of frame#8 is  45 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree
     746           8 :     uno::Reference<beans::XPropertySet> xFrame8(xIndexAccess->getByIndex(7), uno::UNO_QUERY);
     747           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame8, "FillStyle"));
     748           4 :     awt::Gradient aGradient8 = getProperty<awt::Gradient>(xFrame8, "FillGradient");
     749           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int16( 45 * 10), aGradient8.Angle);
     750           4 : }
     751             : 
     752          28 : DECLARE_OOXMLEXPORT_TEST(testCellGridSpan, "cell-grid-span.docx")
     753             : {
     754             :     // The problem was during export gridSpan value for 1st & 2nd cells for test document
     755             :     // used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation
     756             :     // Varifying gridSpan element is not present in RoundTriped Document (As it's Default value is 1).
     757           4 :     xmlDocPtr pXmlDoc = parseExport();
     758           4 :     if (!pXmlDoc)
     759           6 :         return;
     760           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0);
     761           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0);
     762             : }
     763          28 : DECLARE_OOXMLEXPORT_TEST(testFdo71646, "fdo71646.docx")
     764             : {
     765             :     // The problem was after save file created by MS the direction changed to RTL.
     766           4 :     uno::Reference<uno::XInterface> xParaLTRLeft(getParagraph( 1, "LTR LEFT"));
     767           4 :     sal_Int32 nLTRLeft = getProperty< sal_Int32 >( xParaLTRLeft, "ParaAdjust" );
     768             :     // test the text Direction value for the pragraph
     769           4 :     sal_Int16 nLRDir  = getProperty< sal_Int32 >( xParaLTRLeft, "WritingMode" );
     770             : 
     771             :     // this will test the both the text direction and alignment for paragraph
     772           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nLTRLeft);
     773           4 :     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir);
     774           4 : }
     775             : 
     776          28 : DECLARE_OOXMLEXPORT_TEST(testParaAutoSpacing, "para-auto-spacing.docx")
     777             : {
     778           4 :     xmlDocPtr pXmlDoc = parseExport();
     779           4 :     if (!pXmlDoc)
     780           6 :         return;
     781           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing","1");
     782           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "afterAutospacing","1");
     783             : 
     784           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "beforeAutospacing","");
     785           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "afterAutospacing","");
     786           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "before","400");
     787           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", "after","400");
     788             : }
     789             : 
     790          26 : DECLARE_OOXMLEXPORT_TEST(testGIFImageCrop, "test_GIF_ImageCrop.docx")
     791             : {
     792             :     // FIXME why does this fail on Mac?
     793             : #if !defined(MACOSX)
     794           2 :     uno::Reference<drawing::XShape> image = getShape(1);
     795           4 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     796           2 :     ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
     797             : 
     798           2 :     imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
     799             : 
     800             :     // FIXME import test is disabled (we only check after import-export-import)
     801             :     // The reason is that after import this is 1171 -- why?
     802           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1265 ), aGraphicCropStruct.Left );
     803           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 4256 ), aGraphicCropStruct.Right );
     804           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1109 ), aGraphicCropStruct.Top );
     805           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1448 ), aGraphicCropStruct.Bottom );
     806             : #endif
     807           2 : }
     808             : 
     809          26 : DECLARE_OOXMLEXPORT_TEST(testPNGImageCrop, "test_PNG_ImageCrop.docx")
     810             : {
     811             :     // FIXME why does this fail on Mac?
     812             : #if !defined(MACOSX)
     813             :     /* The problem was image cropping information was not getting saved
     814             :      * after roundtrip.
     815             :      * Check for presenece of cropping parameters in exported file.
     816             :      */
     817           2 :     uno::Reference<drawing::XShape> image = getShape(1);
     818           4 :     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     819           2 :     ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
     820             : 
     821           2 :     imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
     822             : 
     823             :     // FIXME import test is disabled (we only check after import-export-import)
     824             :     // The reason is that after import this is 1141 -- why?
     825           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1231 ), aGraphicCropStruct.Left );
     826           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1295 ), aGraphicCropStruct.Right );
     827           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1358 ), aGraphicCropStruct.Top );
     828           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 737 ), aGraphicCropStruct.Bottom );
     829             : #endif
     830           2 : }
     831             : 
     832          28 : DECLARE_OOXMLEXPORT_TEST(testFootnoteParagraphTag, "testFootnote.docx")
     833             : {
     834             :     /* In footnotes.xml, the paragraph tag inside <w:footnote w:id="2"> was getting written into document.xml.
     835             :      * Check for, paragraph tag is correctly written into footnotes.xml.
     836             :      */
     837           4 :     xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
     838           4 :     if (!pXmlFootnotes)
     839           6 :         return;
     840           2 :     assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]","id","2");
     841           2 :     assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r/w:rPr/w:rStyle","val","Footnotereference");
     842             : }
     843             : 
     844          28 : DECLARE_OOXMLEXPORT_TEST(testSpacingLineRule,"table_lineRule.docx")
     845             : {
     846           4 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     847           4 :     if (!pXmlDoc)
     848           6 :         return;
     849           2 :      assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "lineRule", "auto");
     850             : }
     851             : 
     852          28 : DECLARE_OOXMLEXPORT_TEST(testTableLineSpacing, "table_atleast.docx")
     853             : {
     854           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     855           4 :     if (!pXmlDoc)
     856           6 :         return;
     857           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:spacing", "line", "320");
     858             : }
     859             : 
     860          28 : DECLARE_OOXMLEXPORT_TEST(testOoxmlTriangle, "ooxml-triangle.docx")
     861             : {
     862             :     // The problem was that ooxml-triangle shape type wasn't handled by VML
     863             :     // export (only isosceles-triangle), leading to a missing shape.
     864           4 :     getShape(1);
     865           4 : }
     866             : 
     867          28 : DECLARE_OOXMLEXPORT_TEST(testMce, "mce.docx")
     868             : {
     869             :     // The shape is red in Word2007, green in Word2010. Check that our import follows the later.
     870           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x9bbb59), getProperty<sal_Int32>(getShape(1), "FillColor"));
     871           4 : }
     872             : 
     873          28 : DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx")
     874             : {
     875             :     // check default font theme values have been preserved
     876           4 :     xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
     877           4 :     if (!pXmlStyles)
     878           4 :         return;
     879           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "asciiTheme", "minorHAnsi");
     880           2 :     assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "cstheme", "minorBidi");
     881             : 
     882             :     // check the font theme values in style definitions
     883           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:rPr/w:rFonts", "eastAsiaTheme", "minorEastAsia");
     884             : 
     885             :     // check the color theme values in style definitions
     886           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeColor", "accent1");
     887           2 :     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeTint", "99");
     888             : 
     889             :     // check direct format font theme values have been preserved
     890           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     891           2 :     if (!pXmlDocument)
     892           0 :         return;
     893           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:r[1]/w:rPr/w:rFonts", "hAnsiTheme", "majorHAnsi");
     894           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:r[1]/w:rPr/w:rFonts", "asciiTheme", "majorHAnsi");
     895             : 
     896             :     // check theme font color value has been preserved
     897           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeColor", "accent3");
     898           2 :     OUString sThemeShade = getXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeShade");
     899           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xbf), sThemeShade.toInt32(16));
     900             : 
     901             :     // check the themeFontLang values in settings file
     902           2 :     xmlDocPtr pXmlSettings = parseExport("word/settings.xml");
     903           2 :     if (!pXmlSettings)
     904           0 :         return;
     905           2 :     assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "val", "en-US");
     906           2 :     assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "eastAsia", "zh-CN");
     907           2 :     assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "bidi", "he-IL");
     908             : 
     909             :     // check fonts have been applied properly
     910             :     sal_Unicode fontName[2]; //represents the string "宋体"
     911           2 :     fontName[0] = 0x5b8b;
     912           2 :     fontName[1] = 0x4f53;
     913           2 :     CPPUNIT_ASSERT_EQUAL(OUString(fontName, 2), getProperty<OUString>(getParagraph(1), "CharFontNameAsian"));
     914           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Arial"),
     915           2 :                          getProperty<OUString>(getParagraph(2), "CharFontNameComplex"));
     916           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Trebuchet MS"),
     917           2 :                          getProperty<OUString>(getParagraph(3, "Default style theme font"), "CharFontName"));
     918           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Arial Black"),
     919           2 :                          getProperty<OUString>(getRun(getParagraph(4, "Direct format font"), 1), "CharFontName"));
     920           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Trebuchet MS"),
     921           2 :                          getProperty<OUString>(getParagraph(5, "Major theme font"), "CharFontName"));
     922             : 
     923             :     // check the paragraph background pattern has been preserved including theme colors
     924           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "val", "thinHorzStripe");
     925           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeFill", "text2");
     926           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeFillTint", "33");
     927           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeColor", "accent1");
     928           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[6]/w:pPr/w:shd", "themeShade", "80");
     929             : }
     930             : 
     931          28 : DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.docx")
     932             : {
     933           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     934           4 :     if (!pXmlDocument)
     935           6 :         return;
     936             : 
     937             :     // check cell theme colors have been preserved
     938           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFill", "accent6");
     939           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillShade", "");
     940           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:shd", "themeFillTint", "33");
     941           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFill", "accent6");
     942           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillShade", "");
     943           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:shd", "themeFillTint", "");
     944           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
     945           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
     946           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
     947           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "val", "horzStripe");
     948           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeColor", "accent3");
     949           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeTint", "33");
     950           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "color", "E7EEEE");
     951             : 
     952             :     // check table style has been preserved
     953           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tblPr/w:tblStyle", "val", "Sombreadoclaro-nfasis1");
     954             :     // check table style is not overwritten by other properties
     955           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/*", 0);
     956           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/*", 0);
     957             :     // check that one cell attribute present in the original document has been preserved
     958           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/*", 1);
     959             : 
     960             :     // Check that w:cnfStyle row, cell and paragraph property is preserved.
     961           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "val", "100000000000");
     962           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstRow", "1");
     963           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastRow", "0");
     964           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstColumn", "0");
     965           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastColumn", "0");
     966             : 
     967           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "val", "001000000000");
     968           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddVBand", "0");
     969           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenVBand", "0");
     970           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddHBand", "0");
     971           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenHBand", "0");
     972             : 
     973           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "val", "100000000000");
     974           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowFirstColumn", "0");
     975           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowLastColumn", "0");
     976           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowFirstColumn", "0");
     977           2 :     assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowLastColumn", "0");
     978             : 
     979             : }
     980             : 
     981          28 : DECLARE_OOXMLEXPORT_TEST(testcantSplit, "2_table_doc.docx")
     982             : {
     983             :     // if Split table value is true for a table then during export do not write <w:cantSplit w:val="false"/>
     984             :     // in table row property,As default row prop is allow row to break across page.
     985             :     // writing <w:cantSplit w:val="false"/> during export was causing problem that all the cell data used to come on same page
     986           4 :     xmlDocPtr pXmlDoc = parseExport();
     987           4 :     if (!pXmlDoc)
     988           6 :         return;
     989           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:cantSplit",0);
     990           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit","val","true");
     991             : }
     992             : 
     993          28 : DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx")
     994             : {
     995             :     // There was a problem for some documents during export.Invalid sectPr getting added
     996             :     // because of faulty calculation of PageDesc value
     997             :     // This was the reason for increasing number of pages after RT
     998           4 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     999           8 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
    1000           8 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
    1001           4 :     xCursor->jumpToLastPage();
    1002           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
    1003           4 : }
    1004             : 
    1005          28 : DECLARE_OOXMLEXPORT_TEST(testcolumnbreak, "columnbreak.docx")
    1006             : {
    1007           4 :     CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(5, "This is first line after col brk."), "BreakType"));
    1008           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1009           4 :     if (!pXmlDoc)
    1010           6 :         return;
    1011           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:br", "type", "column");
    1012             : }
    1013             : 
    1014          28 : DECLARE_OOXMLEXPORT_TEST(testGlossary, "testGlossary.docx")
    1015             : {
    1016           4 :     xmlDocPtr pXmlDoc = parseExport("word/glossary/document.xml");
    1017           4 :     if (!pXmlDoc)
    1018           6 :         return;
    1019           2 :     assertXPath(pXmlDoc, "/w:glossaryDocument", "Ignorable", "w14 wp14");
    1020             : }
    1021             : 
    1022          28 : DECLARE_OOXMLEXPORT_TEST(testFdo71785, "fdo71785.docx")
    1023             : {
    1024             :     // crashtest
    1025           4 : }
    1026             : 
    1027          28 : DECLARE_OOXMLEXPORT_TEST(testCrashWhileSave, "testCrashWhileSave.docx")
    1028             : {
    1029           4 :     xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
    1030           4 :     if (!pXmlDoc)
    1031           6 :         return;
    1032           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:ftr/w:tbl/w:tr/w:tc[1]/w:p[1]/w:pPr/w:pStyle", "val").match("Normal"));
    1033             : }
    1034             : 
    1035          28 : DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx")
    1036             : {
    1037             :      // Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice
    1038           4 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1039           4 :      if (!pXmlDoc)
    1040           6 :          return;
    1041           2 :       assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal");
    1042             : }
    1043             : 
    1044             : #endif
    1045             : 
    1046           8 : CPPUNIT_PLUGIN_IMPLEMENT();
    1047             : 
    1048             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10