LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlexport - ooxmlsdrexport.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 496 496 100.0 %
Date: 2014-04-11 Functions: 420 468 89.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <swmodeltestbase.hxx>
      11             : 
      12             : #if !defined(WNT)
      13             : 
      14             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      15             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      16             : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
      17             : #include <com/sun/star/drawing/FillStyle.hpp>
      18             : #include <com/sun/star/drawing/Hatch.hpp>
      19             : #include <com/sun/star/drawing/LineJoint.hpp>
      20             : #include <com/sun/star/drawing/LineStyle.hpp>
      21             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      22             : #include <com/sun/star/style/LineSpacing.hpp>
      23             : #include <com/sun/star/style/LineSpacingMode.hpp>
      24             : #include <com/sun/star/text/GraphicCrop.hpp>
      25             : 
      26             : #include <comphelper/sequenceashashmap.hxx>
      27             : 
      28          92 : class Test : public SwModelTestBase
      29             : {
      30             : public:
      31          92 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
      32             : 
      33             : protected:
      34             :     /**
      35             :      * Blacklist handling
      36             :      */
      37          46 :     bool mustTestImportOf(const char* filename) const SAL_OVERRIDE {
      38             :         // If the testcase is stored in some other format, it's pointless to test.
      39          46 :         return (OString(filename).endsWith(".docx"));
      40             :     }
      41             : };
      42             : 
      43             : #if 1
      44             : #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
      45             : 
      46             : // For testing during development of a tast, you want to use
      47             : // DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0
      48             : // Of course, don't forget to set back to #if 1 when you are done :-)
      49             : #else
      50             : #define DECLARE_OOXMLEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
      51             : 
      52             : #undef DECLARE_OOXMLEXPORT_TEST
      53             : #define DECLARE_OOXMLEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
      54             : #endif
      55             : 
      56          14 : DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx")
      57             : {
      58           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Title"), getProperty<OUString>(getShape(1), "Title"));
      59           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Description"), getProperty<OUString>(getShape(1), "Description"));
      60           2 : }
      61             : 
      62          13 : DECLARE_OOXMLEXPORT_TEST(testDmlZorder, "dml-zorder.odt")
      63             : {
      64           1 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      65           1 :     if (!pXmlDoc)
      66           1 :         return;
      67             :     // This was "0": causing that in Word, the second shape was on top, while in the original odt the first shape is on top.
      68           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor", "relativeHeight", "2");
      69             : }
      70             : 
      71          14 : DECLARE_OOXMLEXPORT_TEST(testDmlShapeRelsize, "dml-shape-relsize.docx")
      72             : {
      73           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      74           2 :     if (!pXmlDoc)
      75           3 :         return;
      76             :     // Relative size wasn't exported all, then relativeFrom was "page", not "margin".
      77           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
      78             : }
      79             : 
      80          14 : DECLARE_OOXMLEXPORT_TEST(testDmlPictureInTextframe, "dml-picture-in-textframe.docx")
      81             : {
      82           2 :     if (!m_bExported)
      83           3 :         return;
      84             : 
      85           1 :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), m_aTempFile.GetURL());
      86           1 :     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/media/image1.gif")));
      87             :     // This was also true, image was written twice.
      88           1 :     CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/image2.gif")));
      89             : }
      90             : 
      91          14 : DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx")
      92             : {
      93           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      94           2 :     if (!pXmlDoc)
      95           3 :         return;
      96             :     // Relative size wasn't imported.
      97           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
      98             : }
      99             : 
     100          14 : DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx")
     101             : {
     102           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     103           3 :     uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(1), uno::UNO_QUERY);
     104             :     // This was drawing::FillStyle_NONE.
     105           2 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape, "FillStyle"));
     106             :     // This was drawing::LineStyle_NONE.
     107           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape, "LineStyle"));
     108             : 
     109           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     110           2 :     if (!pXmlDocument)
     111           3 :         return;
     112             :     // This was wrap="none".
     113           1 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:bodyPr", "wrap", "square");
     114             : 
     115           1 :     xShape.set(xGroup->getByIndex(3), uno::UNO_QUERY);
     116           2 :     OUString aType = comphelper::SequenceAsHashMap(getProperty<beans::PropertyValues>(xShape, "CustomShapeGeometry"))["Type"].get<OUString>();
     117           1 :     CPPUNIT_ASSERT_EQUAL(OUString("ooxml-bentConnector3"), aType);
     118             :     // Connector was incorrectly shifted towards the top left corner, X was 552, Y was 0.
     119           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4018), xShape->getPosition().X);
     120           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1256), xShape->getPosition().Y);
     121             : 
     122           1 :     xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY);
     123             :     // This was incorrectly shifted towards the top of the page, Y was 106.
     124           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1016), xShape->getPosition().Y);
     125             : }
     126             : 
     127          14 : DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx")
     128             : {
     129             :     // Problem was that the transparency was not exported (a:alpha).
     130             :     // RGB color (a:srgbClr)
     131           2 :     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);;
     132           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(70), getProperty<sal_Int16>(xShape, "FillTransparence"));
     133             : 
     134             :     // Theme color (a:schemeClr)
     135           2 :     xShape.set(getShape(2), uno::UNO_QUERY);
     136           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(xShape, "FillTransparence"));
     137           2 : }
     138             : 
     139          14 : DECLARE_OOXMLEXPORT_TEST(testDMLCustomGeometry, "dml-customgeometry-cubicbezier.docx")
     140             : {
     141             : 
     142             :     // The problem was that a custom shape was not exported.
     143           2 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry");
     144           4 :     uno::Sequence<beans::PropertyValue> aPathProps;
     145          18 :     for (int i = 0; i < aProps.getLength(); ++i)
     146             :     {
     147          16 :         const beans::PropertyValue& rProp = aProps[i];
     148          16 :         if (rProp.Name == "Path")
     149           2 :             rProp.Value >>= aPathProps;
     150             :     }
     151           4 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
     152           4 :     uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
     153          10 :     for (int i = 0; i < aPathProps.getLength(); ++i)
     154             :     {
     155           8 :         const beans::PropertyValue& rProp = aPathProps[i];
     156           8 :         if (rProp.Name == "Coordinates")
     157           2 :             rProp.Value >>= aPairs;
     158           6 :         else if (rProp.Name == "Segments")
     159           2 :             rProp.Value >>= aSegments;
     160             :     }
     161             : 
     162             :     // (a:moveTo)
     163           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
     164           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::MOVETO), aSegments[0].Command );
     165             : 
     166             :     // (a:cubicBezTo)
     167           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), aSegments[1].Count);
     168           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CURVETO), aSegments[1].Command );
     169             : 
     170             :     // Coordinates
     171           2 :     sal_Int32 nLength = 16;
     172           2 :     CPPUNIT_ASSERT_EQUAL(nLength, aPairs.getLength());
     173             :     std::pair<sal_Int32,sal_Int32> aCoordinates[] =
     174             :     {
     175             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     176             :         std::pair<sal_Int32,sal_Int32>(450, 44),
     177             :         std::pair<sal_Int32,sal_Int32>(300, 57),
     178             :         std::pair<sal_Int32,sal_Int32>(176, 57),
     179             :         std::pair<sal_Int32,sal_Int32>(109, 57),
     180             :         std::pair<sal_Int32,sal_Int32>(49, 53),
     181             :         std::pair<sal_Int32,sal_Int32>(0, 48),
     182             :         std::pair<sal_Int32,sal_Int32>(66, 58),
     183             :         std::pair<sal_Int32,sal_Int32>(152, 66),
     184             :         std::pair<sal_Int32,sal_Int32>(251, 66),
     185             :         std::pair<sal_Int32,sal_Int32>(358, 66),
     186             :         std::pair<sal_Int32,sal_Int32>(480, 56),
     187             :         std::pair<sal_Int32,sal_Int32>(607, 27),
     188             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     189             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     190             :         std::pair<sal_Int32,sal_Int32>(607, 0)
     191           2 :     };
     192             : 
     193          34 :     for( int i = 0; i < nLength; ++i )
     194             :     {
     195          32 :         CPPUNIT_ASSERT_EQUAL(aCoordinates[i].first, aPairs[i].First.Value.get<sal_Int32>());
     196          32 :         CPPUNIT_ASSERT_EQUAL(aCoordinates[i].second, aPairs[i].Second.Value.get<sal_Int32>());
     197           2 :     }
     198           2 : }
     199             : 
     200          14 : DECLARE_OOXMLEXPORT_TEST(testDmlRectangleRelsize, "dml-rectangle-relsize.docx")
     201             : {
     202             :     // This was around 19560, as we did not read wp14:pctHeight for
     203             :     // drawinglayer shapes and the fallback data was invalid.
     204           2 :     OString aMessage("Height is only " + OString::number(getShape(1)->getSize().Height));
     205           2 :     CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), getShape(1)->getSize().Height >= 20973);
     206             : 
     207             :     // This was around 0: relative size of 0% was imported as 0, not "fall back to absolute size".
     208           2 :     CPPUNIT_ASSERT(getShape(2)->getSize().Height > 300);
     209           2 : }
     210             : 
     211          14 : DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameVertAdjust, "dml-textframe-vertadjust.docx")
     212             : {
     213             :     // DOCX textboxes with text are imported as text frames but in Writer text frames did not have
     214             :     // TextVerticalAdjust attribute so far.
     215             : 
     216             :     // 1st frame's context is adjusted to the top
     217           2 :     uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY);
     218           2 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     219             :     // 2nd frame's context is adjusted to the center
     220           2 :     xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY);
     221           2 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     222             :     // 3rd frame's context is adjusted to the bottom
     223           2 :     xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY);
     224           2 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     225           2 : }
     226             : 
     227          14 : DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.docx")
     228             : {
     229             :     // Test the new GraphicCrop property which is introduced to define
     230             :     // cropping of shapes filled with a picture in stretch mode.
     231             : 
     232             :     // 1st shape has some cropping
     233           2 :     text::GraphicCrop aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
     234           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? 454 : 455 ), aGraphicCropStruct.Left );
     235           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? 367 : 368 ), aGraphicCropStruct.Right );
     236           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? -454 : -455 ), aGraphicCropStruct.Top );
     237           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? -367 : -368 ), aGraphicCropStruct.Bottom );
     238             : 
     239             :     // 2nd shape has no cropping
     240           2 :     aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
     241           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left );
     242           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Right );
     243           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top );
     244           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom );
     245             : 
     246           2 : }
     247             : 
     248          14 : DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx")
     249             : {
     250             :     // Hatching was ignored by the export.
     251             : 
     252             :     // 1st shape: light horizontal pattern (ltHorz)
     253           2 :     drawing::Hatch aHatch = getProperty<drawing::Hatch>(getShape(1), "FillHatch");
     254           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     255           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     256           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x99FF66), aHatch.Color);
     257           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     258             : 
     259             :     // 2nd shape: horizontal pattern (horz)
     260           2 :     aHatch = getProperty<drawing::Hatch>(getShape(2), "FillHatch");
     261           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     262           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     263           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     264             : 
     265             :     // 3rd shape: light vertical pattern (ltVert)
     266           2 :     aHatch = getProperty<drawing::Hatch>(getShape(3), "FillHatch");
     267           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(900), aHatch.Angle);
     268           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     269           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     270             : 
     271             :     // 4th shape: vertical pattern (vert)
     272           2 :     aHatch = getProperty<drawing::Hatch>(getShape(4), "FillHatch");
     273           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(900), aHatch.Angle);
     274           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     275           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     276             : 
     277             :     // 5th shape: light upward diagonal pattern (ltUpDiag)
     278           2 :     aHatch = getProperty<drawing::Hatch>(getShape(5), "FillHatch");
     279           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     280           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     281           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     282             : 
     283             :     // 6th shape: wide upward diagonal pattern (wdUpDiag)
     284           2 :     aHatch = getProperty<drawing::Hatch>(getShape(6), "FillHatch");
     285           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     286           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     287           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     288             : 
     289             :     // 7th shape: light downward diagonal pattern (ltDnDiag)
     290           2 :     aHatch = getProperty<drawing::Hatch>(getShape(7), "FillHatch");
     291           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1350), aHatch.Angle);
     292           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     293           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     294             : 
     295             :     // 8th shape: wide downward diagonal pattern (wdDnDiag)
     296           2 :     aHatch = getProperty<drawing::Hatch>(getShape(8), "FillHatch");
     297           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1350), aHatch.Angle);
     298           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     299           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     300             : 
     301             :     // 9th shape: small grid pattern (smGrid)
     302           2 :     aHatch = getProperty<drawing::Hatch>(getShape(9), "FillHatch");
     303           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     304           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     305           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     306             : 
     307             :     // 10th shape: large grid pattern (lgGrid)
     308           2 :     aHatch = getProperty<drawing::Hatch>(getShape(10), "FillHatch");
     309           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     310           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     311           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     312             : 
     313             :     // 11th shape: small checker board pattern (smCheck)
     314           2 :     aHatch = getProperty<drawing::Hatch>(getShape(11), "FillHatch");
     315           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     316           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     317           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     318             : 
     319             :     // 12th shape: outlined diamond pattern (openDmnd)
     320           2 :     aHatch = getProperty<drawing::Hatch>(getShape(12), "FillHatch");
     321           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     322           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     323           2 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     324           2 : }
     325             : 
     326          14 : DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childposition.docx")
     327             : {
     328             :     // Problem was parent transformation was ingnored fully, but translate component
     329             :     // which specify the position must be also applied for children of the group.
     330             : 
     331           2 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
     332           4 :     uno::Reference<drawing::XShape> xChildGroup(xGroup->getByIndex(1), uno::UNO_QUERY);
     333           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -2119 : -2121), xChildGroup->getPosition().X);
     334           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 11338 : 11335), xChildGroup->getPosition().Y);
     335             : 
     336           2 :     xGroup.set(xChildGroup, uno::UNO_QUERY);
     337           2 :     xChildGroup.set(xGroup->getByIndex(0), uno::UNO_QUERY);
     338           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -1856 : -1858), xChildGroup->getPosition().X);
     339           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 11338 : 11335), xChildGroup->getPosition().Y);
     340             : 
     341           2 :     xChildGroup.set(xGroup->getByIndex(1), uno::UNO_QUERY);
     342           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -2119 : -2121), xChildGroup->getPosition().X);
     343           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 14028 : 14025), xChildGroup->getPosition().Y);
     344           2 : }
     345             : 
     346          14 : DECLARE_OOXMLEXPORT_TEST(testDMLGradientFillTheme, "dml-gradientfill-theme.docx")
     347             : {
     348             :     // Problem was when a fill gradient was imported from a theme, (fillRef in ooxml)
     349             :     // not just the theme was written out but the explicit values too
     350             :     // Besides the duplication of values it causes problems with writing out
     351             :     // <a:schemeClr val="phClr"> into document.xml, while phClr can be used just for theme definitions.
     352           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     353           2 :     if (!pXmlDoc)
     354           3 :         return;
     355             : 
     356             :     // check no explicit gradFill has been exported
     357             :     assertXPath(pXmlDoc,
     358             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill",
     359           1 :             0);
     360             : 
     361             :     // check shape style has been exported
     362             :     assertXPath(pXmlDoc,
     363             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     364           1 :             "idx", "2");
     365             :     assertXPath(pXmlDoc,
     366             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     367           1 :             "val", "accent1");
     368             : }
     369             : 
     370          14 : DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeParaSpacing, "dml-groupshape-paraspacing.docx")
     371             : {
     372             :     // Paragraph spacing (top/bottom margin and line spacing) inside a group shape was not imported
     373           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     374           4 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
     375             : 
     376             :     // 1st paragraph has 1.5x line spacing but it has no spacing before/after.
     377           4 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
     378           2 :     style::LineSpacing aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     379           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     380           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(150), aLineSpacing.Height);
     381           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     382           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     383             : 
     384             :     // 2nd paragraph has double line spacing but it has no spacing before/after.
     385           2 :     xRun.set(getRun(getParagraphOfText(2, xText),1));
     386           2 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     387           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     388           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(200), aLineSpacing.Height);
     389           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     390           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     391             : 
     392             :     // 3rd paragraph has 24 pt line spacing but it has no spacing before/after.
     393           2 :     xRun.set(getRun(getParagraphOfText(3, xText),1));
     394           2 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     395           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::MINIMUM), aLineSpacing.Mode);
     396           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(847), aLineSpacing.Height);
     397           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     398           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     399             : 
     400             :     // 4th paragraph has 1.75x line spacing but it has no spacing before/after.
     401           2 :     xRun.set(getRun(getParagraphOfText(4, xText),1));
     402           2 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     403           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     404           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(175), aLineSpacing.Height);
     405           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     406           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     407             : 
     408             :     // 5th paragraph has margins which are defined by w:beforeLines and w:afterLines.
     409           2 :     xRun.set(getRun(getParagraphOfText(5, xText),1));
     410           2 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     411           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     412           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
     413           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     414           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(741), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     415             : 
     416             :     // 6th paragraph has margins which are defined by w:before and w:after.
     417           2 :     xRun.set(getRun(getParagraphOfText(6, xText),1));
     418           2 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     419           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     420           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
     421           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(423), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     422           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     423             : 
     424             :     // 7th paragraph has auto paragraph margins a:afterAutospacing and a:beforeAutospacing, which means margins must be ignored.
     425           2 :     xRun.set(getRun(getParagraphOfText(7, xText),1));
     426           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     427           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     428           2 : }
     429             : 
     430          14 : DECLARE_OOXMLEXPORT_TEST(testTableFloatingMargins, "table-floating-margins.docx")
     431             : {
     432             :     // In case the table had custom left cell margin, the horizontal position was still incorrect (too small, -199).
     433           2 :     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     434           3 :     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
     435           3 :     uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
     436           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-499), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
     437             :     // These were 0 as well, due to lack of import.
     438           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), getProperty<sal_Int32>(xFrame, "TopMargin"));
     439           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), getProperty<sal_Int32>(xFrame, "BottomMargin"));
     440             : 
     441             :     // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table.
     442           2 :     xmlDocPtr pXmlDoc = parseExport();
     443           2 :     if (!pXmlDoc)
     444           3 :         return;
     445           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
     446             : }
     447             : 
     448          14 : DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
     449             : {
     450             :     /*
     451             :      * The problem was that the exporter didn't mirror the workaround of the
     452             :      * importer, regarding the btLr text frame direction: the
     453             :      * mso-layout-flow-alt property was completely missing in the output.
     454             :      */
     455           2 :     xmlDocPtr pXmlDoc = parseExport();
     456           2 :     if (!pXmlDoc)
     457           3 :         return;
     458             :     // VML
     459           1 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox", "style").match("mso-layout-flow-alt:bottom-to-top"));
     460             :     // drawingML
     461           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "vert", "vert270");
     462             : }
     463             : 
     464          14 : DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
     465             : {
     466             :     // The problem was exporter was exporting vml data for shape in w:rPr element.
     467             :     // vml data shoud not come under w:rPr element.
     468           2 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     469           2 :     if (!pXmlDoc)
     470           3 :         return;
     471           1 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "stroked").match("f"));
     472             : }
     473             : 
     474          14 : DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
     475             : {
     476             :     // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element.
     477             : 
     478           2 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     479           2 :     if (!pXmlDoc)
     480           3 :         return;
     481           1 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:imagedata", "detectmouseclick").match("t"));
     482             : }
     483             : 
     484          14 : DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx")
     485             : {
     486             :     // The problem was that VMLExport::Commit didn't save the correct width and height,
     487             :     // and ImplEESdrWriter::ImplFlipBoundingBox made a mistake calculating the position
     488             : 
     489           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     490           2 :     if (!pXmlDocument)
     491           3 :         return;
     492             : 
     493             :     // Check DML document
     494             : 
     495             :     sal_Int32 aXPos[4], aYPos[4];
     496           1 :     aXPos[0] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     497           1 :     aXPos[1] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     498           1 :     aXPos[2] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     499           1 :     aXPos[3] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     500             : 
     501           1 :     aYPos[0] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     502           1 :     aYPos[1] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     503           1 :     aYPos[2] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     504           1 :     aYPos[3] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     505             : 
     506             :     // TODO: compare values with a reference value extracted from the original document
     507             :     //       depends on fdo#75722
     508             :     // certain degree of error is tolerated due to rounding in unit conversions
     509           1 :     CPPUNIT_ASSERT(abs(aXPos[0] - aXPos[1]) < 1000);
     510           1 :     CPPUNIT_ASSERT(abs(aXPos[1] - aXPos[2]) < 1000);
     511           1 :     CPPUNIT_ASSERT(abs(aXPos[2] - aXPos[3]) < 1000);
     512             : 
     513           1 :     CPPUNIT_ASSERT(abs(aYPos[0] - aYPos[1]) < 1000);
     514           1 :     CPPUNIT_ASSERT(abs(aYPos[1] - aYPos[2]) < 1000);
     515           1 :     CPPUNIT_ASSERT(abs(aYPos[2] - aYPos[3]) < 1000);
     516             : 
     517             :     sal_Int32 aHSize[4], aVSize[4];
     518           1 :     aHSize[0] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     519           1 :     aHSize[1] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     520           1 :     aHSize[2] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     521           1 :     aHSize[3] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     522             : 
     523           1 :     aVSize[0] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     524           1 :     aVSize[1] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     525           1 :     aVSize[2] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     526           1 :     aVSize[3] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     527             : 
     528             :     // certain degree of error is tolerated due to rounding in unit conversions
     529           1 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[0]) < 1000);
     530           1 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[1]) < 1000);
     531           1 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[2]) < 1000);
     532           1 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[3]) < 1000);
     533             : 
     534           1 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[0]) < 1000);
     535           1 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[1]) < 1000);
     536           1 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[2]) < 1000);
     537           1 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[3]) < 1000);
     538             : 
     539             :     // Check VML document
     540             : 
     541             :     // get styles of the four shapes
     542           5 :     OUString aStyles[4];
     543           1 :     aStyles[0] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:rect", "style");
     544             :     // original is: "position:absolute;margin-left:97.6pt;margin-top:165pt;width:283.4pt;height:141.7pt;rotation:285"
     545           1 :     aStyles[1] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect", "style");
     546             :     // original is: "position:absolute;margin-left:97.6pt;margin-top:164.95pt;width:283.4pt;height:141.7pt;rotation:255"
     547           1 :     aStyles[2] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Fallback/w:pict/v:rect", "style");
     548             :     // original is: "position:absolute;margin-left:97.5pt;margin-top:164.9pt;width:283.4pt;height:141.7pt;rotation:105"
     549           1 :     aStyles[3] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Fallback/w:pict/v:rect", "style");
     550             :     // original is: "position:absolute;margin-left:97.55pt;margin-top:164.95pt;width:283.4pt;height:141.7pt;rotation:75"
     551             : 
     552             :     //check the size and position of each of the shapes
     553           5 :     for( int i = 0; i < 4; ++i )
     554             :     {
     555           4 :         CPPUNIT_ASSERT(!aStyles[i].isEmpty());
     556             : 
     557           4 :         sal_Int32 nextTokenPos = 0;
     558          24 :         do
     559             :         {
     560          24 :             OUString aStyleCommand = aStyles[i].getToken( 0, ';', nextTokenPos );
     561          24 :             CPPUNIT_ASSERT(!aStyleCommand.isEmpty());
     562             : 
     563          48 :             OUString aStyleCommandName  = aStyleCommand.getToken( 0, ':' );
     564          48 :             OUString aStyleCommandValue = aStyleCommand.getToken( 1, ':' );
     565             : 
     566          24 :             if( aStyleCommandName.equals( "margin-left" ) )
     567             :             {
     568           4 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     569           4 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(97.6, fValue, 0.1);
     570             :             }
     571          20 :             else if( aStyleCommandName.equals( "margin-top" ) )
     572             :             {
     573           4 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     574           4 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(165.0, fValue, 0.2);
     575             :             }
     576          16 :             else if( aStyleCommandName.equals( "width" ) )
     577             :             {
     578           4 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     579           4 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(283.4, fValue, 0.1);
     580             :             }
     581          12 :             else if( aStyleCommandName.equals( "height" ) )
     582             :             {
     583           4 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     584           4 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(141.7, fValue, 0.1);
     585          24 :             }
     586             : 
     587          24 :         } while( nextTokenPos != -1 );
     588           5 :     }
     589             : }
     590             : 
     591          14 : DECLARE_OOXMLEXPORT_TEST(testFdo73215, "fdo73215.docx")
     592             : {
     593           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     594           2 :     if (!pXmlDoc)
     595           3 :         return;
     596             :     // 'rect' was 'pictureFrame', which isn't valid.
     597             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:prstGeom",
     598           1 :                 "prst", "rect");
     599             :     // 'adj1' was 'adj', which is not valid for bentConnector3.
     600             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[9]/wps:spPr/a:prstGeom/a:avLst/a:gd",
     601           1 :                 "name", "adj1");
     602             : }
     603             : 
     604          14 : DECLARE_OOXMLEXPORT_TEST(testBehinddoc, "behinddoc.docx")
     605             : {
     606           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     607           2 :     if (!pXmlDoc)
     608           3 :         return;
     609             :     // This was "0", shape was in the foreground.
     610           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "behindDoc", "1");
     611             : }
     612             : 
     613          14 : DECLARE_OOXMLEXPORT_TEST(testSmartArtAnchoredInline, "fdo73227.docx")
     614             : {
     615             :     /* Given file conatins 3 DrawingML objects as 1Picture,1SmartArt and 1Shape.
     616             :      * Check for SmartArt.
     617             :     *  SmartArt shoould get written as "Floating Object" i.e. inside <wp:anchor> tag.
     618             :     *  Also check for value of attribute "id" of <wp:docPr> . It should be unique for
     619             :     *  all 3 DrawingML objects in a document.
     620             :     */
     621             : 
     622           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     623           2 :     if (!pXmlDoc)
     624           3 :         return;
     625           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","id","1");
     626           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","name","Diagram1");
     627             : 
     628           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","id","2");
     629           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","name","10-Point Star 3");
     630             : 
     631           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","id","3");
     632           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","name","Picture");
     633             : }
     634             : 
     635          14 : DECLARE_OOXMLEXPORT_TEST(testFdo65833, "fdo65833.docx")
     636             : {
     637             :     // The "editas" attribute for vml group shape was not preserved.
     638           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     639           2 :     if (!pXmlDoc)
     640           3 :         return;
     641           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group", "editas", "canvas");
     642             : }
     643             : 
     644          14 : DECLARE_OOXMLEXPORT_TEST(testFdo73247, "fdo73247.docx")
     645             : {
     646           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     647           2 :     if (!pXmlDoc)
     648           3 :         return;
     649             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
     650           1 :         "rot", "1969698");
     651             : }
     652             : 
     653          14 : DECLARE_OOXMLEXPORT_TEST(testFdo70942, "fdo70942.docx")
     654             : {
     655           2 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     656           2 :     if (!pXmlDoc)
     657           3 :         return;
     658             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom",
     659           1 :                 "prst", "ellipse");
     660             : }
     661             : 
     662          14 : DECLARE_OOXMLEXPORT_TEST(testDrawinglayerPicPos, "drawinglayer-pic-pos.docx")
     663             : {
     664             :     // The problem was that the position of the picture was incorrect, it was shifted towards the bottom right corner.
     665           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     666           2 :     if (!pXmlDocument)
     667           3 :         return;
     668             : 
     669           1 :     OString aXPath("/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:xfrm/a:off");
     670             :     // This was 720.
     671           1 :     assertXPath(pXmlDocument, aXPath, "x", "0");
     672             :     // This was 1828800.
     673           1 :     assertXPath(pXmlDocument, aXPath, "y", "0");
     674             : }
     675             : 
     676          14 : DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.docx")
     677             : {
     678           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     679           2 :     if (!pXmlDocument)
     680           3 :         return;
     681             : 
     682             :     // check shape style has been preserved
     683             :     assertXPath(pXmlDocument,
     684             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     685           1 :             "idx", "1");
     686             :     assertXPath(pXmlDocument,
     687             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     688           1 :             "val", "accent1");
     689             :     assertXPath(pXmlDocument,
     690             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     691           1 :             "idx", "1");
     692             :     assertXPath(pXmlDocument,
     693             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     694           1 :             "val", "accent1");
     695             :     assertXPath(pXmlDocument,
     696             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     697           1 :             "idx", "1");
     698             :     assertXPath(pXmlDocument,
     699             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     700           1 :             "val", "accent1");
     701             :     assertXPath(pXmlDocument,
     702             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef",
     703           1 :             "idx", "2");
     704             :     assertXPath(pXmlDocument,
     705             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef/a:schemeClr",
     706           1 :             "val", "accent1");
     707             :     assertXPath(pXmlDocument,
     708             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef/a:schemeClr/a:shade",
     709           1 :             "val", "50000");
     710             :     assertXPath(pXmlDocument,
     711             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef",
     712           1 :             "idx", "0");
     713             :     assertXPath(pXmlDocument,
     714             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef/a:schemeClr",
     715           1 :             "val", "accent1");
     716             : 
     717             :     // check shape style hasn't been overwritten
     718             :     assertXPath(pXmlDocument,
     719             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill",
     720           1 :             0);
     721             :     assertXPath(pXmlDocument,
     722             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
     723           1 :             0);
     724             : 
     725             :     // check direct theme assignments have been preserved
     726             :     assertXPath(pXmlDocument,
     727             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr",
     728           1 :             "val", "accent6");
     729             :     assertXPath(pXmlDocument,
     730             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:schemeClr",
     731           1 :             "val", "accent3");
     732             : 
     733             :     // check color transformations applied to theme colors have been preserved
     734             :     assertXPath(pXmlDocument,
     735             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr/a:lumMod",
     736           1 :             "val", "40000");
     737             :     assertXPath(pXmlDocument,
     738             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr/a:lumOff",
     739           1 :             "val", "60000");
     740             :     assertXPath(pXmlDocument,
     741             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:schemeClr/a:lumMod",
     742           1 :             "val", "50000");
     743             : 
     744             :     // check direct color assignments have been preserved
     745             :     OUString sFillColor = getXPath(pXmlDocument,
     746             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:srgbClr",
     747           1 :             "val");
     748           1 :     CPPUNIT_ASSERT_EQUAL(sFillColor.toInt32(16), sal_Int32(0x00b050));
     749             :     sal_Int32 nLineColor = getXPath(pXmlDocument,
     750             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:srgbClr",
     751           1 :             "val").toInt32(16);
     752           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), nLineColor);
     753             : 
     754             :     // check direct line type assignments have been preserved
     755             :     sal_Int32 nLineWidth = getXPath(pXmlDocument,
     756             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln",
     757           1 :             "w").toInt32();
     758           1 :     CPPUNIT_ASSERT(abs(63500 - nLineWidth) < 1000); //some rounding errors in the conversion ooxml -> libo -> ooxml are tolerated
     759             :     assertXPath(pXmlDocument,
     760             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:miter",
     761           1 :             1);
     762             :     assertXPath(pXmlDocument,
     763             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:custDash",
     764           1 :             1);
     765             : 
     766           2 :     uno::Reference<drawing::XShape> xShape1 = getShape(1);
     767           2 :     uno::Reference<drawing::XShape> xShape2 = getShape(2);
     768           2 :     uno::Reference<drawing::XShape> xShape3 = getShape(3);
     769             : 
     770             :     // check colors are properly applied to shapes on import
     771           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape1, "FillColor"));
     772           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xfcd5b5), getProperty<sal_Int32>(xShape2, "FillColor"));
     773           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), getProperty<sal_Int32>(xShape3, "FillColor"));
     774           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x3a5f8b), getProperty<sal_Int32>(xShape1, "LineColor"));
     775           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f6228), getProperty<sal_Int32>(xShape2, "LineColor"));
     776           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(xShape3, "LineColor"));
     777             : 
     778             :     // check line properties are properly applied to shapes on import
     779           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape1, "LineStyle"));
     780           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape2, "LineStyle"));
     781           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH,  getProperty<drawing::LineStyle>(xShape3, "LineStyle"));
     782           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_ROUND, getProperty<drawing::LineJoint>(xShape1, "LineJoint"));
     783           1 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_ROUND, getProperty<drawing::LineJoint>(xShape2, "LineJoint"));
     784           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_MITER, getProperty<drawing::LineJoint>(xShape3, "LineJoint"));
     785             : }
     786             : 
     787          14 : DECLARE_OOXMLEXPORT_TEST(testFDO73546, "FDO73546.docx")
     788             : {
     789           2 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     790           2 :     if (!pXmlDoc)
     791           3 :         return;
     792           1 :     assertXPath(pXmlDoc, "/w:hdr/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "distL","0");
     793             : }
     794             : 
     795          14 : DECLARE_OOXMLEXPORT_TEST(testFdo69616, "fdo69616.docx")
     796             : {
     797           2 :     xmlDocPtr pXmlDoc = parseExport();
     798           2 :     if (!pXmlDoc)
     799           3 :         return;
     800             :     // VML
     801           1 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725"));
     802             : }
     803             : 
     804          14 : DECLARE_OOXMLEXPORT_TEST(testAlignForShape,"Shape.docx")
     805             : {
     806             :     //fdo73545:Shape Horizontal and vertical orientation is wrong
     807             :     //The wp:align tag is missing after roundtrip
     808           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     809           2 :     if (!pXmlDoc)
     810           3 :         return;
     811           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:align","1");
     812             : }
     813             : 
     814          14 : DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType, "LineStyle_DashType.docx")
     815             : {
     816             :     /* DOCX contatining Shape with LineStyle as Dash Type should get preserved inside
     817             :      * an XMl tag <a:prstDash> with value "dash".
     818             :      */
     819           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     820           2 :     if (!pXmlDoc)
     821           3 :         return;
     822           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dash");
     823             : }
     824             : 
     825          14 : DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx")
     826             : {
     827           2 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     828           2 :     if (!pXmlDocument)
     829           3 :         return;
     830             : 
     831             :     // check rgb colors for every step in the gradient of the first shape
     832             :     assertXPath(pXmlDocument,
     833             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr",
     834           1 :             "val", "ffff00");
     835             :     assertXPath(pXmlDocument,
     836             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr",
     837           1 :             "val", "ffff33");
     838             :     assertXPath(pXmlDocument,
     839             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[3]/a:srgbClr",
     840           1 :             "val", "ff0000");
     841             : 
     842             :     // check theme colors for every step in the gradient of the second shape
     843             :     assertXPath(pXmlDocument,
     844             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='0']/a:schemeClr",
     845           1 :             "val", "accent5");
     846             :     assertXPath(pXmlDocument,
     847             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr",
     848           1 :             "val", "accent1");
     849             :     assertXPath(pXmlDocument,
     850             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='100000']/a:schemeClr",
     851           1 :             "val", "accent1");
     852             : 
     853             :     assertXPath(pXmlDocument,
     854             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:srgbClr/a:alpha",
     855           1 :             "val", "20000");
     856             :     assertXPath(pXmlDocument,
     857             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:tint",
     858           1 :             "val", "44500");
     859             :     assertXPath(pXmlDocument,
     860             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:satMod",
     861           1 :             "val", "160000");
     862             : }
     863             : 
     864          14 : DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType_VML, "LineStyle_DashType_VML.docx")
     865             : {
     866             :     /* DOCX contatining "Shape with text inside" having Line Style as "Dash Type" should get
     867             :      * preserved inside an XML tag <v:stroke> with attribute dashstyle having value "dash".
     868             :      */
     869           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     870           2 :     if (!pXmlDoc)
     871           3 :         return;
     872           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash");
     873             : }
     874             : 
     875          14 : DECLARE_OOXMLEXPORT_TEST(testFdo74110,"fdo74110.docx")
     876             : {
     877             :     /*
     878             :     The File contains word art which is being exported as shape and the mapping is defaulted to
     879             :     shape type rect since the actual shape type(s) is/are commented out for some reason.
     880             :     The actual shape type(s) has/have adjustment value(s) where as rect does not have adjustment value.
     881             :     Hence the following test case.
     882             :     */
     883           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     884           2 :     if (!pXmlDoc)
     885           3 :         return;
     886             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]",
     887           1 :                 "prst", "rect");
     888           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",0);
     889             : }
     890             : 
     891          14 : DECLARE_OOXMLEXPORT_TEST(testOuterShdw,"testOuterShdw.docx")
     892             : {
     893           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     894           2 :     if (!pXmlDoc)
     895           3 :         return;
     896           1 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "57811035");
     897             : }
     898             : 
     899          14 : DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
     900             : {
     901           2 :     xmlDocPtr pXmlDoc = parseExport();
     902           2 :     if (!pXmlDoc)
     903           3 :         return;
     904           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0");
     905             : }
     906             : 
     907          14 : DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx")
     908             : {
     909             :     /* Number of children required by cubicBexTo is 3 of type "pt".
     910             :        While exporting, sometimes the child nodes are less than 3.
     911             :        The test case ensures that there are 3 child nodes of type "pt"
     912             :        for cubicBexTo
     913             :      */
     914           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     915           2 :     if (!pXmlDoc)
     916           3 :         return;
     917             : 
     918             :     assertXPath( pXmlDoc,
     919           1 :         "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[3]/wps:spPr[1]/a:custGeom[1]/a:pathLst[1]/a:path[1]/a:cubicBezTo[2]/a:pt[3]");
     920             : }
     921             : 
     922          14 : DECLARE_OOXMLEXPORT_TEST(testMSwordHang,"test_msword_hang.docx")
     923             : {
     924             :     // fdo#74771:
     925           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     926           2 :     if (!pXmlDoc)
     927           3 :         return;
     928           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r[2]/w:drawing/wp:inline", "distT", "0");
     929             : }
     930             : 
     931          14 : DECLARE_OOXMLEXPORT_TEST(testGroupshapeThemeFont, "groupshape-theme-font.docx")
     932             : {
     933             :     // Font was specified using a theme reference, which wasn't handled.
     934           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     935           4 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(0), uno::UNO_QUERY)->getText();
     936           4 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
     937             :     // This was Calibri.
     938           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Cambria"), getProperty<OUString>(xRun, "CharFontName"));
     939           2 : }
     940             : 
     941          14 : DECLARE_OOXMLEXPORT_TEST(testAnchorIdForWP14AndW14, "AnchorId.docx")
     942             : {
     943           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     944           2 :     if (!pXmlDoc)
     945           3 :         return;
     946             : 
     947           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:inline", "anchorId", "78735EFD");
     948           1 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "anchorId", "78735EFD");
     949             : 
     950             : 
     951             : }
     952             : 
     953          14 : DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx")
     954             : {
     955             :     // <a:pattFill prst="dkVert"> was exported as ltVert.
     956           2 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     957           4 :     uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
     958             :     // This was 50.
     959           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<drawing::Hatch>(xShape, "FillHatch").Distance);
     960           2 : }
     961             : 
     962          14 : DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx")
     963             : {
     964             :     //The problem was that the watermark ID was not preserved,
     965             :     //and Word uses the object ID to identify if it is a watermark.
     966             :     //It has to have the 'PowerPlusWaterMarkObject' string in it
     967           2 :     xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
     968           2 :     if (!pXmlHeader1)
     969           3 :        return;
     970             : 
     971           1 :     assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id","PowerPlusWaterMarkObject93701316");
     972             : }
     973             : 
     974          14 : DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx")
     975             : {
     976             :     //The problem was that the watermark ID was not preserved,
     977             :     //and Word uses the object ID to identify if it is a watermark.
     978             :     //It has to have the 'WordPictureWaterMarkObject' string in it
     979             : 
     980           2 :     xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
     981           2 :     if (!pXmlHeader1)
     982           3 :        return;
     983             : 
     984             :     // Check the watermark ID
     985           1 :     assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]","id","WordPictureWatermark11962361");
     986             : }
     987             : 
     988             : 
     989          14 : DECLARE_OOXMLEXPORT_TEST(testFdo76249, "fdo76249.docx")
     990             : {
     991             :     /*
     992             :      * The Locked Canvas is imported correctly, but while exporting
     993             :      * the drawing element is exported inside a textbox. However a the drawing has to exported
     994             :      * as a Locked Canvas inside a text-box for the RT file to work in MS Word, as drawing elements
     995             :      * are not allowed inside the textboxes.
     996             :      */
     997           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     998           2 :     if (!pXmlDoc)
     999           3 :        return;
    1000           1 :     assertXPath(pXmlDoc, "//mc:Choice/w:drawing//w:txbxContent//w:drawing//lc:lockedCanvas", 1);
    1001             : }
    1002             : 
    1003          14 : DECLARE_OOXMLEXPORT_TEST(testFdo76979, "fdo76979.docx")
    1004             : {
    1005             :     // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML.
    1006           2 :     xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
    1007           2 :     if (!pXmlDoc)
    1008           3 :        return;
    1009             :     // This was "auto", not "FFFFFF".
    1010           1 :     assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", "FFFFFF");
    1011             : }
    1012             : 
    1013             : #endif
    1014             : 
    1015           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    1016             : 
    1017             : 
    1018             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10