2012-01-13 04:30:48 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
2013-04-19 21:10:42 +01:00
|
|
|
* This file is part of the LibreOffice project.
|
2012-01-13 04:30:48 +01:00
|
|
|
*
|
2013-04-19 21:10:42 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2012-01-13 04:30:48 +01:00
|
|
|
*/
|
|
|
|
|
2013-05-14 11:47:34 +02:00
|
|
|
#include "sdmodeltestbase.hxx"
|
2012-01-13 04:30:48 +01:00
|
|
|
|
|
|
|
#include <svl/stritem.hxx>
|
2012-08-14 17:04:40 +05:30
|
|
|
#include <editeng/editobj.hxx>
|
|
|
|
#include <editeng/outlobj.hxx>
|
|
|
|
#include <editeng/ulspitem.hxx>
|
|
|
|
#include <editeng/fhgtitem.hxx>
|
2013-11-14 13:43:09 +05:30
|
|
|
#include <editeng/escapementitem.hxx>
|
2013-11-25 19:39:20 +05:30
|
|
|
#include <editeng/colritem.hxx>
|
2013-12-18 20:01:11 +05:30
|
|
|
#include <editeng/fontitem.hxx>
|
|
|
|
#include <editeng/wghtitem.hxx>
|
2013-12-19 18:14:47 +05:30
|
|
|
#include <editeng/numitem.hxx>
|
2013-11-25 19:39:20 +05:30
|
|
|
#include <rsc/rscsfx.hxx>
|
2012-08-14 17:04:40 +05:30
|
|
|
|
2013-05-14 11:47:34 +02:00
|
|
|
#include <svx/svdotext.hxx>
|
2013-12-30 18:05:48 +05:30
|
|
|
#include <svx/svdoashp.hxx>
|
2013-05-18 01:25:52 +02:00
|
|
|
#include <animations/animationnodehelper.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/drawing/XDrawPage.hpp>
|
|
|
|
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
|
|
|
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
|
|
|
|
#include <com/sun/star/animations/XAnimationNode.hpp>
|
|
|
|
#include <com/sun/star/animations/XAnimate.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2013-11-06 15:37:20 +05:30
|
|
|
#include <com/sun/star/chart/XChartDocument.hpp>
|
|
|
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
|
|
|
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
|
|
|
|
#include <com/sun/star/chart2/data/XDataSequence.hpp>
|
|
|
|
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
|
2012-01-13 04:30:48 +01:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2013-05-14 11:47:34 +02:00
|
|
|
/// Impress import filters tests.
|
|
|
|
class SdFiltersTest : public SdModelTestBase
|
2012-01-13 04:30:48 +01:00
|
|
|
{
|
|
|
|
public:
|
2013-05-14 11:47:34 +02:00
|
|
|
void testDocumentLayout();
|
2013-05-14 11:54:37 +02:00
|
|
|
void testSmoketest();
|
2012-08-14 17:04:40 +05:30
|
|
|
void testN759180();
|
2013-05-14 12:06:11 +02:00
|
|
|
void testN778859();
|
2013-05-18 01:25:52 +02:00
|
|
|
void testFdo64512();
|
2013-11-06 15:37:20 +05:30
|
|
|
void testFdo71075();
|
2013-11-14 13:43:09 +05:30
|
|
|
void testN828390();
|
2013-12-12 13:19:36 +05:30
|
|
|
void testN828390_2();
|
2013-12-12 18:54:00 +05:30
|
|
|
void testN828390_3();
|
2013-12-18 20:01:11 +05:30
|
|
|
void testN828390_4();
|
2013-12-19 18:14:47 +05:30
|
|
|
void testN828390_5();
|
2013-11-25 19:39:20 +05:30
|
|
|
void testFdo68594();
|
2013-12-30 18:05:48 +05:30
|
|
|
void testFdo72998();
|
2012-01-13 04:30:48 +01:00
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE(SdFiltersTest);
|
2013-05-14 11:47:34 +02:00
|
|
|
CPPUNIT_TEST(testDocumentLayout);
|
2013-05-14 11:54:37 +02:00
|
|
|
CPPUNIT_TEST(testSmoketest);
|
2012-08-14 17:04:40 +05:30
|
|
|
CPPUNIT_TEST(testN759180);
|
2013-05-14 12:06:11 +02:00
|
|
|
CPPUNIT_TEST(testN778859);
|
2013-05-18 01:25:52 +02:00
|
|
|
CPPUNIT_TEST(testFdo64512);
|
2013-11-06 15:37:20 +05:30
|
|
|
CPPUNIT_TEST(testFdo71075);
|
2013-11-14 13:43:09 +05:30
|
|
|
CPPUNIT_TEST(testN828390);
|
2013-12-12 13:19:36 +05:30
|
|
|
CPPUNIT_TEST(testN828390_2);
|
2013-12-12 18:54:00 +05:30
|
|
|
CPPUNIT_TEST(testN828390_3);
|
2013-12-18 20:01:11 +05:30
|
|
|
CPPUNIT_TEST(testN828390_4);
|
2013-12-19 18:14:47 +05:30
|
|
|
CPPUNIT_TEST(testN828390_5);
|
2013-11-25 19:39:20 +05:30
|
|
|
CPPUNIT_TEST(testFdo68594);
|
2013-12-30 18:05:48 +05:30
|
|
|
CPPUNIT_TEST(testFdo72998);
|
2013-11-06 15:37:20 +05:30
|
|
|
|
2012-01-13 04:30:48 +01:00
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
};
|
|
|
|
|
2013-05-14 11:47:34 +02:00
|
|
|
/** Test document against a reference XML dump of shapes.
|
2012-01-13 04:30:48 +01:00
|
|
|
|
2013-06-21 13:13:26 +02:00
|
|
|
If you want to update one of these tests, or add a new one, set the nUpdateMe
|
|
|
|
to the index of the test, and the dump XML's will be created (or rewritten)
|
|
|
|
instead of checking. Use with care - when the test is failing, first find out
|
|
|
|
why, instead of just updating .xml's blindly.
|
|
|
|
|
|
|
|
Example: Let's say you are adding a test called fdoABCD.pptx. You'll place it
|
|
|
|
to the data/ subdirectory, and will add an entry to aFilesToCompare below,
|
2013-11-14 13:43:09 +05:30
|
|
|
the 3rd parameter is for export test - can be -1 (don't export), ODP, PPT or PPTX
|
2013-06-21 13:13:26 +02:00
|
|
|
like:
|
|
|
|
|
2013-11-14 13:43:09 +05:30
|
|
|
{ "fdoABCD.pptx", "xml/fdoABCD_", PPTX },
|
2013-06-21 13:13:26 +02:00
|
|
|
|
|
|
|
and will count the index in the aFilesToCompare structure (1st is 0, 2nd is 1,
|
|
|
|
etc.) Temporarily you'll set nUpdateMe to this index (instead of -1), and run
|
|
|
|
|
|
|
|
make sd
|
|
|
|
|
|
|
|
This will generate the sd/qa/unit/data/xml/fdoABCD_*.xml for you. Now you
|
|
|
|
will change nUpdateMe back to -1, and commit your fdoABCD.pptx test, the
|
|
|
|
xml/fdoABCD_*.xml dumps, and the aFilesToCompare addition in one commit.
|
|
|
|
|
|
|
|
As the last step, you will revert your fix and do 'make sd' again, to check
|
|
|
|
that without your fix, the unit test breaks. Then clean up, and push :-)
|
2013-05-14 16:39:14 +02:00
|
|
|
|
|
|
|
NOTE: This approach is suitable only for tests of fixes that actually change
|
|
|
|
the layout - best to check by reverting your fix locally after having added
|
|
|
|
the test, and re-running; it should break.
|
2013-05-14 11:47:34 +02:00
|
|
|
*/
|
|
|
|
void SdFiltersTest::testDocumentLayout()
|
2012-01-13 04:30:48 +01:00
|
|
|
{
|
2013-11-13 20:45:18 +05:30
|
|
|
struct { const char *pInput, *pDump; sal_Int32 nExportType; } aFilesToCompare[] =
|
2012-01-13 04:30:48 +01:00
|
|
|
{
|
2013-11-13 20:45:18 +05:30
|
|
|
{ "odp/shapes-test.odp", "xml/shapes-test_page", -1 },
|
2013-12-08 14:13:14 +07:00
|
|
|
{ "fdo47434.pptx", "xml/fdo47434_", -1 },
|
2013-11-13 20:45:18 +05:30
|
|
|
{ "n758621.ppt", "xml/n758621_", -1 },
|
|
|
|
{ "fdo64586.ppt", "xml/fdo64586_", -1 },
|
|
|
|
{ "n819614.pptx", "xml/n819614_", -1 },
|
|
|
|
{ "n820786.pptx", "xml/n820786_", -1 },
|
|
|
|
{ "n762695.pptx", "xml/n762695_", -1 },
|
|
|
|
{ "n593612.pptx", "xml/n593612_", -1 },
|
2013-12-08 14:28:37 +07:00
|
|
|
{ "fdo71434.pptx", "xml/fdo71434_", -1 },
|
2013-11-13 20:45:18 +05:30
|
|
|
// { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX }, // Example
|
2013-05-14 11:47:34 +02:00
|
|
|
};
|
2012-01-13 04:30:48 +01:00
|
|
|
|
2013-05-14 16:39:14 +02:00
|
|
|
for ( int i = 0; i < static_cast< int >( SAL_N_ELEMENTS( aFilesToCompare ) ); ++i )
|
2012-01-13 04:30:48 +01:00
|
|
|
{
|
2013-05-14 16:39:14 +02:00
|
|
|
int nUpdateMe = -1; // index of test we want to update; supposedly only when the test is created
|
|
|
|
|
2013-05-14 11:47:34 +02:00
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ) );
|
2013-11-13 20:45:18 +05:30
|
|
|
if( aFilesToCompare[i].nExportType >= 0 )
|
|
|
|
xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType );
|
2013-05-14 16:39:14 +02:00
|
|
|
compareWithShapesDump( xDocShRef,
|
|
|
|
getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ),
|
|
|
|
i == nUpdateMe );
|
2012-01-13 04:30:48 +01:00
|
|
|
}
|
2012-06-15 16:12:52 +02:00
|
|
|
}
|
|
|
|
|
2013-05-14 11:54:37 +02:00
|
|
|
void SdFiltersTest::testSmoketest()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
|
|
|
|
// cf. SdrModel svx/svdmodel.hxx ...
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "wrong page count", pDoc->GetPageCount() == 3);
|
|
|
|
|
|
|
|
const SdrPage *pPage = pDoc->GetPage (1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
|
|
|
|
sal_uIntPtr nObjs = pPage->GetObjCount();
|
|
|
|
for (sal_uIntPtr i = 0; i < nObjs; i++)
|
|
|
|
{
|
|
|
|
SdrObject *pObj = pPage->GetObj(i);
|
|
|
|
SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
|
|
|
|
SdrTextObj *pTxt = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
(void)pTxt; (void)eKind;
|
|
|
|
}
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "changed", !pDoc->IsChanged() );
|
|
|
|
xDocShRef->DoClose();
|
|
|
|
}
|
|
|
|
|
2012-08-14 17:04:40 +05:30
|
|
|
void SdFiltersTest::testN759180()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage (1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
|
|
|
|
//sal_uIntPtr nObjs = pPage->GetObjCount();
|
|
|
|
//for (sal_uIntPtr i = 0; i < nObjs; i++)
|
|
|
|
{
|
|
|
|
// Get the object
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
CPPUNIT_ASSERT(pTxtObj);
|
|
|
|
std::vector<EECharAttrib> rLst;
|
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
const SvxULSpaceItem *pULSpace = dynamic_cast<const SvxULSpaceItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_ULSPACE));
|
|
|
|
CPPUNIT_ASSERT(pULSpace);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Para bottom spacing is wrong!", pULSpace->GetLower() == 0 );
|
|
|
|
aEdit.GetCharAttribs(1, rLst);
|
2012-09-16 00:48:05 +02:00
|
|
|
for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
|
2012-08-14 17:04:40 +05:30
|
|
|
{
|
|
|
|
const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
|
|
|
|
if(pFontHeight)
|
|
|
|
{
|
|
|
|
// nStart == 9
|
|
|
|
// font height = 5 => 5*2540/72
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 176 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-14 13:43:09 +05:30
|
|
|
void SdFiltersTest::testN828390()
|
|
|
|
{
|
|
|
|
bool bPassed = false;
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
|
|
|
|
xDocShRef = saveAndReload( xDocShRef, PPTX );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
{
|
|
|
|
std::vector<EECharAttrib> rLst;
|
|
|
|
// Get the object
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
aEdit.GetCharAttribs(0, rLst);
|
|
|
|
for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
|
|
|
|
{
|
|
|
|
const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
|
|
|
|
if(pFontEscapement)
|
|
|
|
{
|
|
|
|
if( pFontEscapement->GetEsc() == -25 )
|
|
|
|
{
|
|
|
|
bPassed = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed);
|
|
|
|
}
|
|
|
|
|
2013-12-12 13:19:36 +05:30
|
|
|
void SdFiltersTest::testN828390_2()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
CPPUNIT_ASSERT(aEdit.GetText(0) == OUString("Linux "));
|
|
|
|
CPPUNIT_ASSERT(aEdit.GetText(1) == OUString("Standard Platform"));
|
|
|
|
}
|
|
|
|
|
2013-12-12 18:54:00 +05:30
|
|
|
void SdFiltersTest::testN828390_3()
|
|
|
|
{
|
|
|
|
bool bPassed = true;
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
std::vector<EECharAttrib> rLst;
|
|
|
|
aEdit.GetCharAttribs(1, rLst);
|
|
|
|
for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
|
|
|
|
{
|
|
|
|
const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
|
|
|
|
if(pFontEscapement)
|
|
|
|
{
|
|
|
|
if( pFontEscapement->GetEsc() != 0 )
|
|
|
|
{
|
|
|
|
bPassed = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT_MESSAGE("CharEscapment not imported properly", bPassed);
|
|
|
|
}
|
|
|
|
|
2013-12-18 20:01:11 +05:30
|
|
|
void SdFiltersTest::testN828390_4()
|
|
|
|
{
|
|
|
|
bool bPassed = false;
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
|
|
|
|
xDocShRef = saveAndReload( xDocShRef, PPTX );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
{
|
|
|
|
std::vector<EECharAttrib> rLst;
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
2014-02-07 11:37:37 +00:00
|
|
|
CPPUNIT_ASSERT( pTxtObj );
|
2013-12-18 20:01:11 +05:30
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
aEdit.GetCharAttribs(1, rLst);
|
|
|
|
for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
|
|
|
|
{
|
|
|
|
const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
|
|
|
|
if( pFontHeight )
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 1129 );
|
|
|
|
const SvxFontItem *pFont = dynamic_cast<const SvxFontItem *>((*it).pAttr);
|
|
|
|
if( pFont )
|
|
|
|
{
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont->GetFamilyName().equalsAscii("Arial"));
|
|
|
|
bPassed = true;
|
|
|
|
}
|
|
|
|
const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
|
|
|
|
if( pWeight )
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight->GetWeight() == WEIGHT_BOLD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT(bPassed);
|
|
|
|
}
|
|
|
|
|
2013-12-19 18:14:47 +05:30
|
|
|
void SdFiltersTest::testN828390_5()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
|
|
|
|
xDocShRef = saveAndReload( xDocShRef, PPTX );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
{
|
|
|
|
SdrObject *pObj = pPage->GetObj(0);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
2014-02-07 11:37:04 +00:00
|
|
|
CPPUNIT_ASSERT( pTxtObj );
|
2013-12-19 18:14:47 +05:30
|
|
|
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
|
|
|
|
const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5));
|
|
|
|
CPPUNIT_ASSERT( pNumFmt );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Bullet's relative size is wrong!", pNumFmt->GetNumRule()->GetLevel(1).GetBulletRelSize() == 75 ); // != 25
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-14 12:06:11 +02:00
|
|
|
void SdFiltersTest::testN778859()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
{
|
|
|
|
// Get the object
|
|
|
|
SdrObject *pObj = pPage->GetObj(1);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
CPPUNIT_ASSERT(!pTxtObj->IsAutoFit());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-25 19:39:20 +05:30
|
|
|
void SdFiltersTest::testFdo68594()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = &(pDoc->GetPage (1)->TRG_GetMasterPage());
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
SdrObject *pObj = pPage->GetObj(1);
|
|
|
|
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
|
|
|
|
const SvxColorItem *pC = dynamic_cast<const SvxColorItem *>(&pTxtObj->GetMergedItem(EE_CHAR_COLOR));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no color item", pC != NULL);
|
|
|
|
// Color should be black
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Placeholder color mismatch", pC->GetValue().GetColor() == 0);
|
|
|
|
}
|
|
|
|
|
2013-12-30 18:05:48 +05:30
|
|
|
void SdFiltersTest::testFdo72998()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
const SdrPage *pPage = pDoc->GetPage(1);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
|
|
|
|
{
|
|
|
|
SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>(pPage->GetObj(2));
|
|
|
|
const SdrCustomShapeGeometryItem& rGeometryItem = (const SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not a custom shape", pObj );
|
|
|
|
const ::com::sun::star::uno::Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( OUString( "ViewBox" ) );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Missing ViewBox", pViewBox );
|
|
|
|
com::sun::star::awt::Rectangle aViewBox;
|
|
|
|
CPPUNIT_ASSERT( (*pViewBox >>= aViewBox ) );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Width should be zero - for forcing scale to 1", !aViewBox.Width );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Height should be zero - for forcing scale to 1", !aViewBox.Height );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-18 01:25:52 +02:00
|
|
|
void SdFiltersTest::testFdo64512()
|
|
|
|
{
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
uno::Reference< drawing::XDrawPagesSupplier > xDoc(
|
|
|
|
xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
|
|
|
|
|
|
|
|
uno::Reference< drawing::XDrawPage > xPage(
|
|
|
|
xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no exactly three shapes", xPage->getCount() == 3 );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xConnectorShape(
|
|
|
|
xPage->getByIndex(2), uno::UNO_QUERY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no connector shape", xConnectorShape.is() );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xSvgShape(
|
|
|
|
xConnectorShape->getPropertyValue("StartShape"), uno::UNO_QUERY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no start shape", xSvgShape.is() );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xCustomShape(
|
|
|
|
xConnectorShape->getPropertyValue("EndShape"), uno::UNO_QUERY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no end shape", xCustomShape.is() );
|
|
|
|
|
|
|
|
uno::Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier(
|
|
|
|
xPage, uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< animations::XAnimationNode > xRootNode(
|
|
|
|
xAnimNodeSupplier->getAnimationNode() );
|
|
|
|
std::vector< uno::Reference< animations::XAnimationNode > > aAnimVector;
|
|
|
|
anim::create_deep_vector(xRootNode, aAnimVector);
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not 8 animation nodes", aAnimVector.size() == 8 );
|
|
|
|
|
|
|
|
uno::Reference< animations::XAnimate > xNode(
|
|
|
|
aAnimVector[7], uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< drawing::XShape > xTargetShape(
|
|
|
|
xNode->getTarget(), uno::UNO_QUERY_THROW );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "inner node not referencing svg shape",
|
|
|
|
xTargetShape != xSvgShape );
|
|
|
|
}
|
|
|
|
|
2013-11-06 15:37:20 +05:30
|
|
|
// Unit test for importing charts
|
|
|
|
void SdFiltersTest::testFdo71075()
|
|
|
|
{
|
|
|
|
double values[] = { 12.0, 13.0, 14.0 };
|
|
|
|
::com::sun::star::uno::Any aAny;
|
|
|
|
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"));
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
|
|
|
|
|
|
|
|
SdDrawDocument *pDoc = xDocShRef->GetDoc();
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
|
|
|
|
uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
|
|
|
|
|
|
|
|
uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
|
|
|
|
aAny = xPropSet->getPropertyValue( OUString("Model") );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load shape", aAny.hasValue() );
|
|
|
|
|
|
|
|
uno::Reference< chart::XChartDocument > xChartDoc;
|
|
|
|
aAny >>= xChartDoc;
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc.is() );
|
|
|
|
uno::Reference< chart2::XChartDocument > xChart2Doc( xChartDoc, uno::UNO_QUERY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc.is() );
|
|
|
|
|
|
|
|
uno::Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xChart2Doc->getFirstDiagram(), uno::UNO_QUERY );
|
|
|
|
uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
|
|
|
|
uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[0], uno::UNO_QUERY );
|
|
|
|
|
|
|
|
uno::Reference< chart2::XDataSeriesContainer > xDSCnt( xCTCnt->getChartTypes()[0], uno::UNO_QUERY );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "failed to load data series", xDSCnt.is() );
|
|
|
|
uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aSeriesSeq.getLength() == 1);
|
|
|
|
uno::Reference< chart2::data::XDataSource > xSource( aSeriesSeq[0], uno::UNO_QUERY );
|
|
|
|
uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(xSource->getDataSequences());
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aSeqCnt.getLength() == 1);
|
|
|
|
uno::Reference< chart2::data::XDataSequence > xValueSeq( aSeqCnt[0]->getValues() );
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Invalid Data count", xValueSeq->getData().getLength() == sizeof(values)/(sizeof(double)));
|
|
|
|
uno::Reference< chart2::data::XNumericalDataSequence > xNumSeq( xValueSeq, uno::UNO_QUERY );
|
|
|
|
uno::Sequence< double > aValues( xNumSeq->getNumericalData());
|
|
|
|
for(sal_Int32 i=0;i<xValueSeq->getData().getLength();i++)
|
|
|
|
CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aValues.getConstArray()[i] == values[i]);
|
|
|
|
}
|
|
|
|
|
2012-01-13 04:30:48 +01:00
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
|
|
|
|
|
|
|
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|