LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlexport - ooxmlexport5.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 384 390 98.5 %
Date: 2015-06-13 12:38:46 Functions: 774 840 92.1 %
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         128 : class Test : public SwModelTestBase
      56             : {
      57             : public:
      58         128 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
      59             : 
      60             : protected:
      61             :     /**
      62             :      * Blacklist handling
      63             :      */
      64          64 :     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          64 :         };
      72          64 :         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          64 :         return (OString(filename).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), filename) == vBlacklist.end());
      76             :     }
      77             : };
      78             : 
      79          17 : DECLARE_OOXMLEXPORT_TEST(testFDO76248, "FDO76248.docx")
      80             : {
      81           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      82           2 :     if (!pXmlDoc)
      83           3 :        return;
      84             :     // In two cases the a:graphicData elements had no children, which is invalid.
      85           1 :     assertXPath(pXmlDoc, "//a:graphicData[not(*)]", 0);
      86             : }
      87             : 
      88          17 : DECLARE_OOXMLEXPORT_TEST(testfdo76589 , "fdo76589.docx")
      89             : {
      90             :     /* Numbered list was not preserve after RT.
      91             :      * In numbering.xml, when NumberingType is "decimal" and level is zero,
      92             :      * w:val of w:lvlText was empty.
      93             :      * It should be <w:lvlText w:val="%1" />
      94             :      */
      95           2 :     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
      96           2 :     if (!pXmlDoc)
      97           3 :         return;
      98             : 
      99           1 :     assertXPath ( pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val","%1" );
     100             : }
     101             : 
     102          17 : DECLARE_OOXMLEXPORT_TEST(testDecimalNumberingNoLeveltext, "decimal-numbering-no-leveltext.docx")
     103             : {
     104             :     // This was "%1", not empty: we turned a kind-of-none numbering into a decimal one.
     105           2 :     if (xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"))
     106           1 :         assertXPath (pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val", "");
     107           2 : }
     108             : 
     109          16 : DECLARE_OOXMLEXPORT_TEST(testNoDuplicateAttributeExport, "duplicate-east-asia.odt")
     110             : {
     111             :     // File asserting while saving in LO.
     112           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     113           1 :     if (!pXmlDoc)
     114           0 :         return;
     115             : }
     116             : 
     117          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79008, "fdo79008.docx")
     118             : {
     119             :     /* File crashing while saving in LO.
     120             :      * Check if document.xml file is created after fix
     121             :      */
     122           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     123           2 :     if (!pXmlDoc)
     124           1 :         return;
     125             : }
     126             : 
     127          17 : DECLARE_OOXMLEXPORT_TEST(testAuthorPropertySdt, "author-property.docx")
     128             : {
     129           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     130             : 
     131           2 :     if (!pXmlDoc)
     132           3 :        return;
     133             : 
     134           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:dataBinding", "xpath", "/ns1:coreProperties[1]/ns0:creator[1]");
     135           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:dataBinding", "storeItemID","{6C3C8BC8-F283-45AE-878A-BAB7291924A1}");
     136             :     // FIXME: the next property doesn't match, though it's correct in theory. A bug in assertXPath?
     137             :     // assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:dataBinding", "prefixMappings",
     138             :     //            "xmlns:ns0='http://purl.org/dc/elements/1.1/' xmlns:ns1='http://schemas.openxmlformats.org/package/2006/metadata/core-properties'");
     139             : }
     140             : 
     141          17 : DECLARE_OOXMLEXPORT_TEST(testFDO76586, "fdo76586.docx")
     142             : {
     143             :     /*
     144             :      * In the test file gridCol had only one value for entire table width
     145             :      * while there are two cells in a table row.
     146             :      * So the table was not imported with the correct cell widths
     147             :      */
     148           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     149             : 
     150           2 :     if (!pXmlDoc)
     151           3 :        return;
     152             : 
     153             :     // there is only one table in the test file
     154           1 :     assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[1]", "w", "1601");
     155           1 :     assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[2]", "w", "7843");
     156             : }
     157             : 
     158          17 : DECLARE_OOXMLEXPORT_TEST(testFDO76587 , "fdo76587.docx")
     159             : {
     160           2 :     xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
     161           2 :     if (!pXmlDoc)
     162           3 :         return;
     163           1 :     assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "line", "240");
     164           1 :     assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "lineRule", "auto");
     165             : }
     166             : 
     167          17 : DECLARE_OOXMLEXPORT_TEST(testFDO77890 , "fdo77890.docx")
     168             : {
     169             :     /*
     170             :     Ensure that the page break is preserved i.e it should not be converted to a section break, in case
     171             :     if the different first page is set for the pages in the document.
     172             :     For additional comments pls refer https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2
     173             :     */
     174           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     175           2 :     if (!pXmlDoc)
     176           3 :         return;
     177           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:br", "type", "page");
     178             : }
     179             : 
     180          17 : DECLARE_OOXMLEXPORT_TEST(testNumberedList,"NumberedList.docx")
     181             : {
     182             :     //fdo74150:In document.xml, for pStyle = "NumberedList1", iLvl and numId was not preserved
     183           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     184           2 :     if (!pXmlDoc)
     185           3 :         return;
     186           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:pStyle", "val", "NumberedList1");
     187           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:numPr/w:ilvl","val", "0");
     188           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:numPr/w:numId","val", "0");
     189             : 
     190           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[3]/w:pPr[1]/w:pStyle","val", "NumberedList1");
     191           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[3]/w:pPr[1]/w:numPr/w:ilvl","val", "0");
     192           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[3]/w:pPr[1]/w:numPr/w:numId","val", "0");
     193             : }
     194             : 
     195          17 : DECLARE_OOXMLEXPORT_TEST(testFDO76597, "fdo76597.docx")
     196             : {
     197             :     // check XML
     198           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     199           2 :     if (!pXmlDoc)
     200           3 :         return;
     201           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "before", "96");
     202           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "after", "120");
     203             : }
     204             : 
     205          17 : DECLARE_OOXMLEXPORT_TEST(testContentTypeTIF, "fdo77476.docx")
     206             : {
     207           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     208             : 
     209           2 :     if (!pXmlDoc)
     210           3 :        return;
     211             : 
     212           1 :     assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='image/tif']", "PartName", "/word/media/image1.tif");
     213             : }
     214             : 
     215          17 : DECLARE_OOXMLEXPORT_TEST(testFDO77117, "fdo77117.docx")
     216             : {
     217           2 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
     218           4 :     uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
     219             :     // This checks textbox textrun size of font which is in group shape.
     220           4 :     CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xShape, "CharHeight"));
     221           2 : }
     222             : 
     223          17 : DECLARE_OOXMLEXPORT_TEST(testFloatingTable, "fdo77887.docx")
     224             : {
     225           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     226             : 
     227           2 :     if (!pXmlDoc)
     228           3 :        return;
     229             : 
     230           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "horzAnchor", "margin");
     231           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "leftFromText", "141");
     232           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "rightFromText", "141");
     233           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpXSpec", "center");
     234           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpY", "2266");
     235           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "vertAnchor", "page");
     236             : 
     237             :     //make sure not to write empty attributes which requires enumeration
     238           1 :     assertXPathNoAttribute(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpYSpec");
     239             : }
     240             : 
     241          16 : DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeRight, "tdf90681-1.odt")
     242             : {
     243           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     244             : 
     245           1 :     if (!pXmlDoc)
     246           1 :        return;
     247             : 
     248           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:vMerge", "val", "restart");
     249           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:vMerge", "val", "continue");
     250           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[2]/w:tcPr/w:vMerge", "val", "continue");
     251           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:vMerge", "val", "continue");
     252             : }
     253             : 
     254          16 : DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeleft, "tdf90681-2.odt")
     255             : {
     256           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     257             : 
     258           1 :     if (!pXmlDoc)
     259           1 :        return;
     260             : 
     261           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:vMerge", "val", "restart");
     262           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:vMerge", "val", "continue");
     263             : }
     264             : 
     265          16 : DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeTableInTable, "ooo96040-2.odt")
     266             : {
     267           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     268             : 
     269           1 :     if (!pXmlDoc)
     270           0 :        return;
     271             : }
     272             : 
     273          16 : DECLARE_OOXMLEXPORT_TEST(testHyperlinkContainingPlaceholderField, "hyperlink-field.odt")
     274             : {
     275           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     276             : 
     277           1 :     if (!pXmlDoc)
     278           0 :        return;
     279             : }
     280             : 
     281          17 : DECLARE_OOXMLEXPORT_TEST(testTablePreferredWidth, "tablePreferredWidth.docx")
     282             : {
     283           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     284             : 
     285           2 :     if(!pXmlDoc)
     286           3 :         return;
     287             : 
     288             :     // Problem :If the table preferred width is in percent, then after RT it changes to 0 & width type changes
     289             :     // to 'auto' instead of 'pct'.
     290           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblW[1]", "w", "3000");
     291           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblW[1]", "type","pct");
     292             : }
     293             : 
     294          17 : DECLARE_OOXMLEXPORT_TEST(testFDO75431, "fdo75431.docx")
     295             : {
     296           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     297             : 
     298           2 :     if (!pXmlDoc)
     299           3 :        return;
     300             : 
     301           1 :     assertXPath(pXmlDoc, "//w:tbl", 2);
     302           1 :     assertXPath(pXmlDoc, "//w:p/w:pPr/w:sectPr/w:type", "val", "nextPage");
     303             : }
     304             : 
     305          17 : DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
     306             : {
     307           2 :     xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
     308           2 :     if (!pXmlFootnotes)
     309           3 :         return;
     310             : 
     311           1 :     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0);
     312           1 :     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0);
     313           1 :     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
     314             : }
     315             : 
     316          17 : DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx")
     317             : {
     318             :     /* Additional sectPr was getting inserted and hence Column properties
     319             :      * were getting added into this additional sectPr instead of Default setPr.
     320             :      */
     321           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     322           2 :     if (!pXmlDoc)
     323           3 :         return;
     324             : 
     325             :     // Check no additional section break is inserted.
     326           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0);
     327             : 
     328             :     // Check w:cols comes under Default sectPr
     329           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols", "num", "2");
     330           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", 1);
     331           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", 1);
     332             : }
     333             : 
     334          17 : DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")
     335             : {
     336           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     337             : 
     338           2 :     if (!pXmlDoc)
     339           3 :        return;
     340             : 
     341             :     assertXPath(pXmlDoc,
     342             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']",
     343             :                 "PartName",
     344           1 :                 "/word/embeddings/oleObject1.xlsx");
     345             : }
     346             : 
     347          17 : DECLARE_OOXMLEXPORT_TEST(testfdo78420, "fdo78420.docx")
     348             : {
     349           2 :     xmlDocPtr pXmlHeader = parseExport("word/header2.xml");
     350             : 
     351           2 :     if (!pXmlHeader)
     352           1 :        return;
     353             : 
     354           1 :     xmlDocPtr pXmlHeaderRels = parseExport("word/_rels/header2.xml.rels");
     355           1 :     if(!pXmlHeaderRels)
     356           0 :        return;
     357             : 
     358           1 :     assertXPath(pXmlHeaderRels,"/rels:Relationships/rels:Relationship[1]","Id","rId1");
     359             : }
     360             : 
     361             : 
     362          17 : DECLARE_OOXMLEXPORT_TEST(testPageBreakInFirstPara,"fdo77727.docx")
     363             : {
     364             :     /* Break to next page was not exported if it is in first paragraph of the section.
     365             :      * Now after fix , LO writes Next Page Break and also preserves <w:br> tag.
     366             :      */
     367           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     368           2 :     if (!pXmlDoc)
     369           3 :         return;
     370             : 
     371           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page");
     372             : }
     373             : 
     374          17 : DECLARE_OOXMLEXPORT_TEST(testFDO78284, "fdo78284.docx")
     375             : {
     376           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     377             : 
     378           2 :     if (!pXmlDoc)
     379           3 :         return;
     380             :     assertXPath(pXmlDoc,"/ContentType:Types/ContentType:Override[@PartName='/word/media/OOXDiagramDataRels1_0.png']",
     381             :                         "ContentType",
     382           1 :                         "image/png");
     383             : }
     384             : 
     385          17 : DECLARE_OOXMLEXPORT_TEST(testFDO78384,"fdo78384.docx")
     386             : {
     387           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     388           2 :     if (!pXmlDoc)
     389           3 :         return;
     390           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings");
     391             : }
     392             : 
     393          17 : DECLARE_OOXMLEXPORT_TEST(testfdo78469, "fdo78469.docx")
     394             : {
     395           2 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     396           2 :     if (!pXmlDoc)
     397           3 :        return;
     398             :     // make sure dataBinding & text tags not presernt in sdtcontent
     399           1 :     assertXPath(pXmlDoc, "/w:hdr[1]/w:tbl[1]/w:tr[1]/w:tc[2]/w:p[1]/w:sdt[2]/w:sdtPr[1]/w:dataBinding[1]",0);
     400           1 :     assertXPath(pXmlDoc, "/w:hdr[1]/w:tbl[1]/w:tr[1]/w:tc[2]/w:p[1]/w:sdt[2]/w:sdtPr[1]/w:text[1]",0);
     401             : }
     402             : 
     403          17 : DECLARE_OOXMLEXPORT_TEST(testFDO78887, "fdo78887.docx")
     404             : {
     405           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     406           2 :     if (!pXmlDoc)
     407           3 :         return;
     408             : 
     409           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[1]", 1);
     410           1 :     assertXPathContent(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:t[1]", "Lyrics: ");
     411           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[2]", 1);
     412             : }
     413             : 
     414          17 : DECLARE_OOXMLEXPORT_TEST(testFdo78651, "fdo78651.docx")
     415             : {
     416           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     417             : 
     418           2 :     if (!pXmlDoc)
     419           3 :         return;
     420             :     // ensure that there are only two tables
     421           1 :     assertXPath(pXmlDoc, "//w:tbl", 2);
     422             : }
     423             : 
     424          17 : DECLARE_OOXMLEXPORT_TEST(testfdo78882, "fdo78882.docx")
     425             : {
     426           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     427             : 
     428           2 :     if (!pXmlDoc)
     429           3 :         return;
     430             : 
     431             :     // Ensure that Section Break is getting written inside second paragraph
     432           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[2]/w:pPr[1]/w:sectPr[1]",1);
     433             : 
     434             :     // Ensure that no dummy paragarph gets created inside second paragraph for Section Break
     435           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[2]/w:p[1]/w:pPr[1]/w:sectPr[1]",0);
     436             : }
     437             : 
     438          17 : DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx")
     439             : {
     440             :     /* Issue was, AuoSpacing property if present inside styles.xml, LO was not able to
     441             :      * preserve it.
     442             :      */
     443             : 
     444           2 :     xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
     445             : 
     446           2 :     if (!pXmlDoc)
     447           3 :         return;
     448             : 
     449             :     // Ensure that after fix LO is preserving AutoSpacing property in styles.xml
     450           1 :     assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" );
     451             : }
     452             : 
     453          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx")
     454             : {
     455             :     /* Issue was, <w:drawing> was getting written inside <w:drawing>.
     456             :      * So Postone the writing of Inner Drawing tag.
     457             :      * MS Office does not allow Nestimg of drawing tags.
     458             :      */
     459             : 
     460           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     461             : 
     462           2 :     if (!pXmlDoc)
     463           3 :         return;
     464             : 
     465             :     // Ensure that two separate w:drawing tags are written after the code changes.
     466           1 :     assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing",1);
     467           1 :     assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing",1);
     468             : }
     469             : 
     470          17 : DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
     471             : {
     472           2 :     xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml");
     473           2 :     if (!pXmlFootNotes)
     474           1 :         return;
     475           1 :     assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14");
     476             : 
     477           1 :     xmlDocPtr pXmlEndNotes = parseExport("word/endnotes.xml");
     478           1 :     if (!pXmlEndNotes)
     479           0 :         return;
     480           1 :     assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
     481             : }
     482             : 
     483          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79668,"fdo79668.docx")
     484             : {
     485             :     // fdo#79668: Document was Crashing on DebugUtil build while Saving
     486             :     // because of repeated attribute value in same element.
     487           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     488           2 :     if (!pXmlDoc)
     489           3 :         return;
     490             :     // w:pPr's  w:shd attributes were getting added to w:pPrChange/w:pPr's w:shd hence checking
     491             :     // w:fill for both shd elements
     492           1 :     assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:shd", "fill", "FFFFFF" );
     493           1 :     assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:pPrChange/w:pPr/w:shd", "fill", "FFFFFF" );
     494             : }
     495             : 
     496          17 : DECLARE_OOXMLEXPORT_TEST(testfdo78907,"fdo78907.docx")
     497             : {
     498           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     499           2 :     if (!pXmlDoc)
     500           1 :         return;
     501           1 :     assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page" );
     502             : 
     503           1 :     xmlDocPtr pXmlDoc1 = parseExport("word/footer1.xml");
     504           1 :     if (!pXmlDoc1)
     505           0 :         return;
     506           1 :     assertXPath ( pXmlDoc1, "/w:ftr[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl", 0 );
     507             : }
     508             : 
     509          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79822, "fdo79822.docx")
     510             : {
     511             :     /* File getting crash while saving in LO.
     512             :      * The Docx contain smartart and the file was created in ms word 2007
     513             :      */
     514           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     515           2 :     if (!pXmlDoc)
     516           1 :         return;
     517             : }
     518             : 
     519          17 : DECLARE_OOXMLEXPORT_TEST(testFDO79915, "fdo79915.docx")
     520             : {
     521           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     522           2 :     if (!pXmlDoc)
     523           3 :         return;
     524             : 
     525           1 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[10]/w:t", "How much buoyancy does the water provide?");
     526             : }
     527             : 
     528          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79817, "fdo79817.docx")
     529             : {
     530           2 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     531             :     {
     532           1 :         assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dataBinding", "storeItemID", "{9222E47B-A68B-4AEB-9855-21C912B9D3D2}");
     533           1 :         assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dataBinding", "xpath", "/ns0:properties[1]/documentManagement[1]/ns2:Responsible_x0020_Officer_x0020_Title[1]");
     534             :     }
     535           2 : }
     536             : 
     537             : 
     538          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79968_sldx, "fdo79968.docx")
     539             : {
     540             :     // This UT for DOCX embedded with powerpoint slide
     541           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     542             : 
     543           2 :     if (!pXmlDoc)
     544           3 :        return;
     545             : 
     546             :     assertXPath(pXmlDoc,
     547             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.presentationml.slide']",
     548             :                 "PartName",
     549           1 :                 "/word/embeddings/oleObject1.sldx");
     550             : }
     551             : 
     552          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsb, "fdo79969_xlsb.docx")
     553             : {
     554             :     // This UT for DOCX embedded with binary excel work sheet.
     555           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     556             : 
     557           2 :     if (!pXmlDoc)
     558           3 :        return;
     559             : 
     560             :     assertXPath(pXmlDoc,
     561             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.binary.macroEnabled.12']",
     562             :                 "PartName",
     563           1 :                 "/word/embeddings/oleObject1.xlsb");
     564             : }
     565             : 
     566          17 : DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
     567             : {
     568             :     //fdo#76635 : Table borders are not getting preserved.
     569             : 
     570           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     571           2 :     if (!pXmlDocument)
     572           3 :         return;
     573             : 
     574             :     //Table Borders
     575           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val = 'single']",1);
     576           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz = 4]", 1);
     577           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space = 0]", 1);
     578           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color = '00000A']", 1);
     579             : 
     580           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val = 'single']",1);
     581           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz = 4]", 1);
     582           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space = 0]", 1);
     583           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color = '00000A']", 1);
     584             : 
     585           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:val = 'single']",1);
     586           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:sz = 4]", 1);
     587           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:space = 0]", 1);
     588           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color = '00000A']", 1);
     589             : 
     590           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:val = 'single']",1);
     591           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:sz = 4]", 1);
     592           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:space = 0]", 1);
     593           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color = '00000A']", 1);
     594             : 
     595             :     //Table Cell Borders
     596           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val = 'single']",1);
     597           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz = 4]", 1);
     598           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:space = 0]", 1);
     599           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color = '00000A']", 1);
     600             : 
     601           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:val = 'single']",1);
     602           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:sz = 4]", 1);
     603           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:space = 0]", 1);
     604           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:color = '00000A']", 1);
     605             : 
     606           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:val = 'single']",1);
     607           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:sz = 4]", 1);
     608           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:space = 0]", 1);
     609           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:color = '00000A']", 1);
     610             : 
     611           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:val = 'single']",1);
     612           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:sz = 4]", 1);
     613           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:space = 0]", 1);
     614           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color = '00000A']", 1);
     615             : }
     616             : 
     617          17 : DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
     618             : {
     619             :     // The problem was that text after TOC field was missing if footer reference  comes in field.
     620           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     621             : 
     622           2 :     if (!pXmlDoc)
     623           3 :        return;
     624             : 
     625             :     // Data was lost from this paragraph.
     626           1 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:t", "Abstract");
     627             : }
     628             : 
     629          17 : DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx")
     630             : {
     631             :     // This UT for DOCX embedded with excel work sheet.
     632           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     633             : 
     634           2 :     if (!pXmlDoc)
     635           3 :        return;
     636             : 
     637             :     assertXPath(pXmlDoc,
     638             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.macroEnabled.12']",
     639             :                 "PartName",
     640           1 :                 "/word/embeddings/oleObject1.xlsm");
     641             : }
     642             : 
     643          17 : DECLARE_OOXMLEXPORT_TEST(testfdo80522,"fdo80522.docx")
     644             : {
     645           2 :    xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     646             : 
     647           2 :     if (!pXmlDoc)
     648           3 :        return;
     649             : 
     650             :     assertXPath(pXmlDoc,
     651             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-word.document.macroEnabled.12']",
     652             :                 "PartName",
     653           1 :                 "/word/embeddings/oleObject1.docm");
     654             : }
     655             : 
     656          17 : DECLARE_OOXMLEXPORT_TEST(testfdo80523_pptm,"fdo80523_pptm.docx")
     657             : {
     658           2 :    xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     659             : 
     660           2 :     if (!pXmlDoc)
     661           3 :        return;
     662             : 
     663             :     assertXPath(pXmlDoc,
     664             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.presentation.macroEnabled.12']",
     665             :                 "PartName",
     666           1 :                 "/word/embeddings/oleObject1.pptm");
     667             : }
     668             : 
     669          17 : DECLARE_OOXMLEXPORT_TEST(testfdo80523_sldm,"fdo80523_sldm.docx")
     670             : {
     671           2 :    xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     672             : 
     673           2 :     if (!pXmlDoc)
     674           3 :        return;
     675             : 
     676             :     assertXPath(pXmlDoc,
     677             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.slide.macroEnabled.12']",
     678             :                 "PartName",
     679           1 :                 "/word/embeddings/oleObject1.sldm");
     680             : }
     681             : 
     682          17 : DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx")
     683             : {
     684             :     // This UT for DOCX embedded with binary excel work sheet.
     685           2 :     xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
     686             : 
     687           2 :     if (!pXmlDoc)
     688           3 :        return;
     689             : 
     690             :     assertXPath(pXmlDoc,
     691             :                 "/ContentType:Types/ContentType:Override[@ContentType='application/msword']",
     692             :                 "PartName",
     693           1 :                 "/word/embeddings/oleObject1.doc");
     694             : }
     695             : 
     696          17 : DECLARE_OOXMLEXPORT_TEST(testTableCellWithDirectFormatting, "fdo80800.docx")
     697             : {
     698             :     // Issue was Direct Foramatting for non-first Table cells was not getting preserved.
     699             : 
     700           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     701           2 :     if (!pXmlDoc)
     702           3 :        return;
     703             : 
     704             :     // Ensure that for Third Table cell Direct Formatting is preserved.
     705             :     // In file, Direct Formatting used for Third Table cell is Line Spacing="1.5 lines"
     706             :     // For Line Spacing "1.5 lines" w:line equals 360
     707           1 :     assertXPath(pXmlDoc,"/w:document/w:body/w:tbl/w:tr/w:tc[3]/w:p/w:pPr/w:spacing","line","360");
     708             : 
     709             : }
     710             : 
     711          17 : DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx")
     712             : {
     713             :     // Header was lost on export when the document had multiple columns.
     714           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     715           2 :     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
     716           2 : }
     717             : 
     718          17 : DECLARE_OOXMLEXPORT_TEST(testfdo83048, "fdo83048.docx")
     719             : {
     720             :     // Issue was wrong SDT properties were getting exported for Date SDT
     721           2 :     xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
     722           2 :     if (!pXmlDoc)
     723           3 :        return;
     724             : 
     725             :     // Make sure Date is inside SDT tag.
     726             :     // This will happen only if right SDT properties are exported.
     727           1 :     assertXPath(pXmlDoc, "/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t", "1/2/2013");
     728             : }
     729             : 
     730          17 : DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx")
     731             : {
     732           2 :     xmlDocPtr pXmlDoc = parseExport();
     733           2 :     if (!pXmlDoc)
     734           3 :         return;
     735             : 
     736             :     // The problem was that <w:sdt> was closed after "first", not after "second", so the second assert failed.
     737           1 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[1]/w:t", "first");
     738           1 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[2]/w:t", "second");
     739             :     // Make sure the third portion is still outside <w:sdt>.
     740           1 :     assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/w:t", "third");
     741             : }
     742             : 
     743          17 : DECLARE_OOXMLEXPORT_TEST(testFD083057, "fdo83057.docx")
     744             : {
     745           2 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     746           2 :     if (!pXmlDoc)
     747           3 :         return;
     748             : 
     749             :     // A fly frame was attached to a para which started with a hint (run) containing an SDT.
     750             :     // This SDT was handled while exporting the FLYFRAME and also the text of the run.
     751             :     // So, even though the original file had only one sdt in the header, the RT file had two;
     752             :     // one for a separate run as expected, and one incorrectly exported in the alternateContent (FLYFRAME)
     753             : 
     754             :     // Assert that the file has only one sdt, in a separate run
     755           1 :     assertXPath(pXmlDoc, "//w:sdt", 1);
     756           1 :     assertXPath(pXmlDoc, "//mc:AlternateContent//w:sdt", 0);
     757             : }
     758             : 
     759          17 : DECLARE_OOXMLEXPORT_TEST(testHeaderBorder, "header-border.docx")
     760             : {
     761           2 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     762             :     {
     763             :         // This was 0, as header margin was lost during import.
     764           1 :         assertXPath(pXmlDoc, "//w:pgMar", "header", "720");
     765             :         // This was 33: 33 points -> 660 twips. We counted 900 - 240 (distance
     766             :         // of page and body frame) instead of 720 - 240 (distance of page and
     767             :         // header frame).
     768           1 :         assertXPath(pXmlDoc, "//w:pgBorders/w:top", "space", "24");
     769             :     }
     770           2 : }
     771             : 
     772          17 : DECLARE_OOXMLEXPORT_TEST(testTablepprShape, "tblppr-shape.docx")
     773             : {
     774             :     // Unhandled exception due to unexpected w:tblpPr resulted in not importing page size, either.
     775           2 :     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     776             :     // This was 2000, page width wasn't large enough.
     777           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2540), getProperty<sal_Int32>(xPageStyle, "LeftMargin"));
     778           2 : }
     779             : 
     780          17 : DECLARE_OOXMLEXPORT_TEST(testImageNoborder, "image-noborder.docx")
     781             : {
     782             :     // This was 26; we exported border for an image that had no border.
     783           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(getShape(1), "TopBorder").LineWidth);
     784           2 : }
     785             : 
     786          16 : DECLARE_OOXMLEXPORT_TEST(testTdf89774, "tdf89774.fodt")
     787             : {
     788           1 :     if (xmlDocPtr pXmlDoc = parseExport("docProps/app.xml"))
     789             :         // This was 65, as unit was seconds instead of minutes.
     790           1 :         assertXPathContent(pXmlDoc, "/extended-properties:Properties/extended-properties:TotalTime", "1");
     791           1 : }
     792             : 
     793          16 : DECLARE_OOXMLEXPORT_TEST(testSectionProtection, "sectionprot.odt")
     794             : {
     795           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     796             :     {
     797           1 :         assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr/w:formProt", "val", "true");
     798           1 :         assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:formProt", "val", "false");
     799             :     }
     800             : 
     801           1 :     if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml"))
     802             :     {
     803           1 :         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "true");
     804           1 :         assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "forms");
     805             :     }
     806           1 : }
     807             : 
     808          16 : DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt")
     809             : {
     810           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     811             :     {
     812           1 :         assertXPath(pXmlDoc, "//w:headerReference", 1);
     813             :     }
     814           1 : }
     815             : 
     816          16 : DECLARE_OOXMLEXPORT_TEST(testOO47778_1, "ooo47778-3.odt")
     817             : {
     818           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     819           1 :         assertXPathContent(pXmlDoc, "(//w:t)[3]", "c");
     820           1 : }
     821             : 
     822          16 : DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt")
     823             : {
     824           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     825           1 :         assertXPathContent(pXmlDoc, "(//w:t)[4]", "c");
     826           1 : }
     827             : 
     828          16 : DECLARE_OOXMLEXPORT_TEST(testOO67471, "ooo67471-2.odt")
     829             : {
     830           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     831           1 :         assertXPathContent(pXmlDoc, "(//w:t)[2]", "B");
     832           1 : }
     833             : 
     834          16 : DECLARE_OOXMLEXPORT_TEST(testKDE302504, "kde302504-1.odt")
     835             : {
     836           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     837           1 :         assertXPath(pXmlDoc, "//v:shape", "ID", "KoPathShape");
     838           1 : }
     839             : 
     840          16 : DECLARE_OOXMLEXPORT_TEST(testKDE216114, "kde216114-1.odt")
     841             : {
     842           1 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
     843           1 :         assertXPath(pXmlDoc, "//w:pict", 1);
     844           1 : }
     845             : 
     846           4 : CPPUNIT_PLUGIN_IMPLEMENT();
     847             : 
     848             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11