LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlexport - ooxmlexport4.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 400 401 99.8 %
Date: 2014-11-03 Functions: 537 598 89.8 %
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         236 : class Test : public SwModelTestBase
      56             : {
      57             : public:
      58         236 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
      59             : 
      60             : protected:
      61             :     /**
      62             :      * Blacklist handling
      63             :      */
      64         118 :     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         118 :         };
      72         118 :         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         118 :         return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end());
      76             :     }
      77             : };
      78             : 
      79          28 : DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx")
      80             : {
      81           4 :     uno::Reference<drawing::XShape> xShape = getShape(1);
      82             :     // This was text::RelOrientation::FRAME, when handling relativeFrom=page, align=right
      83           4 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_RIGHT, getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
      84             : 
      85           8 :     uno::Reference<drawing::XShapes> xGroup(xShape, uno::UNO_QUERY);
      86             :     // This resulted in lang::IndexOutOfBoundsException, as nested groupshapes weren't handled.
      87           8 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(0), uno::UNO_QUERY);
      88           4 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
      89             : 
      90             :     // Right after import we get a rounding error: 8662 vs 8664.
      91           4 :     if (mbExported)
      92             :     {
      93           2 :         uno::Reference<drawing::XShape> xYear(xGroup->getByIndex(1), uno::UNO_QUERY);
      94             :         // This was 2, due to incorrect handling of parent transformations inside DML groupshapes.
      95           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(8664), xYear->getSize().Width);
      96           4 :     }
      97           4 : }
      98             : 
      99          26 : DECLARE_OOXMLEXPORT_TEST(testBezier, "bezier.odt")
     100             : {
     101           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     102           4 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     103             :     // Check that no shape got lost: a bezier, a line and a text shape.
     104           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDraws->getCount());
     105           2 : }
     106             : 
     107          28 : DECLARE_OOXMLEXPORT_TEST(testGroupshapeTextbox, "groupshape-textbox.docx")
     108             : {
     109           4 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
     110           8 :     uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
     111             :     // The VML export lost text on textboxes inside groupshapes.
     112             :     // The DML export does not, make sure it stays that way.
     113           4 :     CPPUNIT_ASSERT_EQUAL(OUString("first"), xShape->getString());
     114             :     // This was 16, i.e. inheriting doc default char height didn't work.
     115           8 :     CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xShape, "CharHeight"));
     116           4 : }
     117             : 
     118          28 : DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx")
     119             : {
     120             :     // Picture in the groupshape got lost, groupshape had only one child.
     121           4 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
     122           8 :     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(1), uno::UNO_QUERY);
     123           8 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GraphicObjectShape"), xShapeDescriptor->getShapeType());
     124           4 : }
     125             : 
     126          28 : DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx")
     127             : {
     128           4 :     CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "TextAutoGrowHeight")));
     129           4 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "TextAutoGrowHeight")));
     130           4 : }
     131             : 
     132          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
     133             : {
     134           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     135           4 :     if (!pXmlDoc)
     136           6 :         return;
     137           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del");
     138             : }
     139             : 
     140          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesInsertedParagraphMark, "testTrackChangesInsertedParagraphMark.docx")
     141             : {
     142           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     143           4 :     if (!pXmlDoc)
     144           6 :         return;
     145           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:ins");
     146             : }
     147             : 
     148          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedTableRow, "testTrackChangesDeletedTableRow.docx")
     149             : {
     150           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     151           4 :     if (!pXmlDoc)
     152           6 :         return;
     153           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:del");
     154             : }
     155             : 
     156          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesInsertedTableRow, "testTrackChangesInsertedTableRow.docx")
     157             : {
     158           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     159           4 :     if (!pXmlDoc)
     160           6 :         return;
     161           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:ins");
     162             : }
     163             : 
     164          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedTableCell, "testTrackChangesDeletedTableCell.docx")
     165             : {
     166           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     167           4 :     if (!pXmlDoc)
     168           6 :         return;
     169           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellDel");
     170             : }
     171             : 
     172          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesInsertedTableCell, "testTrackChangesInsertedTableCell.docx")
     173             : {
     174           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     175           4 :     if (!pXmlDoc)
     176           6 :         return;
     177           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellIns");
     178             : }
     179             : 
     180          28 : DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, "textbox_picturefill.docx")
     181             : {
     182           4 :     uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
     183           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
     184           4 :     CPPUNIT_ASSERT(!(getProperty<OUString>(xFrame,"FillBitmapURL")).isEmpty());
     185           4 : }
     186             : 
     187          28 : DECLARE_OOXMLEXPORT_TEST(testFDO73034, "FDO73034.docx")
     188             : {
     189           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     190           4 :     if (!pXmlDoc)
     191           6 :         return;
     192           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:u", "val").match("single"));
     193             : }
     194             : 
     195          28 : DECLARE_OOXMLEXPORT_TEST(testFDO71834, "fdo71834.docx")
     196             : {
     197           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     198           4 :     if (!pXmlDoc)
     199           6 :         return;
     200           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa");
     201             : }
     202             : 
     203          28 : DECLARE_OOXMLEXPORT_TEST(testTrackChangesParagraphProperties, "testTrackChangesParagraphProperties.docx")
     204             : {
     205           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     206           4 :     if (!pXmlDoc)
     207           6 :         return;
     208           2 :     assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0);
     209             : }
     210             : 
     211          28 : DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx")
     212             : {
     213           4 :     if (!mbExported)
     214           6 :         return;
     215             : 
     216           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     217           4 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xGroup->getByIndex(0), "CustomShapeGeometry");
     218           4 :     OUString aType;
     219          22 :     for (int i = 0; i < aProps.getLength(); ++i)
     220          20 :         if (aProps[i].Name == "Type")
     221           2 :             aType = aProps[i].Value.get<OUString>();
     222             :     // This was exported as borderCallout90, which is an invalid drawingML preset shape string.
     223           4 :     CPPUNIT_ASSERT_EQUAL(OUString("ooxml-borderCallout1"), aType);
     224             : }
     225             : 
     226          28 : DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx")
     227             : {
     228           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     229           4 :     if (!pXmlDocument)
     230           6 :         return;
     231             :     // This was wrap="none".
     232           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:rFonts");
     233             : }
     234             : 
     235          28 : DECLARE_OOXMLEXPORT_TEST(testPageRelSize, "pagerelsize.docx")
     236             : {
     237             :     // First shape: width is relative from page, but not height.
     238           4 :     uno::Reference<drawing::XShape> xShape = getShape(1);
     239           4 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
     240           4 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
     241             : 
     242             :     // Second shape: height is relative from page, but not height.
     243           4 :     xShape = getShape(2);
     244           4 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "RelativeHeightRelation"));
     245           4 :     CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xShape, "RelativeWidthRelation"));
     246           4 : }
     247             : 
     248          28 : DECLARE_OOXMLEXPORT_TEST(testRelSizeRound, "rel-size-round.docx")
     249             : {
     250             :     // This was 9: 9.8 was imported as 9 instead of being rounded to 10.
     251           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(10), getProperty<sal_Int16>(getShape(1), "RelativeHeight"));
     252           4 : }
     253             : 
     254          28 : DECLARE_OOXMLEXPORT_TEST(testTestTitlePage, "testTitlePage.docx")
     255             : {
     256           4 :     CPPUNIT_ASSERT_EQUAL(OUString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), parseDump("/root/page[2]/footer/txt/text()"));
     257           4 : }
     258             : 
     259          28 : DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displayed-twice.docx")
     260             : {
     261             :     // fdo#73534: There was a problem for some documents during export.Invalid sectPr getting added
     262             :     // because of wrong condition in code.
     263             :     // This was the reason for increasing number of pages after RT
     264           4 :     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
     265           8 :     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     266           8 :     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     267           4 :     xCursor->jumpToLastPage();
     268           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
     269           4 : }
     270             : 
     271          28 : DECLARE_OOXMLEXPORT_TEST(testFdo73556,"fdo73556.docx")
     272             : {
     273             :     /*
     274             :     *  The file contains a table with 3 columns
     275             :     *  the girdcols are as follows: {1210, 1331, 1210}
     276             :     *  whereas the individual cells have {1210, 400, 1210}
     277             :     *  The table column separators were taken from the Grid, while
     278             :     *  the table width was calculated as 2820 from cells instead
     279             :     *  of 3751 from the Grid.
     280             :     */
     281           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     282           4 :     if (!pXmlDoc)
     283           6 :         return;
     284           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 3);
     285           2 :     sal_Int32 tableWidth = 0;
     286           2 :     tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[1]", "w").toInt32();
     287           2 :     tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32();
     288           2 :     tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[3]", "w").toInt32();
     289           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3751), tableWidth);
     290             : }
     291             : 
     292          28 : DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx")
     293             : {
     294             :     // fdo#74499
     295           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     296           4 :     if (!pXmlDoc)
     297           6 :         return;
     298           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").match("6138"));
     299             : }
     300             : 
     301          28 : DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.docx")
     302             : {
     303             :     // Changed the UT to check "dxa" instead of "auto"
     304             :     // For this particular issue file few cells have width type "auto"
     305             :     // LO supports VARIABLE and FIXED width type.
     306             :     // If type is VARIABLE LO calculates width as percent of PageSize
     307             :     // Else if the width is fixed it uses the width value.
     308             :     // After changes for fdo76741 the fixed width is exported as "dxa" for DOCX
     309             : 
     310             :     // Check for the width type of table and its cells.
     311           4 :     xmlDocPtr pXmlDoc = parseExport();
     312           4 :     if (!pXmlDoc)
     313           6 :         return;
     314           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","dxa");
     315             : }
     316             : 
     317          28 : DECLARE_OOXMLEXPORT_TEST(testFdo76741, "fdo76741.docx")
     318             : {
     319             : 
     320             :      // There are two issue related to table in the saved(exported) file
     321             :      // - the table alignment in saved file is "left" instead of "center"
     322             :      // - the table width type in properties is "auto" instead of "dxa"
     323             : 
     324           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     325             : 
     326           4 :     if (!pXmlDoc)
     327           6 :        return;
     328           2 :     assertXPath(pXmlDoc, "//w:jc", "val", "center");
     329           2 :     assertXPath(pXmlDoc, "//w:tblW", "w", "10081");
     330           2 :     assertXPath(pXmlDoc, "//w:tblW", "type", "dxa");
     331             : }
     332             : 
     333          28 : DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
     334             : {
     335             :     // fdo#73541: The mirrored margins were not imported and mapped correctly in Page Layout
     336             :     // Hence <w:mirrorMargins /> tag was not exported back in settings.xml
     337           4 :     xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
     338           4 :     if (!pXmlDoc)
     339           6 :         return;
     340           2 :     assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
     341             : }
     342             : 
     343          28 : DECLARE_OOXMLEXPORT_TEST(testFDO74106, "FDO74106.docx")
     344             : {
     345           4 :     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
     346           4 :     if (!pXmlDoc)
     347           6 :         return;
     348           2 :     assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val","hebrew1");
     349             : }
     350             : 
     351          28 : DECLARE_OOXMLEXPORT_TEST(testFDO74215, "FDO74215.docx")
     352             : {
     353           4 :     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
     354           4 :     if (!pXmlDoc)
     355           6 :         return;
     356           2 :     assertXPath(pXmlDoc, "/w:numbering/w:numPicBullet[2]/w:pict/v:shape", "style", "width:6.4pt;height:6.4pt");
     357             : }
     358             : 
     359          28 : DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
     360             : {
     361             :     /* fdo73545: Column Break with Column_count = 0 was not getting preserved.
     362             :      * The <w:br w:type="column" /> was missing after roundtrip
     363             :      */
     364           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     365           4 :     if (!pXmlDoc)
     366           6 :         return;
     367           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
     368             : }
     369             : 
     370          28 : DECLARE_OOXMLEXPORT_TEST(testIndentation, "test_indentation.docx")
     371             : {
     372             :     // fdo#74141 :There was a problem that in style.xml and document.xml in <w:ind> tag "right" & "left" margin
     373             :     // attributes gets added(w:right=0 & w:left=0) if these attributes are not set in original document.
     374             :     // This test is to verify <w:ind> does not contain w:right attribute.
     375           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     376           4 :     if (!pXmlDoc)
     377           6 :         return;
     378           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:ind", "end", "");
     379             : }
     380             : 
     381          28 : DECLARE_OOXMLEXPORT_TEST(testChartInFooter, "chart-in-footer.docx")
     382             : {
     383             :     // fdo#73872: document contains chart in footer.
     384             :     // The problem was that  footer1.xml.rels files for footer1.xml
     385             :     // files were missing from docx file after roundtrip.
     386           4 :     xmlDocPtr pXmlDoc = parseExport("word/_rels/footer1.xml.rels");
     387           4 :     if(!pXmlDoc)
     388           6 :         return;
     389             : 
     390             :     // Check footer1.xml.rels contains in doc after roundtrip.
     391             :     // Check Id = rId1 in footer1.xml.rels
     392           2 :     assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship","Id","rId1");
     393             : 
     394           2 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     395           2 :     if (xDrawPageSupplier.is())
     396             :     {
     397             :         // If xDrawPage->getCount()==1, then document conatins one shape.
     398           2 :         uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     399           2 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); // One shape in the doc
     400           2 :     }
     401             : }
     402             : 
     403          26 : DECLARE_OOXMLEXPORT_TEST(testNestedTextFrames, "nested-text-frames.odt")
     404             : {
     405             :     // First problem was LO crashed during export (crash test)
     406             : 
     407             :     // Second problem was LO made file corruption, writing out nested text boxes, which can't be handled by Word.
     408             :     // Test that all three exported text boxes are anchored to the same paragraph and not each other.
     409           2 :     uno::Reference<text::XTextContent> xTextContent(getShape(1), uno::UNO_QUERY);
     410           4 :     uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
     411           4 :     uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
     412           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString());
     413             : 
     414           2 :     xTextContent.set(getShape(2), uno::UNO_QUERY);
     415           2 :     xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY);
     416           2 :     xText.set(xRange->getText(), uno::UNO_QUERY);
     417           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString());
     418             : 
     419           2 :     xTextContent.set(getShape(3), uno::UNO_QUERY);
     420           2 :     xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY);
     421           2 :     xText.set(xRange->getText(), uno::UNO_QUERY);
     422           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString());
     423           2 : }
     424             : 
     425          28 : DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.docx")
     426             : {
     427             :     // Position of shape was wrong, because some conversion was missing.
     428           4 :     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
     429             :     // This was 3295.
     430           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5964), getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
     431             :     // This was 4611.
     432           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
     433           4 : }
     434             : 
     435          28 : DECLARE_OOXMLEXPORT_TEST(testAbi11739, "abi11739.docx")
     436             : {
     437             :     // Validation test: order of elements were wrong.
     438           4 :     xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
     439           4 :     if (!pXmlDoc)
     440           6 :         return;
     441             :     // Order was: uiPriority, link, basedOn.
     442           2 :     CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "basedOn") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link"));
     443           2 :     CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "uiPriority"));
     444             :     // Order was: qFormat, unhideWhenUsed.
     445           2 :     CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[11]", "unhideWhenUsed") < getXPathPosition(pXmlDoc, "/w:styles/w:style[11]", "qFormat"));
     446             : }
     447             : 
     448          28 : DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, "embedded-xlsx.docx")
     449             : {
     450             :     // check there are two objects and they are FrameShapes
     451           4 :     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
     452           6 :     uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
     453           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
     454           4 :     CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(1)->getShapeType());
     455           4 :     CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(2)->getShapeType());
     456             : 
     457             :     // check the objects are present in the exported document.xml
     458           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     459           4 :     if (!pXmlDocument)
     460           6 :         return;
     461           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:object", 2);
     462             : 
     463             :     // finally check the embedded files are present in the zipped document
     464           4 :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     465           4 :     uno::Sequence<OUString> names = xNameAccess->getElementNames();
     466           2 :     int nSheetFiles = 0;
     467           2 :     int nImageFiles = 0;
     468          32 :     for (int i=0; i<names.getLength(); i++)
     469             :     {
     470          30 :         if(names[i].startsWith("word/embeddings/oleObject"))
     471           4 :             nSheetFiles++;
     472          30 :         if(names[i].startsWith("word/media/image"))
     473           4 :             nImageFiles++;
     474             :     }
     475           2 :     CPPUNIT_ASSERT_EQUAL(2, nSheetFiles);
     476           4 :     CPPUNIT_ASSERT_EQUAL(2, nImageFiles);
     477             : }
     478             : 
     479          28 : DECLARE_OOXMLEXPORT_TEST(testNumberedLists_StartingWithZero, "FDO74105.docx")
     480             : {
     481             :     /* Issue : Numbered lists Starting with value '0' is not preserved after RT.
     482             :      * In numbering.xml, an XML tag <w:start> is optional. If not mentioned,
     483             :      * the Numbered list should start from 0.
     484             :      * Problem was LO was writing <w:start> for all levels 0-8 with default value "1".
     485             :      */
     486           4 :     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
     487           4 :     if (!pXmlDoc)
     488           6 :       return;
     489             : 
     490             :     // Check that we do _not_ export w:start for <w:lvl w:ilvl="0">.
     491           2 :     assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0);
     492             : }
     493             : 
     494          28 : DECLARE_OOXMLEXPORT_TEST(testPageBreak,"fdo74566.docx")
     495             : {
     496             :     /*  Break to next page was written into wrong paragraph as <w:pageBreakBefore />.
     497             :      *  LO was not preserving Page Break as <w:br w:type="page" />.
     498             :      *  Now after fix , LO writes Page Break as the new paragraph and also
     499             :      *  preserves the xml tag <w:br>.
     500             :      */
     501           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     502           4 :     if (!pXmlDoc)
     503           6 :         return;
     504             : 
     505           2 :     uno::Reference<text::XTextRange> xParagraph2 = getParagraph(2);
     506           4 :     uno::Reference<text::XTextRange> xParagraph4 = getParagraph(4);
     507             : 
     508           2 :     getRun(xParagraph2, 1, "First Page Second Line");
     509           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:br","type","page");
     510           4 :     getRun(xParagraph4, 1, "Second Page First line after Page Break");
     511             : }
     512             : 
     513          28 : DECLARE_OOXMLEXPORT_TEST(testOleObject, "test_ole_object.docx")
     514             : {
     515           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     516           4 :     if (!pXmlDoc)
     517           6 :         return;
     518             : 
     519           2 :      assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/v:shape/v:imagedata", "o:title", "");
     520             : }
     521             : 
     522          28 : DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx")
     523             : {
     524             :     /*
     525             :      * fdo#74792 : The images associated with smart-art data[i].xml
     526             :      * were not preserved on exporting to DOCX format
     527             :      * Added support to grabbag the rels, with associated images.
     528             :      */
     529           4 :     xmlDocPtr pXmlDoc = parseExport("word/diagrams/_rels/data1.xml.rels");
     530           4 :     if(!pXmlDoc)
     531           6 :         return;
     532           2 :     assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship", 4);
     533             :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(
     534           2 :                          comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     535             : 
     536             :     //check that images are also saved
     537           4 :     OUString sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name
     538           4 :     uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( sImageFile ), uno::UNO_QUERY);
     539           4 :     CPPUNIT_ASSERT( xInputStream.is() );
     540             : }
     541             : 
     542          28 : DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx")
     543             : {
     544             :     //in case of multiple smart arts the names for images were getting
     545             :     //repeated and thereby causing a data loss as the binary stream was
     546             :     //getting over written. This test case ensures that unique names are
     547             :     //given for images in different smart arts.
     548           4 :     xmlDocPtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels");
     549           4 :     if( !pXmlDataRels1 )
     550           4 :         return;
     551             : 
     552           2 :     xmlDocPtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels");
     553           2 :     if( !pXmlDataRels2 )
     554           0 :         return;
     555             : 
     556             :     //ensure that the rels file is present.
     557           2 :     assertXPath(pXmlDataRels1,"/rels:Relationships/rels:Relationship", 4);
     558           2 :     assertXPath(pXmlDataRels2,"/rels:Relationships/rels:Relationship", 4);
     559             : 
     560             :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(
     561           2 :                          comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
     562             : 
     563             :     //check that images are also saved
     564           4 :     OUString sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name
     565           4 :     uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( sImageFile1 ), uno::UNO_QUERY);
     566           2 :     CPPUNIT_ASSERT( xInputStream1.is() );
     567             : 
     568             :     //check that images are saved for other smart-arts as well.
     569           4 :     OUString sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a uniqe name
     570           4 :     uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( sImageFile2 ), uno::UNO_QUERY);
     571           4 :     CPPUNIT_ASSERT( xInputStream2.is() );
     572             : }
     573             : 
     574          28 : DECLARE_OOXMLEXPORT_TEST(testTableCurruption, "tableCurrupt.docx")
     575             : {
     576           4 :     xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
     577           4 :     if (!pXmlDoc)
     578           6 :         return;
     579           2 :     CPPUNIT_ASSERT(pXmlDoc) ;
     580           2 :     assertXPath(pXmlDoc, "/w:hdr/w:tbl[1]/w:tr[1]/w:tc[1]",1);
     581             : }
     582             : 
     583          28 : DECLARE_OOXMLEXPORT_TEST(testDateControl, "date-control.docx")
     584             : {
     585             :     // check XML
     586           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     587           4 :     if (!pXmlDoc)
     588           6 :         return;
     589           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date", "fullDate", "2014-03-05T00:00:00Z");
     590           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:dateFormat", "val", "dddd, dd' de 'MMMM' de 'yyyy");
     591           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:lid", "val", "es-ES");
     592           2 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "miƩrcoles, 05 de marzo de 2014");
     593             : 
     594             :     // check imported control
     595           2 :     uno::Reference<drawing::XControlShape> xControl(getShape(1), uno::UNO_QUERY);
     596           2 :     util::Date aDate = getProperty<util::Date>(xControl->getControl(), "Date");
     597           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5),    sal_Int32(aDate.Day));
     598           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(3),    sal_Int32(aDate.Month));
     599           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2014), sal_Int32(aDate.Year));
     600             : }
     601             : 
     602          28 : DECLARE_OOXMLEXPORT_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx")
     603             : {
     604           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     605           4 :     if (!pXmlDoc)
     606           6 :         return;
     607             :     // Checking for OpeningBrace tag
     608           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[1]/m:dPr[1]/m:begChr[1]","val","");
     609             : }
     610             : 
     611          28 : DECLARE_OOXMLEXPORT_TEST(testFDO76312, "FDO76312.docx")
     612             : {
     613           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     614           4 :     if (!pXmlDoc)
     615           6 :         return;
     616             : 
     617           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]");
     618             : }
     619             : 
     620          28 : DECLARE_OOXMLEXPORT_TEST(testComboBoxControl, "combobox-control.docx")
     621             : {
     622             :     // check XML
     623           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     624           4 :     if (!pXmlDoc)
     625           6 :         return;
     626           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo");
     627           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito");
     628           2 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo");
     629             : 
     630             :     // check imported control
     631           2 :     uno::Reference<drawing::XControlShape> xControl(getShape(1), uno::UNO_QUERY);
     632             : 
     633           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Manolo"), getProperty<OUString>(xControl->getControl(), "Text"));
     634             : 
     635           4 :     uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(xControl->getControl(), "StringItemList");
     636           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), sal_Int32(aItems.getLength()));
     637           2 :     CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]);
     638           4 :     CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
     639             : }
     640             : 
     641          28 : DECLARE_OOXMLEXPORT_TEST(testCheckBoxControl, "checkbox-control.docx")
     642             : {
     643             :     // check XML
     644           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     645           4 :     if (!pXmlDoc)
     646           6 :         return;
     647           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checked", "val", "1");
     648           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checkedState", "val", "2612");
     649           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:uncheckedState", "val", "2610");
     650             : 
     651             :     // TODO: import control and add a check here
     652             : }
     653             : 
     654          28 : DECLARE_OOXMLEXPORT_TEST(testParagraphWithComments, "paragraphWithComments.docx")
     655             : {
     656             :     /* Comment id's were getting overwritten for annotation mark(s),
     657             :        which was causing a mismatch in the relationship for comment id's
     658             :        in document.xml and comment.xml
     659             :     */
     660           4 :     xmlDocPtr pXmlDoc  = parseExport("word/document.xml");
     661           4 :     xmlDocPtr pXmlComm = parseExport("word/comments.xml");
     662           4 :     if(!pXmlDoc)
     663           6 :         return;
     664             : 
     665           2 :     sal_Int32 idInDocXml     = 0;
     666           2 :     sal_Int32 idInCommentXml = -1; //intentionally assigning -1 so that it differs from idInDocXml
     667             :     //and also because getXpath does not assert.
     668           2 :     idInDocXml     = getXPath(pXmlDoc,"/w:document/w:body/w:p[3]/w:commentRangeEnd[1]","id").toInt32();
     669           2 :     idInCommentXml = getXPath(pXmlComm,"/w:comments/w:comment[1]","id").toInt32();
     670           2 :     CPPUNIT_ASSERT_EQUAL( idInDocXml, idInCommentXml );
     671             : }
     672             : 
     673          28 : DECLARE_OOXMLEXPORT_TEST(testOLEObjectinHeader, "2129393649.docx")
     674             : {
     675             :     // fdo#76015 : Document contains oleobject in header xml.
     676             :     // Problem was relationship entry for oleobject from header was
     677             :     // exported into document.xml.rels file because of this rels file
     678             :     // for headers were missing from document/word/rels.
     679           4 :     xmlDocPtr pXmlDoc = parseExport("word/_rels/header1.xml.rels");
     680           4 :     if(!pXmlDoc)
     681           6 :         return;
     682             : 
     683           2 :     assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship[1]","Id","rId1");
     684             : }
     685             : 
     686          28 : DECLARE_OOXMLEXPORT_TEST(test_ClosingBrace, "2120112713.docx")
     687             : {
     688           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     689           4 :     if (!pXmlDoc)
     690           6 :         return;
     691             :     // Checking for ClosingBrace tag
     692           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[2]/m:dPr[1]/m:endChr[1]","val","");
     693             : }
     694             : 
     695          28 : DECLARE_OOXMLEXPORT_TEST(testlvlPicBulletId, "lvlPicBulletId.docx")
     696             : {
     697           4 :     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
     698           4 :     if (!pXmlDoc)
     699           6 :        return;
     700           2 :     assertXPath(pXmlDoc, "/w:numbering[1]/w:abstractNum[1]/w:lvl[1]/w:lvlPicBulletId[1]", 0);
     701             : }
     702             : 
     703          28 : DECLARE_OOXMLEXPORT_TEST(testSdtContent, "SdtContent.docx")
     704             : {
     705           4 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     706           4 :     if (!pXmlDoc)
     707           6 :        return;
     708           2 :     assertXPath(pXmlDoc, "/w:hdr[1]/w:sdt[1]/w:sdtContent[1]/w:p[1]/w:del[1]");
     709             : }
     710             : 
     711          28 : DECLARE_OOXMLEXPORT_TEST(testFdo76016, "fdo76016.docx")
     712             : {
     713             :     // check XML
     714           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     715           4 :     if (!pXmlDoc)
     716           6 :         return;
     717           2 :     assertXPath(pXmlDoc, "//a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", "name", "adj1");
     718           2 :     assertXPath(pXmlDoc, "//a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", "name", "adj2");
     719             : }
     720             : 
     721          28 : DECLARE_OOXMLEXPORT_TEST(testFileWithInvalidImageLink, "FileWithInvalidImageLink.docx")
     722             : {
     723             :     /* In case if the original file has an image whose link is
     724             :        invalid, then the RT file used to result in corruption
     725             :        since the exported image would be an empty image.
     726             :      */
     727           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     728           4 :     if (!pXmlDoc)
     729           6 :       return;
     730             : 
     731           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]", "embed", "");
     732             : }
     733             : 
     734          28 : DECLARE_OOXMLEXPORT_TEST(testContentTypeDOCX, "fdo80410.docx")
     735             : {
     736           4 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     737             : 
     738           4 :     if (!pXmlDoc) // only test the export, not initial import
     739           6 :        return;
     740             : 
     741             :     assertXPath(pXmlDoc,
     742             :         "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.docx']",
     743             :         "ContentType",
     744           2 :         "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
     745             : }
     746             : 
     747          28 : DECLARE_OOXMLEXPORT_TEST(testContentTypeXLSM, "fdo76098.docx")
     748             : {
     749           4 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     750             : 
     751           4 :     if (!pXmlDoc)
     752           6 :        return;
     753             : 
     754           2 :     assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']", "ContentType", "application/vnd.ms-excel.sheet.macroEnabled.12");
     755             : }
     756             : 
     757          28 : DECLARE_OOXMLEXPORT_TEST(test76108, "test76108.docx")
     758             : {
     759           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     760           8 :     if (!pXmlDoc) return;
     761             :     //docx file after RT is getting corrupted.
     762           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
     763             : }
     764             : 
     765          28 : DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx")
     766             : {
     767             :    // TCTagMisMatch.docx : This document contains a empty table with borders.
     768             :    // there was a TC tag mismatch which resulted into a crash.
     769             : 
     770           4 :    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     771           4 :    if(!pXmlDoc)
     772           6 :       return;
     773           2 :    assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]",0);
     774           2 :    assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]", 1);
     775             : }
     776             : 
     777          28 : DECLARE_OOXMLEXPORT_TEST(testFDO78292, "FDO78292.docx")
     778             : {
     779             :    //text node is a leaf node, it should not have any children
     780           4 :    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     781           4 :    if(!pXmlDoc)
     782           6 :       return;
     783           2 :    assertXPath(pXmlDoc,"/w:document/w:body/w:p[14]/w:sdt[3]/w:sdtPr[1]/w:text/w14:checked",0);
     784             : }
     785             : 
     786          28 : DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, "simple-sdts.docx")
     787             : {
     788           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     789             : 
     790           4 :     if (!pXmlDoc)
     791           6 :        return;
     792             : 
     793           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1);
     794           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3);
     795           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:picture", 1);
     796           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:group", 1);
     797           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:citation", 1);
     798             : 
     799             : }
     800             : 
     801           8 : CPPUNIT_PLUGIN_IMPLEMENT();
     802             : 
     803             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10