LCOV - code coverage report
Current view: top level - sd/qa/unit - export-tests.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 250 250 100.0 %
Date: 2014-11-03 Functions: 22 23 95.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 "sdmodeltestbase.hxx"
      11             : #include "Outliner.hxx"
      12             : 
      13             : #include <svl/stritem.hxx>
      14             : #include <editeng/editobj.hxx>
      15             : #include <editeng/outlobj.hxx>
      16             : #include <editeng/ulspitem.hxx>
      17             : #include <editeng/fhgtitem.hxx>
      18             : #include <editeng/escapementitem.hxx>
      19             : #include <editeng/colritem.hxx>
      20             : #include <editeng/fontitem.hxx>
      21             : #include <editeng/wghtitem.hxx>
      22             : #include <editeng/numitem.hxx>
      23             : #include <editeng/lrspitem.hxx>
      24             : #include <editeng/postitem.hxx>
      25             : #include <editeng/bulletitem.hxx>
      26             : 
      27             : #include <rsc/rscsfx.hxx>
      28             : 
      29             : #include <svx/svdoutl.hxx>
      30             : #include <svx/svdotext.hxx>
      31             : #include <svx/svdoashp.hxx>
      32             : #include <svx/svdograf.hxx>
      33             : #include <svx/svdogrp.hxx>
      34             : #include <svx/svdomedia.hxx>
      35             : #include <svx/svdoole2.hxx>
      36             : #include <svx/xflclit.hxx>
      37             : #include <animations/animationnodehelper.hxx>
      38             : 
      39             : #include <com/sun/star/drawing/XDrawPage.hpp>
      40             : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      41             : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
      42             : #include <com/sun/star/animations/XAnimationNode.hpp>
      43             : #include <com/sun/star/animations/XAnimate.hpp>
      44             : #include <com/sun/star/beans/XPropertySet.hpp>
      45             : #include <com/sun/star/chart/XChartDocument.hpp>
      46             : #include <com/sun/star/chart2/XChartDocument.hpp>
      47             : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
      48             : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
      49             : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      50             : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
      51             : #include <com/sun/star/chart2/data/XDataSequence.hpp>
      52             : #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
      53             : 
      54             : #include <config_features.h>
      55             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      56             : 
      57             : using namespace ::com::sun::star;
      58             : 
      59          72 : class SdExportTest : public SdModelTestBase
      60             : {
      61             : public:
      62             :     void testN821567();
      63             :     void testBnc870233_1();
      64             :     void testBnc870233_2();
      65             :     void testN828390_4();
      66             :     void testN828390_5();
      67             :     void testMediaEmbedding();
      68             :     void testFdo71961();
      69             :     void testN828390();
      70             :     void testBnc880763();
      71             :     void testBnc862510_5();
      72             :     void testBnc822347_EmptyBullet();
      73             :     void testFdo83751();
      74             : 
      75           4 :     CPPUNIT_TEST_SUITE(SdExportTest);
      76           2 :     CPPUNIT_TEST(testN821567);
      77           2 :     CPPUNIT_TEST(testBnc870233_1);
      78           2 :     CPPUNIT_TEST(testBnc870233_2);
      79           2 :     CPPUNIT_TEST(testN828390_4);
      80           2 :     CPPUNIT_TEST(testN828390_5);
      81           2 :     CPPUNIT_TEST(testMediaEmbedding);
      82           2 :     CPPUNIT_TEST(testFdo71961);
      83           2 :     CPPUNIT_TEST(testN828390);
      84           2 :     CPPUNIT_TEST(testBnc880763);
      85           2 :     CPPUNIT_TEST(testBnc862510_5);
      86           2 :     CPPUNIT_TEST(testBnc822347_EmptyBullet);
      87           2 :     CPPUNIT_TEST(testFdo83751);
      88           4 :     CPPUNIT_TEST_SUITE_END();
      89             : };
      90             : 
      91           2 : void SdExportTest::testN821567()
      92             : {
      93           2 :     OUString bgImage;
      94           4 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX );
      95             : 
      96           2 :     xDocShRef = saveAndReload( xDocShRef, ODP );
      97             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
      98           4 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
      99           2 :     CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
     100             :     uno::Reference< drawing::XDrawPage > xPage(
     101           4 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     102             : 
     103           4 :     uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
     104           4 :     uno::Any aAny = xPropSet->getPropertyValue( OUString("Background") );
     105           2 :     if(aAny.hasValue())
     106             :     {
     107           2 :         uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
     108           2 :         aAny >>= aXBackgroundPropSet;
     109           2 :         aAny = aXBackgroundPropSet->getPropertyValue( OUString("FillBitmapName"));
     110           2 :         aAny >>= bgImage;
     111             :     }
     112           2 :     CPPUNIT_ASSERT_MESSAGE("Slide Background is not exported properly", !bgImage.isEmpty());
     113             : 
     114           4 :     xDocShRef->DoClose();
     115           2 : }
     116             : 
     117             : namespace {
     118             : 
     119          10 : void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor,
     120             :         bool bCheckWeight, FontWeight eWeight, bool bCheckItalic, FontItalic eItalic)
     121             : {
     122          10 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     123          10 :     const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject();
     124          10 :     std::vector<EECharAttrib> rLst;
     125          10 :     aEdit.GetCharAttribs(0, rLst);
     126         186 :     for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     127             :     {
     128         176 :         const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr);
     129         176 :         if( pCharColor )
     130             :         {
     131          10 :             CPPUNIT_ASSERT_EQUAL( nColor, pCharColor->GetValue().GetColor());
     132             :         }
     133             : 
     134         176 :         if(bCheckWeight)
     135             :         {
     136          68 :             const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
     137          68 :             if( pWeight )
     138             :             {
     139          12 :                 CPPUNIT_ASSERT_EQUAL( eWeight, pWeight->GetWeight());
     140             :             }
     141             :         }
     142             : 
     143         176 :         if(bCheckItalic)
     144             :         {
     145          68 :             const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr);
     146          68 :             if( pPosture )
     147             :             {
     148          12 :                 CPPUNIT_ASSERT_EQUAL( eItalic, pPosture->GetPosture());
     149             :             }
     150             :         }
     151          10 :     }
     152             : 
     153          10 : }
     154             : 
     155             : }
     156             : 
     157           2 : void SdExportTest::testBnc870233_1()
     158             : {
     159           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
     160           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     161             : 
     162           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     163           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     164           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     165           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     166             : 
     167             :     // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
     168             : 
     169             :     // First shape has red, bold font
     170             :     {
     171           2 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
     172             :         checkFontAttributes(pObj, sal_uInt32(0xff0000),
     173           2 :                 true, WEIGHT_BOLD, true, ITALIC_NONE);
     174             :     }
     175             : 
     176             :     // Second shape has blue, italic font
     177             :     {
     178           2 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
     179             :         checkFontAttributes(pObj, sal_uInt32(0x0000ff),
     180           2 :                 true, WEIGHT_NORMAL, true, ITALIC_NORMAL);
     181             :     }
     182             : 
     183           2 :     xDocShRef->DoClose();
     184           2 : }
     185             : 
     186           2 : void SdExportTest::testBnc870233_2()
     187             : {
     188           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
     189           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     190             : 
     191           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     192           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     193           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     194           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     195             : 
     196             :     // The problem was in some SmartArts font color was wrong
     197             : 
     198             :     // First smart art has blue font color (direct formatting)
     199             :     {
     200           2 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
     201             :         checkFontAttributes(pObj, sal_uInt32(0x0000ff),
     202           2 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     203             :     }
     204             : 
     205             :     // Second smart art has "dk2" font color (style)
     206             :     {
     207           2 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
     208             :         checkFontAttributes(pObj, sal_uInt32(0x1F497D),
     209           2 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     210             :     }
     211             : 
     212             :     // Third smart art has white font color (style)
     213             :     {
     214           2 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) );
     215             :         checkFontAttributes(pObj, sal_uInt32(0xffffff),
     216           2 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     217             :     }
     218             : 
     219           2 :     xDocShRef->DoClose();
     220           2 : }
     221             : 
     222           2 : void SdExportTest::testN828390_4()
     223             : {
     224           2 :     bool bPassed = false;
     225           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP );
     226             : 
     227           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     228             : 
     229           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     230           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     231           2 :     const SdrPage *pPage = pDoc->GetPage(1);
     232           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     233             :     {
     234           2 :         std::vector<EECharAttrib> rLst;
     235           2 :         SdrObject *pObj = pPage->GetObj(0);
     236           2 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     237           2 :         CPPUNIT_ASSERT( pTxtObj );
     238           2 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     239           2 :         aEdit.GetCharAttribs(1, rLst);
     240          32 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     241             :         {
     242          30 :             const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
     243          30 :             if( pFontHeight )
     244           6 :                 CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 1129 );
     245          30 :             const SvxFontItem *pFont = dynamic_cast<const SvxFontItem *>((*it).pAttr);
     246          30 :             if( pFont )
     247             :             {
     248           2 :                 CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont->GetFamilyName().equalsAscii("Arial"));
     249           2 :                 bPassed = true;
     250             :             }
     251          30 :             const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
     252          30 :             if( pWeight )
     253           6 :                 CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight->GetWeight() == WEIGHT_BOLD);
     254           2 :         }
     255             :     }
     256           2 :     CPPUNIT_ASSERT(bPassed);
     257             : 
     258           2 :     xDocShRef->DoClose();
     259           2 : }
     260             : 
     261           2 : void SdExportTest::testN828390_5()
     262             : {
     263           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP );
     264             : 
     265           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     266             : 
     267           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     268           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     269           2 :     const SdrPage *pPage = pDoc->GetPage(1);
     270           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     271             :     {
     272           2 :         SdrObject *pObj = pPage->GetObj(0);
     273           2 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     274           2 :         CPPUNIT_ASSERT( pTxtObj );
     275           2 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     276           2 :         const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5));
     277           2 :         CPPUNIT_ASSERT( pNumFmt );
     278           2 :         CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25
     279             :     }
     280             : 
     281           2 :     xDocShRef->DoClose();
     282           2 : }
     283             : 
     284           2 : void SdExportTest::testMediaEmbedding()
     285             : {
     286           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP);
     287             : 
     288             : #if HAVE_FEATURE_GLTF
     289           2 :     xDocShRef = saveAndReload( xDocShRef, ODP );
     290             : #endif
     291             : 
     292           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     293           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     294           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     295           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     296             : 
     297             : #if HAVE_FEATURE_GLTF
     298             :     // First object is a glTF model
     299           2 :     SdrMediaObj *pModelObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 2 ));
     300           2 :     CPPUNIT_ASSERT_MESSAGE( "missing model", pModelObj != NULL);
     301           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/duck/duck.json" ), pModelObj->getMediaProperties().getURL());
     302           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "model/vnd.gltf+json" ), pModelObj->getMediaProperties().getMimeType());
     303             : #else
     304             :     // If glTF is not supported, then the fallback image is imported
     305             :     SdrGrafObj *pGrafic = dynamic_cast<SdrGrafObj*>( pPage->GetObj( 2 ));
     306             :     CPPUNIT_ASSERT_MESSAGE( "Could not load glTF fallback image", pGrafic != NULL);
     307             :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/Fallbacks/duck.png" ), pGrafic->GetGrafStreamURL());
     308             : #endif
     309             : 
     310             :     // Second object is a sound
     311           2 :     SdrMediaObj *pMediaObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 3 ));
     312           2 :     CPPUNIT_ASSERT_MESSAGE( "missing media object", pMediaObj != NULL);
     313           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Media/button-1.wav" ), pMediaObj->getMediaProperties().getURL());
     314           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType());
     315             : 
     316           2 :     xDocShRef->DoClose();
     317           2 : }
     318             : 
     319           2 : void SdExportTest::testFdo71961()
     320             : {
     321           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
     322             : 
     323           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     324             : 
     325           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     326           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     327           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     328           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     329             : 
     330             :     // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
     331             :     // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
     332           2 :     SdrObjCustomShape *pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 1 ));
     333           2 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     334           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Text to be always wrapped" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     335           2 :     CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     336             : 
     337           2 :     pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 2 ));
     338           2 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     339           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape non-wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     340           2 :     CPPUNIT_ASSERT_EQUAL( false, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     341             : 
     342           2 :     pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 3 ));
     343           2 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     344           2 :     CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     345           2 :     CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     346             : 
     347           2 :     xDocShRef->DoClose();
     348           2 : }
     349             : 
     350           2 : void SdExportTest::testN828390()
     351             : {
     352           2 :     bool bPassed = false;
     353           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX );
     354             : 
     355           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     356             : 
     357           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     358           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     359           2 :     const SdrPage *pPage = pDoc->GetPage(1);
     360           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     361             :     {
     362           2 :         std::vector<EECharAttrib> rLst;
     363             :         // Get the object
     364           2 :         SdrObject *pObj = pPage->GetObj(0);
     365           2 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     366           2 :         CPPUNIT_ASSERT( pTxtObj );
     367           2 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     368           2 :         aEdit.GetCharAttribs(0, rLst);
     369          14 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     370             :         {
     371          14 :             const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
     372          14 :             if(pFontEscapement)
     373             :             {
     374           4 :                 if( pFontEscapement->GetEsc() == -25 )
     375             :                 {
     376           2 :                     bPassed = true;
     377           2 :                     break;
     378             :                 }
     379             :             }
     380           2 :         }
     381             :     }
     382           2 :     CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed);
     383             : 
     384           2 :     xDocShRef->DoClose();
     385           2 : }
     386             : 
     387           2 : void SdExportTest::testBnc880763()
     388             : {
     389           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
     390           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     391             : 
     392           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     393           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     394           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     395           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     396             : 
     397             :     // Check z-order of the two shapes, use background color to identify them
     398             :     // First object in the background has blue background color
     399           2 :     const SdrObject *pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 0 ) );
     400           2 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     401           2 :     CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
     402             : 
     403             :     // Second object at the front has green background color
     404           2 :     pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 1 ) );
     405           2 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     406           2 :     CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
     407             : 
     408           2 :     xDocShRef->DoClose();
     409           2 : }
     410             : 
     411           2 : void SdExportTest::testBnc862510_5()
     412             : {
     413           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
     414           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     415             : 
     416           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     417           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     418           2 :     const SdrPage *pPage = pDoc->GetPage (1);
     419           2 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     420             : 
     421             :     // Same as testBnc870237, but here we check the horizontal spacing
     422           2 :     const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj( 1 ) );
     423           2 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     424           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
     425           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
     426           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(7510), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
     427           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
     428             : 
     429           2 :     xDocShRef->DoClose();
     430           2 : }
     431             : 
     432             : // In numbering a bullet could be defined as empty (no character).
     433             : // When exporting to OOXML make sure that the bullet is ignored and
     434             : // not written into the file.
     435           2 : void SdExportTest::testBnc822347_EmptyBullet()
     436             : {
     437           2 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP);
     438           2 :     xDocShRef = saveAndReload(xDocShRef, PPTX);
     439             : 
     440           2 :     SdDrawDocument* pDoc = xDocShRef->GetDoc();
     441           2 :     SdrOutliner* pOutliner = pDoc->GetInternalOutliner();
     442           2 :     const SdrPage* pPage = pDoc->GetPage(1);
     443           2 :     SdrObject* pObject = pPage->GetObj(0);
     444           2 :     SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
     445           2 :     CPPUNIT_ASSERT(pTextObject);
     446             : 
     447           2 :     OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
     448           2 :     const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
     449             : 
     450           4 :     OUString sText = aEdit.GetText(0);
     451           2 :     CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText);
     452             : 
     453           2 :     pOutliner->SetText(*pOutlinerParagraphObject);
     454           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner->GetParagraphCount());
     455             : 
     456           2 :     const sal_Int16 nDepth = pOutliner->GetDepth(0);
     457             : 
     458           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth); // depth >= 0 means that the paragraph has bullets enabled
     459             : 
     460           4 :     xDocShRef->DoClose();
     461           2 : }
     462             : 
     463           2 : void SdExportTest::testFdo83751()
     464             : {
     465           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX);
     466           2 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     467             : 
     468           2 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     469           2 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     470             : 
     471           4 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
     472           4 :     uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY );
     473           4 :     uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
     474           4 :     OUString propValue;
     475           2 :     xUDProps->getPropertyValue(OUString("Testing")) >>= propValue;
     476           2 :     CPPUNIT_ASSERT_EQUAL(OUString("Document"), propValue);
     477           4 :     xDocShRef->DoClose();
     478           2 : }
     479             : 
     480           2 : CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
     481             : 
     482           8 : CPPUNIT_PLUGIN_IMPLEMENT();
     483             : 
     484             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10