1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <config_poppler.h>
14 #include "sdmodeltestbase.hxx"
16 #include <svl/stritem.hxx>
17 #include <editeng/eeitem.hxx>
18 #include <editeng/editobj.hxx>
19 #include <editeng/outlobj.hxx>
20 #include <editeng/ulspitem.hxx>
21 #include <editeng/fhgtitem.hxx>
22 #include <editeng/escapementitem.hxx>
23 #include <editeng/colritem.hxx>
24 #include <editeng/numitem.hxx>
25 #include <editeng/unoprnms.hxx>
26 #include <svl/style.hxx>
28 #include <svx/svdotext.hxx>
29 #include <svx/svdoashp.hxx>
30 #include <svx/svdogrp.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/svdotable.hxx>
33 #include <svx/xfillit0.hxx>
34 #include <svx/xflclit.hxx>
35 #include <svx/xlineit0.hxx>
36 #include <svx/xlnclit.hxx>
37 #include <svx/xlnwtit.hxx>
38 #include <svx/sdasitm.hxx>
39 #include <svx/sdmetitm.hxx>
40 #include <svx/sdooitm.hxx>
41 #include <animations/animationnodehelper.hxx>
42 #include <sax/tools/converter.hxx>
44 #include <com/sun/star/awt/Gradient.hpp>
45 #include <com/sun/star/awt/XBitmap.hpp>
46 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
47 #include <com/sun/star/document/XEventsSupplier.hpp>
48 #include <com/sun/star/presentation/ClickAction.hpp>
49 #include <com/sun/star/presentation/XPresentationPage.hpp>
50 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
51 #include <com/sun/star/drawing/BitmapMode.hpp>
52 #include <com/sun/star/drawing/ColorMode.hpp>
53 #include <com/sun/star/drawing/GraphicExportFilter.hpp>
54 #include <com/sun/star/drawing/XDrawPage.hpp>
55 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
56 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
57 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
58 #include <com/sun/star/drawing/GluePoint2.hpp>
59 #include <com/sun/star/container/XIdentifierAccess.hpp>
60 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
61 #include <com/sun/star/animations/XAnimationNode.hpp>
62 #include <com/sun/star/animations/XAnimate.hpp>
63 #include <com/sun/star/beans/XPropertySet.hpp>
64 #include <com/sun/star/chart/DataLabelPlacement.hpp>
65 #include <com/sun/star/chart/XChartDocument.hpp>
66 #include <com/sun/star/chart2/XChartDocument.hpp>
67 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
68 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
69 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
70 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
71 #include <com/sun/star/chart2/data/XDataSequence.hpp>
72 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
73 #include <com/sun/star/graphic/XGraphic.hpp>
74 #include <com/sun/star/table/BorderLineStyle.hpp>
75 #include <com/sun/star/table/BorderLine2.hpp>
76 #include <com/sun/star/style/ParagraphAdjust.hpp>
77 #include <com/sun/star/style/LineSpacing.hpp>
78 #include <com/sun/star/style/LineSpacingMode.hpp>
79 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
80 #include <com/sun/star/table/XTableRows.hpp>
81 #include <com/sun/star/style/NumberingType.hpp>
82 #include <com/sun/star/frame/Desktop.hpp>
83 #include <com/sun/star/text/GraphicCrop.hpp>
84 #include <com/sun/star/text/XTextCursor.hpp>
85 #include <com/sun/star/xml/dom/XDocument.hpp>
87 #include <stlpool.hxx>
88 #include <comphelper/processfactory.hxx>
89 #include <comphelper/sequenceashashmap.hxx>
90 #include <comphelper/graphicmimetype.hxx>
91 #include <comphelper/lok.hxx>
92 #include <vcl/pngread.hxx>
93 #include <vcl/bitmapaccess.hxx>
94 #include <vcl/dibtools.hxx>
95 #include <svx/svdograf.hxx>
97 using namespace ::com::sun::star
;
99 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
102 static std::ostream
& operator<<(std::ostream
& rStrm
, const uno::Reference
<T
>& xRef
)
111 /// Impress import filters tests.
112 class SdImportTest
: public SdModelTestBase
115 virtual void setUp() override
;
117 void testDocumentLayout();
118 void testSmoketest();
121 void testMasterPageStyleParent();
122 void testGradientAngle();
126 void testN828390_2();
127 void testN828390_3();
131 void testStrictOOXML();
132 void testN862510_1();
133 void testN862510_2();
134 void testN862510_4();
135 void testBnc870237();
136 void testBnc887225();
137 void testPredefinedTableStyle();
138 void testBnc591147();
139 void testCreationDate();
140 void testBnc584721_1();
141 void testBnc584721_2();
142 void testBnc584721_4();
143 void testBnc904423();
144 void testShapeLineStyle();
145 void testTableBorderLineStyle();
146 void testBnc862510_6();
147 void testBnc862510_7();
149 void testPDFImportShared();
150 #if defined(IMPORT_PDF_ELEMENTS)
151 void testPDFImport();
152 void testPDFImportSkipImages();
155 void testBulletSuffix();
156 void testBnc910045();
157 void testRowHeight();
159 void testTdf127129();
169 void testTdf103473();
170 void testAoo124143();
171 void testTdf103567();
172 void testTdf103792();
173 void testTdf103876();
175 void testTdf104015();
176 void testTdf104201();
177 void testTdf103477();
178 void testTdf104445();
179 void testTdf105150();
180 void testTdf105150PPT();
181 void testTdf123684();
182 void testTdf100926();
184 void testTdf108925();
185 void testTdf109067();
186 void testTdf109187();
187 void testTdf108926();
188 void testTdf100065();
190 void testTdf114488();
191 void testTdf114913();
192 void testTdf114821();
193 void testTdf115394();
194 void testTdf115394PPT();
196 void testTdf116899();
198 void testTdf116266();
199 void testTdf126324();
200 void testTdf128684();
202 bool checkPattern(sd::DrawDocShellRef
const & rDocRef
, int nShapeNumber
, std::vector
<sal_uInt8
>& rExpected
);
203 void testPatternImport();
205 void testTdf119015();
206 void testTdf123090();
207 void testTdf120028();
208 void testTdf120028b();
209 void testDescriptionImport();
212 void testTdf122899();
214 void testCropToShape();
215 void testTdf127964();
216 void testTdf106638();
217 void testTdf113198();
219 CPPUNIT_TEST_SUITE(SdImportTest
);
221 CPPUNIT_TEST(testDocumentLayout
);
222 CPPUNIT_TEST(testSmoketest
);
223 CPPUNIT_TEST(testN759180
);
224 CPPUNIT_TEST(testN778859
);
225 CPPUNIT_TEST(testMasterPageStyleParent
);
226 CPPUNIT_TEST(testGradientAngle
);
227 CPPUNIT_TEST(testTdf97808
);
228 CPPUNIT_TEST(testFdo64512
);
229 CPPUNIT_TEST(testFdo71075
);
230 CPPUNIT_TEST(testN828390_2
);
231 CPPUNIT_TEST(testN828390_3
);
232 CPPUNIT_TEST(testFdo68594
);
233 CPPUNIT_TEST(testFdo72998
);
234 CPPUNIT_TEST(testFdo77027
);
235 CPPUNIT_TEST(testStrictOOXML
);
236 CPPUNIT_TEST(testN862510_1
);
237 CPPUNIT_TEST(testN862510_2
);
238 CPPUNIT_TEST(testN862510_4
);
239 CPPUNIT_TEST(testBnc870237
);
240 CPPUNIT_TEST(testBnc887225
);
241 CPPUNIT_TEST(testPredefinedTableStyle
);
242 CPPUNIT_TEST(testBnc591147
);
243 CPPUNIT_TEST(testCreationDate
);
244 CPPUNIT_TEST(testBnc584721_1
);
245 CPPUNIT_TEST(testBnc584721_2
);
246 CPPUNIT_TEST(testBnc584721_4
);
247 CPPUNIT_TEST(testBnc904423
);
248 CPPUNIT_TEST(testShapeLineStyle
);
249 CPPUNIT_TEST(testTableBorderLineStyle
);
250 CPPUNIT_TEST(testBnc862510_6
);
251 CPPUNIT_TEST(testBnc862510_7
);
253 CPPUNIT_TEST(testPDFImportShared
);
254 #if defined(IMPORT_PDF_ELEMENTS)
255 CPPUNIT_TEST(testPDFImport
);
256 CPPUNIT_TEST(testPDFImportSkipImages
);
259 CPPUNIT_TEST(testBulletSuffix
);
260 CPPUNIT_TEST(testBnc910045
);
261 CPPUNIT_TEST(testRowHeight
);
262 CPPUNIT_TEST(testTdf93830
);
263 CPPUNIT_TEST(testTdf127129
);
264 CPPUNIT_TEST(testTdf93097
);
265 CPPUNIT_TEST(testTdf62255
);
266 CPPUNIT_TEST(testTdf93124
);
267 CPPUNIT_TEST(testTdf99729
);
268 CPPUNIT_TEST(testTdf89927
);
269 CPPUNIT_TEST(testTdf93868
);
270 CPPUNIT_TEST(testTdf95932
);
271 CPPUNIT_TEST(testTdf99030
);
272 CPPUNIT_TEST(testTdf49561
);
273 CPPUNIT_TEST(testTdf103473
);
274 CPPUNIT_TEST(testAoo124143
);
275 CPPUNIT_TEST(testTdf103567
);
276 CPPUNIT_TEST(testTdf103792
);
277 CPPUNIT_TEST(testTdf103876
);
278 CPPUNIT_TEST(testTdf79007
);
279 CPPUNIT_TEST(testTdf104015
);
280 CPPUNIT_TEST(testTdf104201
);
281 CPPUNIT_TEST(testTdf103477
);
282 CPPUNIT_TEST(testTdf104445
);
283 CPPUNIT_TEST(testTdf105150
);
284 CPPUNIT_TEST(testTdf105150PPT
);
285 CPPUNIT_TEST(testTdf123684
);
286 CPPUNIT_TEST(testTdf100926
);
287 CPPUNIT_TEST(testPatternImport
);
288 CPPUNIT_TEST(testTdf89064
);
289 CPPUNIT_TEST(testTdf108925
);
290 CPPUNIT_TEST(testTdf109067
);
291 CPPUNIT_TEST(testTdf109187
);
292 CPPUNIT_TEST(testTdf108926
);
293 CPPUNIT_TEST(testTdf100065
);
294 CPPUNIT_TEST(testTdf90626
);
295 CPPUNIT_TEST(testTdf114488
);
296 CPPUNIT_TEST(testTdf114913
);
297 CPPUNIT_TEST(testTdf114821
);
298 CPPUNIT_TEST(testTdf115394
);
299 CPPUNIT_TEST(testTdf126324
);
300 CPPUNIT_TEST(testTdf115394PPT
);
301 CPPUNIT_TEST(testTdf51340
);
302 CPPUNIT_TEST(testTdf116899
);
303 CPPUNIT_TEST(testTdf77747
);
304 CPPUNIT_TEST(testTdf116266
);
305 CPPUNIT_TEST(testPptCrop
);
306 CPPUNIT_TEST(testTdf119015
);
307 CPPUNIT_TEST(testTdf123090
);
308 CPPUNIT_TEST(testTdf120028
);
309 CPPUNIT_TEST(testTdf120028b
);
310 CPPUNIT_TEST(testDescriptionImport
);
311 CPPUNIT_TEST(testTdf83247
);
312 CPPUNIT_TEST(testTdf47365
);
313 CPPUNIT_TEST(testTdf122899
);
314 CPPUNIT_TEST(testOOXTheme
);
315 CPPUNIT_TEST(testCropToShape
);
316 CPPUNIT_TEST(testTdf127964
);
317 CPPUNIT_TEST(testTdf106638
);
318 CPPUNIT_TEST(testTdf128684
);
319 CPPUNIT_TEST(testTdf113198
);
321 CPPUNIT_TEST_SUITE_END();
324 void SdImportTest::setUp()
326 SdModelTestBase::setUp();
327 mxDesktop
.set(frame::Desktop::create(getComponentContext()));
330 /** Test document against a reference XML dump of shapes.
332 If you want to update one of these tests, or add a new one, set the nUpdateMe
333 to the index of the test, and the dump XML's will be created (or rewritten)
334 instead of checking. Use with care - when the test is failing, first find out
335 why, instead of just updating .xml's blindly.
337 Example: Let's say you are adding a test called fdoABCD.pptx. You'll place it
338 to the data/ subdirectory, and will add an entry to aFilesToCompare below,
339 the 3rd parameter is for export test - can be -1 (don't export), ODP, PPT or PPTX
342 { "fdoABCD.pptx", "xml/fdoABCD_", PPTX },
344 and will count the index in the aFilesToCompare structure (1st is 0, 2nd is 1,
345 etc.) Temporarily you'll set nUpdateMe to this index (instead of -1), and run
349 This will generate the sd/qa/unit/data/xml/fdoABCD_*.xml for you. Now you
350 will change nUpdateMe back to -1, and commit your fdoABCD.pptx test, the
351 xml/fdoABCD_*.xml dumps, and the aFilesToCompare addition in one commit.
353 As the last step, you will revert your fix and do 'make sd' again, to check
354 that without your fix, the unit test breaks. Then clean up, and push :-)
356 NOTE: This approach is suitable only for tests of fixes that actually change
357 the layout - best to check by reverting your fix locally after having added
358 the test, and re-running; it should break.
360 void SdImportTest::testDocumentLayout()
362 static const struct { const char *pInput
, *pDump
; sal_Int32 nFormat
; sal_Int32 nExportType
; } aFilesToCompare
[] =
364 { "odp/shapes-test.odp", "xml/shapes-test_page", ODP
, -1 },
365 { "fdo47434.pptx", "xml/fdo47434_", PPTX
, -1 },
366 { "n758621.ppt", "xml/n758621_", PPT
, -1 },
367 { "fdo64586.ppt", "xml/fdo64586_", PPT
, -1 },
368 { "n819614.pptx", "xml/n819614_", PPTX
, -1 },
369 { "n820786.pptx", "xml/n820786_", PPTX
, -1 },
370 { "n762695.pptx", "xml/n762695_", PPTX
, -1 },
371 { "n593612.pptx", "xml/n593612_", PPTX
, -1 },
372 { "fdo71434.pptx", "xml/fdo71434_", PPTX
, -1 },
373 { "n902652.pptx", "xml/n902652_", PPTX
, -1 },
374 { "tdf90403.pptx", "xml/tdf90403_", PPTX
, -1 },
375 { "tdf90338.odp", "xml/tdf90338_", ODP
, PPTX
},
376 { "tdf92001.odp", "xml/tdf92001_", ODP
, PPTX
},
377 // GCC -mfpmath=387 rounding issues in lclPushMarkerProperties
378 // (oox/source/drawingml/lineproperties.cxx); see mail sub-thread starting at
379 // <https://lists.freedesktop.org/archives/libreoffice/2016-September/
380 // 075211.html> "Re: Test File: sc/qa/unit/data/functions/fods/chiinv.fods:
381 // fails with Assertion" for how "-mfpmath=sse -msse2" would fix that:
382 #if !(defined LINUX && defined X86)
383 { "tdf100491.pptx", "xml/tdf100491_", PPTX
, -1 },
385 { "tdf109317.pptx", "xml/tdf109317_", PPTX
, ODP
},
386 // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
389 for ( int i
= 0; i
< static_cast< int >( SAL_N_ELEMENTS( aFilesToCompare
) ); ++i
)
391 int const nUpdateMe
= -1; // index of test we want to update; supposedly only when the test is created
393 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare
[i
].pInput
), aFilesToCompare
[i
].nFormat
);
394 if( aFilesToCompare
[i
].nExportType
>= 0 )
395 xDocShRef
= saveAndReload( xDocShRef
.get(), aFilesToCompare
[i
].nExportType
);
396 compareWithShapesDump( xDocShRef
,
397 m_directories
.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare
[i
].pDump
),
402 void SdImportTest::testSmoketest()
404 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"), PPTX
);
406 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
407 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
409 // cf. SdrModel svx/svdmodel.hxx ...
411 CPPUNIT_ASSERT_EQUAL_MESSAGE( "wrong page count", static_cast<sal_uInt16
>(3), pDoc
->GetPageCount());
413 const SdrPage
*pPage
= pDoc
->GetPage (1);
414 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= nullptr );
416 CPPUNIT_ASSERT_MESSAGE( "changed", !pDoc
->IsChanged() );
418 xDocShRef
->DoClose();
421 void SdImportTest::testN759180()
423 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/n759180.pptx"), PPTX
);
425 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
427 //sal_uIntPtr nObjs = pPage->GetObjCount();
428 //for (sal_uIntPtr i = 0; i < nObjs; i++)
431 SdrObject
*pObj
= pPage
->GetObj(0);
432 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
433 CPPUNIT_ASSERT(pTxtObj
);
434 std::vector
<EECharAttrib
> rLst
;
435 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
436 const SvxULSpaceItem
*pULSpace
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_ULSPACE
);
437 CPPUNIT_ASSERT(pULSpace
);
438 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Para bottom spacing is wrong!", static_cast<sal_uInt16
>(0), pULSpace
->GetLower());
439 aEdit
.GetCharAttribs(1, rLst
);
440 auto it
= std::find_if(rLst
.rbegin(), rLst
.rend(),
441 [](const EECharAttrib
& rCharAttr
) { return dynamic_cast<const SvxFontHeightItem
*>(rCharAttr
.pAttr
) != nullptr; });
442 if (it
!= rLst
.rend())
444 const SvxFontHeightItem
* pFontHeight
= dynamic_cast<const SvxFontHeightItem
*>((*it
).pAttr
);
446 // font height = 5 => 5*2540/72
447 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font height is wrong", static_cast<sal_uInt32
>(176), pFontHeight
->GetHeight() );
451 xDocShRef
->DoClose();
454 void SdImportTest::testN862510_1()
456 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx"), PPTX
);
458 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
460 std::vector
<EECharAttrib
> rLst
;
461 SdrObject
*pObj
= pPage
->GetObj( 0 );
462 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
463 CPPUNIT_ASSERT( pTxtObj
);
464 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
465 aEdit
.GetCharAttribs( 0, rLst
);
466 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
468 const SvxEscapementItem
*pFontEscapement
= dynamic_cast<const SvxEscapementItem
*>( (*it
).pAttr
);
469 CPPUNIT_ASSERT_MESSAGE( "Baseline attribute not handled properly", !(pFontEscapement
&& pFontEscapement
->GetProportionalHeight() != 100) );
473 xDocShRef
->DoClose();
476 void SdImportTest::testN862510_2()
478 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx"), PPTX
);
480 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
482 CPPUNIT_ASSERT_EQUAL(size_t(1), pPage
->GetObjCount());
483 SdrObjGroup
*pGrpObj
= dynamic_cast<SdrObjGroup
*>( pPage
->GetObj( 0 ) );
484 CPPUNIT_ASSERT( pGrpObj
);
485 SdrObjCustomShape
*pObj
= dynamic_cast<SdrObjCustomShape
*>( pGrpObj
->GetSubList()->GetObj( 1 ) );
486 CPPUNIT_ASSERT( pObj
);
487 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Text Rotation!", 90.0, pObj
->GetExtraTextRotation( true ) );
490 xDocShRef
->DoClose();
493 void SdImportTest::testN862510_4()
495 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx"), PPTX
);
497 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
499 std::vector
<EECharAttrib
> rLst
;
500 SdrObject
*pObj
= pPage
->GetObj( 0 );
501 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
502 CPPUNIT_ASSERT( pTxtObj
);
503 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
504 aEdit
.GetCharAttribs( 0, rLst
);
505 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!= rLst
.rend(); ++it
)
507 const SvxColorItem
*pC
= dynamic_cast<const SvxColorItem
*>( (*it
).pAttr
);
508 CPPUNIT_ASSERT_MESSAGE( "gradfill for text color not handled!", !( pC
&& pC
->GetValue() == Color(0) ) );
512 xDocShRef
->DoClose();
515 void SdImportTest::testN828390_2()
517 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx"), PPTX
);
518 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
520 SdrObject
*pObj
= pPage
->GetObj(0);
521 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
522 CPPUNIT_ASSERT( pTxtObj
);
523 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
524 CPPUNIT_ASSERT_EQUAL(OUString("Linux "), aEdit
.GetText(0));
525 CPPUNIT_ASSERT_EQUAL(OUString("Standard Platform"), aEdit
.GetText(1));
527 xDocShRef
->DoClose();
530 void SdImportTest::testN828390_3()
532 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX
);
533 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
535 SdrObject
*pObj
= pPage
->GetObj(0);
536 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
537 CPPUNIT_ASSERT( pTxtObj
);
538 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
539 std::vector
<EECharAttrib
> rLst
;
540 aEdit
.GetCharAttribs(1, rLst
);
541 bool bPassed
= std::none_of(rLst
.rbegin(), rLst
.rend(),
542 [](const EECharAttrib
& rCharAttr
) {
543 const SvxEscapementItem
*pFontEscapement
= dynamic_cast<const SvxEscapementItem
*>(rCharAttr
.pAttr
);
544 return pFontEscapement
&& (pFontEscapement
->GetEsc() != 0);
546 CPPUNIT_ASSERT_MESSAGE("CharEscapment not imported properly", bPassed
);
548 xDocShRef
->DoClose();
551 void SdImportTest::testMasterPageStyleParent()
553 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"), ODP
);
554 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
555 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
557 SdStyleSheetPool
*const pPool(pDoc
->GetSdStyleSheetPool());
560 SfxStyleSheetIterator
iter(pPool
, SfxStyleFamily::Page
);
561 for (SfxStyleSheetBase
* pStyle
= iter
.First(); pStyle
; pStyle
= iter
.Next())
563 OUString
const name(pStyle
->GetName());
564 OUString
const parent(pStyle
->GetParent());
565 if (!parent
.isEmpty())
568 // check that parent exists
569 SfxStyleSheetBase
*const pParentStyle(
570 pPool
->Find(parent
, SfxStyleFamily::Page
));
571 CPPUNIT_ASSERT(pParentStyle
);
572 CPPUNIT_ASSERT_EQUAL(pParentStyle
->GetName(), parent
);
573 // check that parent has the same master page as pStyle
574 CPPUNIT_ASSERT(parent
.indexOf(SD_LT_SEPARATOR
) != -1);
575 CPPUNIT_ASSERT(name
.indexOf(SD_LT_SEPARATOR
) != -1);
576 CPPUNIT_ASSERT_EQUAL(
577 parent
.copy(0, parent
.indexOf(SD_LT_SEPARATOR
)),
578 name
.copy(0, name
.indexOf(SD_LT_SEPARATOR
)));
581 // check that there are actually parents...
582 CPPUNIT_ASSERT_EQUAL(16, parents
);
584 xDocShRef
->DoClose();
587 void SdImportTest::testGradientAngle()
589 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odg/gradient-angle.fodg"), FODG
);
591 uno::Reference
<lang::XMultiServiceFactory
> const xDoc(
592 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY
);
594 awt::Gradient gradient
;
595 uno::Reference
<container::XNameAccess
> const xGradients(
596 xDoc
->createInstance("com.sun.star.drawing.GradientTable"),
599 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 38") >>= gradient
);
600 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), gradient
.Angle
); // was: 3600
602 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 10") >>= gradient
);
603 CPPUNIT_ASSERT_EQUAL(sal_Int16(270), gradient
.Angle
); // 27deg
605 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 11") >>= gradient
);
606 CPPUNIT_ASSERT_EQUAL(sal_Int16(1145), gradient
.Angle
); // 2rad
608 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 12") >>= gradient
);
609 CPPUNIT_ASSERT_EQUAL(sal_Int16(900), gradient
.Angle
); // 100grad
611 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 13") >>= gradient
);
612 CPPUNIT_ASSERT_EQUAL(sal_Int16(3599), gradient
.Angle
); // -1
614 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 14") >>= gradient
);
615 CPPUNIT_ASSERT_EQUAL(sal_Int16(3028), gradient
.Angle
); // -1rad
617 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 15") >>= gradient
);
618 CPPUNIT_ASSERT_EQUAL(sal_Int16(300), gradient
.Angle
); // 3900
620 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 16") >>= gradient
);
621 CPPUNIT_ASSERT_EQUAL(sal_Int16(105), gradient
.Angle
); // 10.5deg
623 CPPUNIT_ASSERT(xGradients
->getByName("Gradient 17") >>= gradient
);
624 CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), gradient
.Angle
); // \pi rad
626 uno::Reference
<container::XNameAccess
> const xTranspGradients(
627 xDoc
->createInstance("com.sun.star.drawing.TransparencyGradientTable"),
630 CPPUNIT_ASSERT(xTranspGradients
->getByName("Transparency 2") >>= gradient
);
631 CPPUNIT_ASSERT_EQUAL(sal_Int16(10), gradient
.Angle
); // 1
633 CPPUNIT_ASSERT(xTranspGradients
->getByName("Transparency 1") >>= gradient
);
634 CPPUNIT_ASSERT_EQUAL(sal_Int16(900), gradient
.Angle
); // 90deg
636 CPPUNIT_ASSERT(xTranspGradients
->getByName("Transparency 3") >>= gradient
);
637 CPPUNIT_ASSERT_EQUAL(sal_Int16(572), gradient
.Angle
); // 1.0rad
639 CPPUNIT_ASSERT(xTranspGradients
->getByName("Transparency 4") >>= gradient
);
640 CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), gradient
.Angle
); // 1000grad
642 xDocShRef
->DoClose();
645 void SdImportTest::testN778859()
647 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX
);
649 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
652 SdrObject
*pObj
= pPage
->GetObj(1);
653 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
654 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
655 CPPUNIT_ASSERT(!pTxtObj
->IsAutoFit());
658 xDocShRef
->DoClose();
661 void SdImportTest::testFdo68594()
663 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"), PPT
);
665 const SdrPage
*pPage
= &(GetPage( 1, xDocShRef
)->TRG_GetMasterPage());
666 SdrObject
*pObj
= pPage
->GetObj(1);
667 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
668 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
669 const SvxColorItem
*pC
= &pTxtObj
->GetMergedItem(EE_CHAR_COLOR
);
670 CPPUNIT_ASSERT_MESSAGE( "no color item", pC
!= nullptr);
671 // Color should be black
672 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Placeholder color mismatch", sal_uInt32(0), sal_uInt32(pC
->GetValue()) );
674 xDocShRef
->DoClose();
677 void SdImportTest::testPptCrop()
679 sd::DrawDocShellRef xDocShRef
680 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/crop.ppt"), PPT
);
682 uno::Reference
<beans::XPropertySet
> xPropertySet(
683 getShapeFromPage(/*nShape=*/1, /*nPage=*/0, xDocShRef
));
684 text::GraphicCrop aCrop
;
685 xPropertySet
->getPropertyValue("GraphicCrop") >>= aCrop
;
686 // These were all 0, lazy-loading broke cropping.
687 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32
>(0), aCrop
.Top
);
688 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32
>(0), aCrop
.Bottom
);
689 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32
>(0), aCrop
.Left
);
690 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32
>(0), aCrop
.Right
);
692 xDocShRef
->DoClose();
695 void SdImportTest::testFdo72998()
697 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"), PPTX
);
699 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
701 SdrObjCustomShape
*pObj
= dynamic_cast<SdrObjCustomShape
*>(pPage
->GetObj(2));
702 CPPUNIT_ASSERT( pObj
);
703 const SdrCustomShapeGeometryItem
& rGeometryItem
= pObj
->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY
);
704 const css::uno::Any
* pViewBox
= const_cast<SdrCustomShapeGeometryItem
&>(rGeometryItem
).GetPropertyValueByName( OUString( "ViewBox" ) );
705 CPPUNIT_ASSERT_MESSAGE( "Missing ViewBox", pViewBox
);
706 css::awt::Rectangle aViewBox
;
707 CPPUNIT_ASSERT( (*pViewBox
>>= aViewBox
) );
708 CPPUNIT_ASSERT_MESSAGE( "Width should be zero - for forcing scale to 1", !aViewBox
.Width
);
709 CPPUNIT_ASSERT_MESSAGE( "Height should be zero - for forcing scale to 1", !aViewBox
.Height
);
712 xDocShRef
->DoClose();
715 void SdImportTest::testFdo77027()
717 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"), ODP
);
719 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
721 SdrOle2Obj
*const pObj
= dynamic_cast<SdrOle2Obj
*>(pPage
->GetObj(0));
722 CPPUNIT_ASSERT(pObj
);
724 // check that the fill style/color was actually imported
725 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
726 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
727 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
728 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
729 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
730 CPPUNIT_ASSERT_EQUAL(Color(0xff6600), rColorItem
.GetColorValue());
733 xDocShRef
->DoClose();
736 void SdImportTest::testTdf97808()
738 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/tdf97808.fodp"), FODP
);
740 uno::Reference
<style::XStyleFamiliesSupplier
> xStyleFamiliesSupplier(
741 xDocShRef
->GetModel(), uno::UNO_QUERY
);
742 uno::Reference
<container::XNameAccess
> xStyleFamilies
= xStyleFamiliesSupplier
->getStyleFamilies();
743 uno::Reference
<container::XNameAccess
> xStyleFamily(xStyleFamilies
->getByName("graphics"), uno::UNO_QUERY
);
744 uno::Reference
<beans::XPropertySet
> xStyle(xStyleFamily
->getByName("objectwithoutfill"), uno::UNO_QUERY
);
746 CPPUNIT_ASSERT(xStyle
->getPropertyValue("LineEndName") >>= lineend
);
747 CPPUNIT_ASSERT_EQUAL(OUString("Arrow"), lineend
);
749 // the draw:marker-end="" did not override the style
750 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(
751 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
752 uno::Reference
<drawing::XDrawPage
> xPage(
753 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
754 uno::Reference
<beans::XPropertySet
> xLine(
755 xPage
->getByIndex(0), uno::UNO_QUERY_THROW
);
756 //uno::Reference<style::XStyle> xParent;
757 uno::Reference
<beans::XPropertySet
> xParent
;
758 CPPUNIT_ASSERT(xLine
->getPropertyValue("Style") >>= xParent
);
759 CPPUNIT_ASSERT_EQUAL(xStyle
, xParent
);
760 CPPUNIT_ASSERT(xLine
->getPropertyValue("LineEndName") >>= lineend
);
761 CPPUNIT_ASSERT_EQUAL(OUString(), lineend
);
763 xDocShRef
->DoClose();
766 void SdImportTest::testFdo64512()
768 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP
);
770 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
771 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
772 CPPUNIT_ASSERT_EQUAL_MESSAGE( "not exactly one page", static_cast<sal_Int32
>(1), xDoc
->getDrawPages()->getCount() );
774 uno::Reference
< drawing::XDrawPage
> xPage(
775 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
776 CPPUNIT_ASSERT_EQUAL_MESSAGE( "no exactly three shapes", static_cast<sal_Int32
>(3), xPage
->getCount() );
778 uno::Reference
< beans::XPropertySet
> xConnectorShape(
779 xPage
->getByIndex(2), uno::UNO_QUERY
);
780 CPPUNIT_ASSERT_MESSAGE( "no connector shape", xConnectorShape
.is() );
782 uno::Reference
< beans::XPropertySet
> xSvgShape(
783 xConnectorShape
->getPropertyValue("StartShape"), uno::UNO_QUERY
);
784 CPPUNIT_ASSERT_MESSAGE( "no start shape", xSvgShape
.is() );
786 uno::Reference
< beans::XPropertySet
> xCustomShape(
787 xConnectorShape
->getPropertyValue("EndShape"), uno::UNO_QUERY
);
788 CPPUNIT_ASSERT_MESSAGE( "no end shape", xCustomShape
.is() );
790 uno::Reference
< animations::XAnimationNodeSupplier
> xAnimNodeSupplier(
791 xPage
, uno::UNO_QUERY_THROW
);
792 uno::Reference
< animations::XAnimationNode
> xRootNode(
793 xAnimNodeSupplier
->getAnimationNode() );
794 std::vector
< uno::Reference
< animations::XAnimationNode
> > aAnimVector
;
795 anim::create_deep_vector(xRootNode
, aAnimVector
);
796 CPPUNIT_ASSERT_EQUAL_MESSAGE( "not 8 animation nodes", static_cast<std::size_t>(8), aAnimVector
.size() );
798 uno::Reference
< animations::XAnimate
> xNode(
799 aAnimVector
[7], uno::UNO_QUERY_THROW
);
800 uno::Reference
< drawing::XShape
> xTargetShape(
801 xNode
->getTarget(), uno::UNO_QUERY_THROW
);
802 CPPUNIT_ASSERT_MESSAGE( "inner node not referencing svg shape",
803 xTargetShape
!= xSvgShape
);
805 xDocShRef
->DoClose();
808 // Unit test for importing charts
809 void SdImportTest::testFdo71075()
811 double values
[] = { 12.0, 13.0, 14.0 };
813 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"), ODP
);
815 uno::Reference
< beans::XPropertySet
> xPropSet( getShapeFromPage( 0, 0, xDocShRef
) );
816 aAny
= xPropSet
->getPropertyValue( "Model" );
817 CPPUNIT_ASSERT_MESSAGE( "The shape doesn't have the property", aAny
.hasValue() );
819 uno::Reference
< chart::XChartDocument
> xChartDoc
;
821 CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc
.is() );
822 uno::Reference
< chart2::XChartDocument
> xChart2Doc( xChartDoc
, uno::UNO_QUERY
);
823 CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc
.is() );
825 uno::Reference
< chart2::XCoordinateSystemContainer
> xBCooSysCnt( xChart2Doc
->getFirstDiagram(), uno::UNO_QUERY
);
826 uno::Sequence
< uno::Reference
< chart2::XCoordinateSystem
> > aCooSysSeq( xBCooSysCnt
->getCoordinateSystems());
827 uno::Reference
< chart2::XChartTypeContainer
> xCTCnt( aCooSysSeq
[0], uno::UNO_QUERY
);
829 uno::Reference
< chart2::XDataSeriesContainer
> xDSCnt( xCTCnt
->getChartTypes()[0], uno::UNO_QUERY
);
830 CPPUNIT_ASSERT_MESSAGE( "failed to load data series", xDSCnt
.is() );
831 uno::Sequence
< uno::Reference
< chart2::XDataSeries
> > aSeriesSeq( xDSCnt
->getDataSeries());
832 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Series count", static_cast<sal_Int32
>(1), aSeriesSeq
.getLength() );
833 uno::Reference
< chart2::data::XDataSource
> xSource( aSeriesSeq
[0], uno::UNO_QUERY
);
834 uno::Sequence
< uno::Reference
< chart2::data::XLabeledDataSequence
> > aSeqCnt(xSource
->getDataSequences());
835 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Series count", static_cast<sal_Int32
>(1), aSeqCnt
.getLength());
836 uno::Reference
< chart2::data::XDataSequence
> xValueSeq( aSeqCnt
[0]->getValues() );
837 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Data count", static_cast<sal_Int32
>(SAL_N_ELEMENTS(values
)), xValueSeq
->getData().getLength());
838 uno::Reference
< chart2::data::XNumericalDataSequence
> xNumSeq( xValueSeq
, uno::UNO_QUERY
);
839 uno::Sequence
< double > aValues( xNumSeq
->getNumericalData());
840 for(sal_Int32 i
=0;i
<xValueSeq
->getData().getLength();i
++)
841 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Series count", values
[i
], aValues
.getConstArray()[i
]);
843 xDocShRef
->DoClose();
846 void SdImportTest::testStrictOOXML()
848 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"), PPTX
);
850 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
851 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
852 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
854 xDocShRef
->DoClose();
857 void SdImportTest::testBnc870237()
859 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"), PPTX
);
860 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
862 // Simulate a:ext inside dsp:txXfrm with changing the lower distance
863 const SdrObjGroup
* pGroupObj
= dynamic_cast<SdrObjGroup
*>( pPage
->GetObj( 0 ) );
864 const SdrObject
* pObj
= pGroupObj
->GetSubList()->GetObj( 1 );
865 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
866 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_UPPERDIST
).GetValue());
867 CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), pObj
->GetMergedItem(SDRATTR_TEXT_LOWERDIST
).GetValue());
868 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_RIGHTDIST
).GetValue());
869 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_LEFTDIST
).GetValue());
871 xDocShRef
->DoClose();
874 void SdImportTest::testCreationDate()
876 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo71434.pptx"), PPTX
);
877 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier(xDocShRef
->GetModel(), uno::UNO_QUERY
);
878 uno::Reference
<document::XDocumentProperties
> xDocumentProperties
= xDocumentPropertiesSupplier
->getDocumentProperties();
879 util::DateTime aDate
= xDocumentProperties
->getCreationDate();
880 OUStringBuffer aBuffer
;
881 sax::Converter::convertDateTime(aBuffer
, aDate
, nullptr);
882 // Metadata wasn't imported, this was 0000-00-00.
883 CPPUNIT_ASSERT_EQUAL(OUString("2013-11-09T10:37:56"), aBuffer
.makeStringAndClear());
884 xDocShRef
->DoClose();
887 void SdImportTest::testPredefinedTableStyle()
889 // 073A0DAA-6AF3-43AB-8588-CEC1D06C72B9 (Medium Style 2)
890 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/predefined-table-style.pptx"), PPTX
);
891 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
893 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
894 CPPUNIT_ASSERT( pTableObj
);
896 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
897 uno::Reference
< beans::XPropertySet
> xCell
;
900 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
901 xCell
->getPropertyValue("FillColor") >>= nColor
;
902 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nColor
);
904 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
905 xCell
->getPropertyValue("FillColor") >>= nColor
;
906 CPPUNIT_ASSERT_EQUAL(sal_Int32(13421772), nColor
);
908 xCell
.set(xTable
->getCellByPosition(0, 2), uno::UNO_QUERY_THROW
);
909 xCell
->getPropertyValue("FillColor") >>= nColor
;
910 CPPUNIT_ASSERT_EQUAL(sal_Int32(15198183), nColor
);
912 xDocShRef
->DoClose();
915 void SdImportTest::testBnc887225()
917 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX
);
918 // In the document, lastRow and lastCol table properties are used.
919 // Make sure styles are set properly for individual cells.
921 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
923 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(2));
924 CPPUNIT_ASSERT( pTableObj
);
925 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
926 uno::Reference
< beans::XPropertySet
> xCell
;
929 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
930 xCell
->getPropertyValue("FillColor") >>= nColor
;
931 CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor
);
933 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
934 xCell
->getPropertyValue("FillColor") >>= nColor
;
935 CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor
);
937 xCell
.set(xTable
->getCellByPosition(1, 1), uno::UNO_QUERY_THROW
);
938 xCell
->getPropertyValue("FillColor") >>= nColor
;
939 CPPUNIT_ASSERT_EQUAL(sal_Int32(13754095), nColor
);
941 xCell
.set(xTable
->getCellByPosition(1, 2), uno::UNO_QUERY_THROW
);
942 xCell
->getPropertyValue("FillColor") >>= nColor
;
943 CPPUNIT_ASSERT_EQUAL(sal_Int32(15331319), nColor
);
945 xCell
.set(xTable
->getCellByPosition(1, 4), uno::UNO_QUERY_THROW
);
946 xCell
->getPropertyValue("FillColor") >>= nColor
;
947 CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor
);
949 xCell
.set(xTable
->getCellByPosition(3, 2), uno::UNO_QUERY_THROW
);
950 xCell
->getPropertyValue("FillColor") >>= nColor
;
951 CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor
);
953 xCell
.set(xTable
->getCellByPosition(3, 4), uno::UNO_QUERY_THROW
);
954 xCell
->getPropertyValue("FillColor") >>= nColor
;
955 CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor
);
957 xDocShRef
->DoClose();
960 void SdImportTest::testBnc584721_1()
962 // Title text shape on the master page contained wrong text.
964 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX
);
966 const SdrPage
*pPage
= &(GetPage( 1, xDocShRef
)->TRG_GetMasterPage());
967 SdrObject
*pObj
= pPage
->GetObj(0);
968 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
969 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
970 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
971 CPPUNIT_ASSERT_EQUAL(OUString("Click to edit Master title style"), aEdit
.GetText(0));
972 xDocShRef
->DoClose();
975 void SdImportTest::testBnc584721_2()
977 // Import created an extra/unneeded outliner shape on the master slide next to the imported title shape.
979 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX
);
981 const SdrPage
*pPage
= &(GetPage( 1, xDocShRef
)->TRG_GetMasterPage());
982 CPPUNIT_ASSERT_EQUAL(size_t(1), pPage
->GetObjCount());
984 xDocShRef
->DoClose();
987 void SdImportTest::testBnc591147()
989 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc591147.pptx"), PPTX
);
991 // In the document, there are two slides with media files.
992 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
993 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
994 CPPUNIT_ASSERT_EQUAL( sal_Int32(2), xDoc
->getDrawPages()->getCount() );
996 // First page has video file inserted
997 uno::Reference
< drawing::XDrawPage
> xPage(
998 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
999 CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xPage
->getCount() );
1001 //uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
1002 uno::Reference
< beans::XPropertySet
> xPropSet( getShape( 0, xPage
) );
1003 OUString
sVideoURL("emptyURL");
1004 bool bSuccess
= xPropSet
->getPropertyValue("MediaURL") >>= sVideoURL
;
1005 CPPUNIT_ASSERT_MESSAGE( "MediaURL property is not set", bSuccess
);
1006 CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sVideoURL
.isEmpty());
1008 // Second page has audio file inserted
1009 xPage
.set( xDoc
->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW
);
1010 CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xPage
->getCount() );
1012 xPropSet
.set( getShape( 0, xPage
) );
1013 OUString
sAudioURL("emptyURL");
1014 bSuccess
= xPropSet
->getPropertyValue("MediaURL") >>= sAudioURL
;
1015 CPPUNIT_ASSERT_MESSAGE( "MediaURL property is not set", bSuccess
);
1016 CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sAudioURL
.isEmpty());
1018 CPPUNIT_ASSERT_MESSAGE( "sAudioURL and sVideoURL should not be equal", sAudioURL
!= sVideoURL
);
1020 xDocShRef
->DoClose();
1023 void SdImportTest::testBnc584721_4()
1025 // Black text was imported as white because of wrong caching mechanism
1027 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_4.pptx"), PPTX
);
1028 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 1, 1, xDocShRef
) );
1030 // Get first paragraph of the text
1031 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
1033 // Get first run of the paragraph
1034 uno::Reference
<text::XTextRange
> xRun( getRunFromParagraph (0, xParagraph
) );
1035 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
1037 xPropSet
->getPropertyValue( "CharColor" ) >>= nCharColor
;
1039 // Color should be black
1040 CPPUNIT_ASSERT_EQUAL( COL_BLACK
, nCharColor
);
1042 xDocShRef
->DoClose();
1045 void SdImportTest::testBnc904423()
1047 // Here the problem was that different fill properties were applied in wrong order on the shape
1048 // Right order: 1) master slide fill style, 2) theme, 3) direct formatting
1049 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.pptx"), PPTX
);
1051 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1052 // First shape's background color is defined on master slide
1054 SdrObject
*const pObj
= pPage
->GetObj(0);
1055 CPPUNIT_ASSERT(pObj
);
1057 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1058 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1059 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1060 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1061 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1062 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00CC99), sal_uInt32(rColorItem
.GetColorValue()));
1065 // Second shape's background color is defined by theme
1067 SdrObject
*const pObj
= pPage
->GetObj(1);
1068 CPPUNIT_ASSERT(pObj
);
1070 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1071 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1072 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1073 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1074 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1075 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem
.GetColorValue()));
1078 // Third shape's background color is defined by direct formatting
1080 SdrObject
*const pObj
= pPage
->GetObj(2);
1081 CPPUNIT_ASSERT(pObj
);
1083 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1084 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1085 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1086 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1087 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1088 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem
.GetColorValue()));
1091 xDocShRef
->DoClose();
1094 void SdImportTest::testShapeLineStyle()
1096 // Here the problem was that different line properties were applied in wrong order on the shape
1097 // Right order: 1) master slide line style, 2) theme, 3) direct formatting
1098 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"), PPTX
);
1100 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1101 // First shape's line style is defined on master slide
1103 SdrObject
*const pObj
= pPage
->GetObj(0);
1104 CPPUNIT_ASSERT(pObj
);
1106 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
1107 pObj
->GetMergedItem(XATTR_LINESTYLE
));
1108 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH
, rStyleItem
.GetValue());
1110 const XLineColorItem
& rColorItem
= dynamic_cast<const XLineColorItem
&>(
1111 pObj
->GetMergedItem(XATTR_LINECOLOR
));
1112 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem
.GetColorValue()));
1114 const XLineWidthItem
& rWidthItem
= dynamic_cast<const XLineWidthItem
&>(
1115 pObj
->GetMergedItem(XATTR_LINEWIDTH
));
1116 CPPUNIT_ASSERT_EQUAL(sal_Int32(132), rWidthItem
.GetValue());
1119 // Second shape's line style is defined by theme
1121 SdrObject
*const pObj
= pPage
->GetObj(1);
1122 CPPUNIT_ASSERT(pObj
);
1124 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
1125 pObj
->GetMergedItem(XATTR_LINESTYLE
));
1126 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID
, rStyleItem
.GetValue());
1128 const XLineColorItem
& rColorItem
= dynamic_cast<const XLineColorItem
&>(
1129 pObj
->GetMergedItem(XATTR_LINECOLOR
));
1130 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem
.GetColorValue()));
1132 const XLineWidthItem
& rWidthItem
= dynamic_cast<const XLineWidthItem
&>(
1133 pObj
->GetMergedItem(XATTR_LINEWIDTH
));
1134 CPPUNIT_ASSERT_EQUAL(sal_Int32(35), rWidthItem
.GetValue());
1137 // Third shape's line style is defined by direct formatting
1139 SdrObject
*const pObj
= pPage
->GetObj(2);
1140 CPPUNIT_ASSERT(pObj
);
1142 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
1143 pObj
->GetMergedItem(XATTR_LINESTYLE
));
1144 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID
, rStyleItem
.GetValue());
1146 const XLineColorItem
& rColorItem
= dynamic_cast<const XLineColorItem
&>(
1147 pObj
->GetMergedItem(XATTR_LINECOLOR
));
1148 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x7030A0), sal_uInt32(rColorItem
.GetColorValue()));
1150 const XLineWidthItem
& rWidthItem
= dynamic_cast<const XLineWidthItem
&>(
1151 pObj
->GetMergedItem(XATTR_LINEWIDTH
));
1152 CPPUNIT_ASSERT_EQUAL(sal_Int32(176), rWidthItem
.GetValue());
1155 xDocShRef
->DoClose();
1158 void SdImportTest::testTableBorderLineStyle()
1160 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tableBorderLineStyle.pptx"), PPTX
);
1162 // TODO: If you are working on improvement of table border line style
1163 // support, then expect this unit test to fail.
1165 const sal_Int16 nObjBorderLineStyles
[] =
1167 ::table::BorderLineStyle::DASHED
,
1168 ::table::BorderLineStyle::DASH_DOT_DOT
,
1169 ::table::BorderLineStyle::DASH_DOT
,
1170 ::table::BorderLineStyle::DOTTED
,
1171 ::table::BorderLineStyle::DASHED
,
1172 ::table::BorderLineStyle::DOTTED
,
1173 ::table::BorderLineStyle::DASHED
,
1174 ::table::BorderLineStyle::DASH_DOT
,
1175 ::table::BorderLineStyle::DASH_DOT
,
1176 ::table::BorderLineStyle::SOLID
,
1177 ::table::BorderLineStyle::NONE
1180 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1181 CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(nObjBorderLineStyles
), pPage
->GetObjCount());
1183 sdr::table::SdrTableObj
*pTableObj
;
1184 uno::Reference
< table::XCellRange
> xTable
;
1185 uno::Reference
< beans::XPropertySet
> xCell
;
1186 table::BorderLine2 aBorderLine
;
1188 for (size_t i
= 0; i
< SAL_N_ELEMENTS(nObjBorderLineStyles
); i
++)
1190 pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(i
));
1191 CPPUNIT_ASSERT( pTableObj
);
1192 xTable
.set(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1193 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1194 xCell
->getPropertyValue("TopBorder") >>= aBorderLine
;
1195 if (aBorderLine
.LineWidth
> 0) {
1196 CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles
[i
], aBorderLine
.LineStyle
);
1200 xDocShRef
->DoClose();
1203 void SdImportTest::testBnc862510_6()
1205 // Black text was imported instead of gray
1206 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"), PPTX
);
1207 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1209 // Get first paragraph of the text
1210 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
1212 // Get first run of the paragraph
1213 uno::Reference
<text::XTextRange
> xRun( getRunFromParagraph( 0, xParagraph
) );
1214 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
1215 sal_Int32 nCharColor
;
1216 xPropSet
->getPropertyValue( "CharColor" ) >>= nCharColor
;
1218 // Color should be gray
1219 CPPUNIT_ASSERT_EQUAL( sal_Int32(0x8B8B8B), nCharColor
);
1221 xDocShRef
->DoClose();
1224 void SdImportTest::testBnc862510_7()
1226 // Title shape's text was aligned to left instead of center.
1227 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX
);
1228 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1230 // Get first paragraph
1231 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
1232 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
1234 sal_Int16 nParaAdjust
= 0;
1235 xPropSet
->getPropertyValue( "ParaAdjust" ) >>= nParaAdjust
;
1236 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
, static_cast<style::ParagraphAdjust
>(nParaAdjust
));
1238 xDocShRef
->DoClose();
1241 #if ENABLE_PDFIMPORT
1243 void SdImportTest::testPDFImportShared()
1245 comphelper::LibreOfficeKit::setActive();
1246 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pdf/multipage.pdf"), PDF
);
1247 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1248 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
1250 // This test is to verify that we share the PDF stream linked to each
1251 // Graphic instance in the imported document.
1252 // Since we import PDFs as images, we support attaching the original
1253 // PDF with each image to allow for advanced editing.
1254 // Here we iterate over all Graphic instances embedded in the pages
1255 // and verify that they all point to the same object in memory.
1256 std::vector
<std::shared_ptr
<std::vector
<sal_Int8
>>> aPdfSeqSharedPtrs
;
1257 std::vector
<std::shared_ptr
<GfxLink
>> aGfxLinkSharedPtrs
;
1259 for (int nPageIndex
= 0; nPageIndex
< pDoc
->GetPageCount(); ++nPageIndex
)
1261 const SdrPage
* pPage
= GetPage(nPageIndex
, xDocShRef
);
1262 if (pPage
== nullptr)
1265 for (size_t nObjIndex
= 0; nObjIndex
< pPage
->GetObjCount(); ++nObjIndex
)
1267 SdrObject
* pObject
= pPage
->GetObj(nObjIndex
);
1268 if (pObject
== nullptr)
1271 SdrGrafObj
* pSdrGrafObj
= dynamic_cast<SdrGrafObj
*>(pObject
);
1272 if (pSdrGrafObj
== nullptr)
1275 const GraphicObject
& rGraphicObject
= pSdrGrafObj
->GetGraphicObject().GetGraphic();
1276 const Graphic
& rGraphic
= rGraphicObject
.GetGraphic();
1277 aPdfSeqSharedPtrs
.push_back(rGraphic
.getPdfData());
1278 aGfxLinkSharedPtrs
.push_back(rGraphic
.GetSharedGfxLink());
1282 CPPUNIT_ASSERT_MESSAGE("Expected more than one page.", aPdfSeqSharedPtrs
.size() > 1);
1283 CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected as many PDF streams as GfxLinks.",
1284 aPdfSeqSharedPtrs
.size(), aGfxLinkSharedPtrs
.size());
1286 const std::shared_ptr
<std::vector
<sal_Int8
>> pPdfSeq
= aPdfSeqSharedPtrs
[0];
1287 const std::shared_ptr
<GfxLink
> pGfxLink
= aGfxLinkSharedPtrs
[0];
1288 for (size_t i
= 0; i
< aPdfSeqSharedPtrs
.size(); ++i
)
1290 CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected all PDF streams to be identical.",
1291 aPdfSeqSharedPtrs
[i
].get(), pPdfSeq
.get());
1292 CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected all GfxLinks to be identical.",
1293 aGfxLinkSharedPtrs
[i
].get(), pGfxLink
.get());
1296 xDocShRef
->DoClose();
1297 comphelper::LibreOfficeKit::setActive(false);
1300 #if defined(IMPORT_PDF_ELEMENTS)
1302 void SdImportTest::testPDFImport()
1304 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF
);
1305 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1306 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
1307 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1308 uno::Reference
< drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1309 CPPUNIT_ASSERT_EQUAL_MESSAGE( "no exactly two shapes", static_cast<sal_Int32
>(2), xPage
->getCount() );
1311 uno::Reference
< beans::XPropertySet
> xShape( getShape( 0, xPage
) );
1312 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
1313 CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText
.is() );
1315 xDocShRef
->DoClose();
1318 void SdImportTest::testPDFImportSkipImages()
1320 SfxAllItemSet
*pParams
= new SfxAllItemSet( SfxGetpApp()->GetPool() );
1321 pParams
->Put( SfxStringItem ( SID_FILE_FILTEROPTIONS
, "SkipImages" ) );
1323 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF
, pParams
);
1324 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1325 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
1326 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1327 uno::Reference
< drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1328 CPPUNIT_ASSERT_EQUAL_MESSAGE( "no exactly one shape", static_cast<sal_Int32
>(1), xPage
->getCount() );
1330 uno::Reference
< drawing::XShape
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY_THROW
);
1331 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
1332 CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText
.is() );
1334 xDocShRef
->DoClose();
1340 void SdImportTest::testBulletSuffix()
1342 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n83889.pptx"), PPTX
);
1344 // check suffix of the char bullet
1345 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1346 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
1347 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
1348 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
1349 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(1).GetItem(EE_PARA_NUMBULLET
);
1350 CPPUNIT_ASSERT(pNumFmt
);
1351 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's suffix is wrong!", pNumFmt
->GetNumRule()->GetLevel(0).GetSuffix(), OUString() );
1352 xDocShRef
->DoClose();
1355 void SdImportTest::testBnc910045()
1357 // Problem with table style which defines cell color with fill style
1358 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc910045.pptx"), PPTX
);
1359 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1361 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1362 CPPUNIT_ASSERT( pTableObj
);
1363 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1364 uno::Reference
< beans::XPropertySet
> xCell
;
1367 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1368 xCell
->getPropertyValue("FillColor") >>= nColor
;
1369 CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor
);
1371 xDocShRef
->DoClose();
1374 void SdImportTest::testRowHeight()
1376 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n80340.pptx"), PPTX
);
1377 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1379 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1380 CPPUNIT_ASSERT( pTableObj
);
1383 const OUString
sHeight("Height");
1384 uno::Reference
< css::table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_SET_THROW
);
1385 uno::Reference
< css::table::XTableRows
> xRows( xTable
->getRows(), uno::UNO_SET_THROW
);
1386 uno::Reference
< beans::XPropertySet
> xRefRow( xRows
->getByIndex(0), uno::UNO_QUERY_THROW
);
1387 xRefRow
->getPropertyValue( sHeight
) >>= nHeight
;
1388 CPPUNIT_ASSERT_EQUAL( sal_Int32(507), nHeight
);
1390 xDocShRef
->DoClose();
1393 void SdImportTest::testTdf93830()
1395 // Text shape offset was ignored
1396 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf93830.pptx"), PPTX
);
1397 uno::Reference
< drawing::XDrawPage
> xPage( getPage( 0, xDocShRef
) );
1399 // Get the first text box from group shape
1400 uno::Reference
< container::XIndexAccess
> xShape( xPage
->getByIndex(0), uno::UNO_QUERY
);
1401 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
->getByIndex(3), uno::UNO_QUERY
);
1402 CPPUNIT_ASSERT_MESSAGE( "no textbox shape", xPropSet
.is() );
1404 sal_Int32 nTextLeftDistance
= 0;
1405 xPropSet
->getPropertyValue( "TextLeftDistance" ) >>= nTextLeftDistance
;
1406 CPPUNIT_ASSERT_EQUAL(sal_Int32(4152), nTextLeftDistance
);
1408 xDocShRef
->DoClose();
1411 void SdImportTest::testTdf127129()
1413 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf127129.pptx"), PPTX
);
1414 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1415 uno::Reference
< text::XTextRange
> xParagraph( getParagraphFromShape( 0, xShape
) );
1416 uno::Reference
< text::XTextRange
> xRun( getRunFromParagraph( 0, xParagraph
) );
1417 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
1419 sal_Int32 nCharColor
;
1420 xPropSet
->getPropertyValue( "CharColor" ) >>= nCharColor
;
1421 CPPUNIT_ASSERT_EQUAL( sal_Int32(0x000000), nCharColor
);
1423 // Without the accompanying fix in place, the highlight would be -1
1424 sal_Int32 nCharBackColor
;
1425 xPropSet
->getPropertyValue( "CharBackColor" ) >>= nCharBackColor
;
1426 CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF00), nCharBackColor
);
1428 xDocShRef
->DoClose();
1430 void SdImportTest::testTdf93097()
1432 // Throwing metadata import aborted the filter, check that metadata is now imported.
1433 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf93097.pptx"), PPTX
);
1434 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier(xDocShRef
->GetModel(), uno::UNO_QUERY
);
1435 uno::Reference
<document::XDocumentProperties
> xDocumentProperties
= xDocumentPropertiesSupplier
->getDocumentProperties();
1436 CPPUNIT_ASSERT_EQUAL(OUString("ss"), xDocumentProperties
->getTitle());
1437 xDocShRef
->DoClose();
1440 void SdImportTest::testTdf62255()
1442 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf62255.pptx"), PPTX
);
1443 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1445 sdr::table::SdrTableObj
*pTableObj
;
1446 pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1447 CPPUNIT_ASSERT( pTableObj
);
1450 uno::Reference
< table::XCellRange
> xTable
;
1451 uno::Reference
< beans::XPropertySet
> xCell
;
1452 xTable
.set(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1453 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1454 aAny
= xCell
->getPropertyValue("FillStyle");
1456 if (aAny
.hasValue())
1458 drawing::FillStyle aFillStyle
;
1459 aAny
>>= aFillStyle
;
1460 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, aFillStyle
);
1463 xDocShRef
->DoClose();
1466 void SdImportTest::testTdf93124()
1468 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/tdf93124.ppt"), PPT
);
1469 uno::Reference
< uno::XComponentContext
> xContext
= ::comphelper::getProcessComponentContext();
1470 uno::Reference
< drawing::XGraphicExportFilter
> xGraphicExporter
= drawing::GraphicExportFilter::create(xContext
);
1472 uno::Sequence
< beans::PropertyValue
> aFilterData(2);
1473 aFilterData
[0].Name
= "PixelWidth";
1474 aFilterData
[0].Value
<<= sal_Int32(320);
1475 aFilterData
[1].Name
= "PixelHeight";
1476 aFilterData
[1].Value
<<= sal_Int32(180);
1478 utl::TempFile aTempFile
;
1479 aTempFile
.EnableKillingFile();
1481 uno::Sequence
< beans::PropertyValue
> aDescriptor(3);
1482 aDescriptor
[0].Name
= "URL";
1483 aDescriptor
[0].Value
<<= aTempFile
.GetURL();
1484 aDescriptor
[1].Name
= "FilterName";
1485 aDescriptor
[1].Value
<<= OUString("PNG");
1486 aDescriptor
[2].Name
= "FilterData";
1487 aDescriptor
[2].Value
<<= aFilterData
;
1489 uno::Reference
< lang::XComponent
> xPage(getPage(0, xDocShRef
), uno::UNO_QUERY
);
1490 xGraphicExporter
->setSourceDocument(xPage
);
1491 xGraphicExporter
->filter(aDescriptor
);
1493 SvFileStream
aFileStream(aTempFile
.GetURL(), StreamMode::READ
);
1494 vcl::PNGReader
aPNGReader(aFileStream
);
1495 BitmapEx aBMPEx
= aPNGReader
.Read();
1497 // make sure the bitmap is not empty and correct size (PNG export->import was successful)
1498 CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx
.GetSizePixel());
1499 Bitmap aBMP
= aBMPEx
.GetBitmap();
1501 Bitmap::ScopedReadAccess
pReadAccess(aBMP
);
1502 int nNonWhiteCount
= 0;
1503 // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white.
1504 for (long nY
= 4; nY
< (4 + 26); ++nY
)
1506 for (long nX
= 34; nX
< (34 + 43); ++nX
)
1508 const Color aColor
= pReadAccess
->GetColor(nY
, nX
);
1509 if ((aColor
.GetRed() != 0xff) || (aColor
.GetGreen() != 0xff) || (aColor
.GetBlue() != 0xff))
1513 CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount
>50);
1515 xDocShRef
->DoClose();
1518 void SdImportTest::testTdf99729()
1520 const OUString filenames
[] = { "/sd/qa/unit/data/odp/tdf99729-new.odp", "/sd/qa/unit/data/odp/tdf99729-legacy.odp" };
1521 int nonwhitecounts
[] = { 0, 0 };
1522 for (size_t i
= 0; i
< SAL_N_ELEMENTS(filenames
); ++i
)
1524 // 1st check for new behaviour - having AnchoredTextOverflowLegacy compatibility flag set to false in settings.xml
1525 uno::Reference
<lang::XComponent
> xComponent
1526 = loadFromDesktop(m_directories
.getURLFromSrc(filenames
[i
]),
1527 "com.sun.star.presentation.PresentationDocument");
1529 uno::Reference
<uno::XComponentContext
> xContext
= getComponentContext();
1530 CPPUNIT_ASSERT(xContext
.is());
1531 uno::Reference
< drawing::XGraphicExportFilter
> xGraphicExporter
= drawing::GraphicExportFilter::create(xContext
);
1532 CPPUNIT_ASSERT(xGraphicExporter
.is());
1534 uno::Sequence
< beans::PropertyValue
> aFilterData(2);
1535 aFilterData
[0].Name
= "PixelWidth";
1536 aFilterData
[0].Value
<<= sal_Int32(320);
1537 aFilterData
[1].Name
= "PixelHeight";
1538 aFilterData
[1].Value
<<= sal_Int32(240);
1540 utl::TempFile aTempFile
;
1541 aTempFile
.EnableKillingFile();
1543 uno::Sequence
< beans::PropertyValue
> aDescriptor(3);
1544 aDescriptor
[0].Name
= "URL";
1545 aDescriptor
[0].Value
<<= aTempFile
.GetURL();
1546 aDescriptor
[1].Name
= "FilterName";
1547 aDescriptor
[1].Value
<<= OUString("PNG");
1548 aDescriptor
[2].Name
= "FilterData";
1549 aDescriptor
[2].Value
<<= aFilterData
;
1551 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(xComponent
, uno::UNO_QUERY
);
1552 uno::Reference
<lang::XComponent
> xPage(xDrawPagesSupplier
->getDrawPages()->getByIndex(0),
1554 CPPUNIT_ASSERT(xPage
.is());
1555 xGraphicExporter
->setSourceDocument(xPage
);
1556 xGraphicExporter
->filter(aDescriptor
);
1558 SvFileStream
aFileStream(aTempFile
.GetURL(), StreamMode::READ
);
1559 vcl::PNGReader
aPNGReader(aFileStream
);
1560 BitmapEx aBMPEx
= aPNGReader
.Read();
1561 Bitmap aBMP
= aBMPEx
.GetBitmap();
1562 Bitmap::ScopedReadAccess
pRead(aBMP
);
1563 for (long nX
= 154; nX
< (154 + 12); ++nX
)
1565 for (long nY
= 16; nY
< (16 + 96); ++nY
)
1567 const Color aColor
= pRead
->GetColor(nY
, nX
);
1568 if ((aColor
.GetRed() != 0xff) || (aColor
.GetGreen() != 0xff) || (aColor
.GetBlue() != 0xff))
1569 ++nonwhitecounts
[i
];
1572 xComponent
->dispose();
1574 // The numbers 1-9 should be above the Text Box in rectangle 154,16 - 170,112.
1575 // If text alignment is wrong, the rectangle will be white.
1576 CPPUNIT_ASSERT_MESSAGE("Tdf99729: vertical alignment of text is incorrect!", nonwhitecounts
[0]>100); // it is 134 with cleartype disabled
1577 // The numbers 1-9 should be below the Text Box -> rectangle 154,16 - 170,112 should be white.
1578 CPPUNIT_ASSERT_EQUAL_MESSAGE("Tdf99729: legacy vertical alignment of text is incorrect!", 0, nonwhitecounts
[1]);
1581 void SdImportTest::testTdf89927()
1583 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf89927.pptx"), PPTX
);
1584 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1585 uno::Reference
< text::XTextRange
> xParagraph( getParagraphFromShape( 0, xShape
) );
1586 uno::Reference
< text::XTextRange
> xRun( getRunFromParagraph( 0, xParagraph
) );
1587 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
1589 sal_Int32 nCharColor
;
1590 xPropSet
->getPropertyValue( "CharColor" ) >>= nCharColor
;
1591 CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFFFFFF), nCharColor
);
1593 xDocShRef
->DoClose();
1596 void SdImportTest::testTdf93868()
1598 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf93868.pptx"), PPTX
);
1600 const SdrPage
*pPage
= &(GetPage( 1, xDocShRef
)->TRG_GetMasterPage());
1601 CPPUNIT_ASSERT_EQUAL(size_t(5), pPage
->GetObjCount());
1602 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, dynamic_cast<const XFillStyleItem
&>(pPage
->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE
)).GetValue());
1603 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, dynamic_cast<const XFillStyleItem
&>(pPage
->GetObj(1)->GetMergedItem(XATTR_FILLSTYLE
)).GetValue());
1605 xDocShRef
->DoClose();
1608 void SdImportTest::testTdf95932()
1610 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf95932.pptx"), PPTX
);
1612 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1613 SdrObject
*const pObj
= pPage
->GetObj(2);
1614 CPPUNIT_ASSERT(pObj
);
1616 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1617 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1618 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1619 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1620 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1621 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x76bf3d), sal_uInt32(rColorItem
.GetColorValue()));
1623 xDocShRef
->DoClose();
1626 void SdImportTest::testTdf99030()
1628 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf99030.pptx"), PPTX
);
1630 uno::Reference
< drawing::XMasterPagesSupplier
> xDoc(
1631 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1632 uno::Reference
< drawing::XDrawPage
> xPage(
1633 xDoc
->getMasterPages()->getByIndex( 0 ), uno::UNO_QUERY_THROW
);
1634 uno::Reference
< beans::XPropertySet
> xPropSet( xPage
, uno::UNO_QUERY
);
1636 sal_Int32
nFillColor(0);
1637 uno::Any aAny
= xPropSet
->getPropertyValue( "Background" );
1638 if (aAny
.hasValue())
1640 uno::Reference
< beans::XPropertySet
> xBackgroundPropSet
;
1641 aAny
>>= xBackgroundPropSet
;
1642 xBackgroundPropSet
->getPropertyValue( "FillColor" ) >>= nFillColor
;
1644 CPPUNIT_ASSERT_EQUAL( sal_Int32(0x676A55), nFillColor
);
1646 xDocShRef
->DoClose();
1649 void SdImportTest::testTdf49561()
1651 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/tdf49561.ppt"), PPT
);
1653 uno::Reference
< drawing::XMasterPagesSupplier
> xDoc(
1654 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1655 uno::Reference
< drawing::XDrawPage
> xPage(
1656 xDoc
->getMasterPages()->getByIndex( 0 ), uno::UNO_QUERY_THROW
);
1657 CPPUNIT_ASSERT_EQUAL( sal_Int32(5), xPage
->getCount() );
1659 uno::Reference
< beans::XPropertySet
> xShape( getShape( 3, xPage
) );
1660 uno::Reference
<text::XTextRange
> xParagraph( getParagraphFromShape( 0, xShape
) );
1661 uno::Reference
<text::XTextRange
> xRun( getRunFromParagraph (0, xParagraph
) );
1662 uno::Reference
< beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
1664 float fCharHeight
= 0;
1665 CPPUNIT_ASSERT(xPropSet
->getPropertyValue("CharHeight") >>= fCharHeight
);
1666 CPPUNIT_ASSERT_EQUAL(12.f
, fCharHeight
);
1668 OUString aCharFontName
;
1669 CPPUNIT_ASSERT(xPropSet
->getPropertyValue("CharFontName") >>= aCharFontName
);
1670 CPPUNIT_ASSERT_EQUAL(OUString("Stencil"), aCharFontName
);
1672 xDocShRef
->DoClose();
1675 void SdImportTest::testTdf103473()
1677 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf103473.pptx"), PPTX
);
1679 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
1680 SdrTextObj
*const pObj
= dynamic_cast<SdrTextObj
*const>(pPage
->GetObj(0));
1681 CPPUNIT_ASSERT(pObj
);
1682 ::tools::Rectangle aRect
= pObj
->GetGeoRect();
1683 CPPUNIT_ASSERT_EQUAL(3629L, aRect
.Left());
1684 CPPUNIT_ASSERT_EQUAL(4431L, aRect
.Top());
1685 CPPUNIT_ASSERT_EQUAL(8353L, aRect
.Right());
1686 CPPUNIT_ASSERT_EQUAL(9155L, aRect
.Bottom());
1688 xDocShRef
->DoClose();
1691 void SdImportTest::testAoo124143()
1693 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odg/ooo124143-1.odg"), ODG
);
1695 uno::Reference
<beans::XPropertySet
> const xImage(getShapeFromPage(0, 0, xDocShRef
));
1696 uno::Reference
<drawing::XGluePointsSupplier
> const xGPS(xImage
, uno::UNO_QUERY
);
1697 uno::Reference
<container::XIdentifierAccess
> const xGluePoints(xGPS
->getGluePoints(), uno::UNO_QUERY
);
1699 uno::Sequence
<sal_Int32
> const ids(xGluePoints
->getIdentifiers());
1700 CPPUNIT_ASSERT_EQUAL(sal_Int32(6), ids
.getLength());
1701 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ids
[0]);
1702 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), ids
[1]);
1703 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), ids
[2]);
1704 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), ids
[3]);
1705 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), ids
[4]);
1706 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), ids
[5]);
1708 // interesting ones are custom 4, 5
1709 drawing::GluePoint2 glue4
;
1710 xGluePoints
->getByIdentifier(4) >>= glue4
;
1711 CPPUNIT_ASSERT_EQUAL(sal_Int32( 2470), glue4
.Position
.X
);
1712 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1810), glue4
.Position
.Y
);
1714 drawing::GluePoint2 glue5
;
1715 xGluePoints
->getByIdentifier(5) >>= glue5
;
1716 CPPUNIT_ASSERT_EQUAL(sal_Int32(-2975), glue5
.Position
.X
);
1717 CPPUNIT_ASSERT_EQUAL(sal_Int32(-2165), glue5
.Position
.Y
);
1719 // now check connectors
1720 uno::Reference
<beans::XPropertySet
> const xEllipse(getShapeFromPage(1, 0, xDocShRef
));
1721 uno::Reference
<beans::XPropertySet
> const xConn1(getShapeFromPage(2, 0, xDocShRef
));
1722 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xConn1
->getPropertyValue("StartGluePointIndex").get
<sal_Int32
>());
1723 CPPUNIT_ASSERT_EQUAL(xEllipse
, xConn1
->getPropertyValue("StartShape").get
<uno::Reference
<beans::XPropertySet
>>());
1724 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xConn1
->getPropertyValue("EndGluePointIndex").get
<sal_Int32
>());
1725 CPPUNIT_ASSERT_EQUAL(xImage
, xConn1
->getPropertyValue("EndShape").get
<uno::Reference
<beans::XPropertySet
>>());
1726 uno::Reference
<beans::XPropertySet
> const xConn2(getShapeFromPage(3, 0, xDocShRef
));
1727 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xConn2
->getPropertyValue("StartGluePointIndex").get
<sal_Int32
>());
1728 CPPUNIT_ASSERT_EQUAL(xEllipse
, xConn2
->getPropertyValue("StartShape").get
<uno::Reference
<beans::XPropertySet
>>());
1729 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xConn2
->getPropertyValue("EndGluePointIndex").get
<sal_Int32
>());
1730 CPPUNIT_ASSERT_EQUAL(xImage
, xConn2
->getPropertyValue("EndShape").get
<uno::Reference
<beans::XPropertySet
>>());
1732 xDocShRef
->DoClose();
1735 void SdImportTest::testTdf103567()
1737 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf103567.odp"), ODP
);
1738 for (int i
= 0; i
< 4; ++i
)
1740 uno::Reference
<beans::XPropertySet
> const xShape(getShapeFromPage(i
, 0, xDocShRef
));
1741 uno::Reference
<document::XEventsSupplier
> const xEventsSupplier(xShape
, uno::UNO_QUERY
);
1742 uno::Reference
<container::XNameAccess
> const xEvents(xEventsSupplier
->getEvents());
1743 OString
const msg("shape " + OString::number(i
) + ": ");
1745 CPPUNIT_ASSERT(xEvents
->hasByName("OnClick"));
1746 uno::Sequence
<beans::PropertyValue
> props
;
1747 xEvents
->getByName("OnClick") >>= props
;
1748 comphelper::SequenceAsHashMap
const map(props
);
1750 auto iter(map
.find("EventType"));
1751 CPPUNIT_ASSERT_MESSAGE(OString(msg
+ "no EventType").getStr(), iter
!= map
.end());
1752 CPPUNIT_ASSERT_EQUAL_MESSAGE(msg
.getStr(), OUString("Presentation"), iter
->second
.get
<OUString
>());
1755 auto iter(map
.find("ClickAction"));
1756 CPPUNIT_ASSERT_MESSAGE(OString(msg
+ "no ClickAction").getStr(), iter
!= map
.end());
1759 CPPUNIT_ASSERT_EQUAL_MESSAGE(msg
.getStr(), css::presentation::ClickAction_DOCUMENT
, iter
->second
.get
<css::presentation::ClickAction
>());
1763 CPPUNIT_ASSERT_EQUAL_MESSAGE(msg
.getStr(), css::presentation::ClickAction_NEXTPAGE
, iter
->second
.get
<css::presentation::ClickAction
>());
1768 auto iter(map
.find("Bookmark"));
1769 CPPUNIT_ASSERT_MESSAGE(OString(msg
+ "no Bookmark").getStr(), iter
!= map
.end());
1770 CPPUNIT_ASSERT_EQUAL_MESSAGE(msg
.getStr(), OUString("http://example.com/"), iter
->second
.get
<OUString
>());
1774 xDocShRef
->DoClose();
1777 void SdImportTest::testTdf103792()
1779 // Title text shape on the actual slide contained no text neither a placeholder text.
1780 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf103792.pptx"), PPTX
);
1782 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
1783 CPPUNIT_ASSERT_MESSAGE("No page found", pPage
!= nullptr);
1784 SdrObject
*pObj
= pPage
->GetObj(0);
1785 CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj
!= nullptr);
1786 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>(pObj
);
1787 CPPUNIT_ASSERT_MESSAGE("Not a text object", pTxtObj
!= nullptr);
1789 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
1790 CPPUNIT_ASSERT_EQUAL(OUString("Click to add Title"), aEdit
.GetText(0));
1792 xDocShRef
->DoClose();
1795 void SdImportTest::testTdf103876()
1797 // Title text shape's placeholder text did not inherit the corresponding text properties
1798 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf103876.pptx"), PPTX
);
1799 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1801 // Check paragraph alignment
1802 sal_Int16 nParaAdjust
= 0;
1803 xShape
->getPropertyValue( "ParaAdjust" ) >>= nParaAdjust
;
1804 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
, static_cast<style::ParagraphAdjust
>(nParaAdjust
));
1806 // Check character color
1807 sal_Int32 nCharColor
;
1808 xShape
->getPropertyValue( "CharColor" ) >>= nCharColor
;
1809 CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF0000), nCharColor
);
1811 xDocShRef
->DoClose();
1814 void SdImportTest::testTdf79007()
1816 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf79007.pptx"), PPTX
);
1818 uno::Reference
<beans::XPropertySet
> xShape1(getShapeFromPage(0, 0, xDocShRef
));
1819 CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape1
.is());
1821 // Check we map mso washout to our watermark
1822 drawing::ColorMode aColorMode1
;
1823 xShape1
->getPropertyValue("GraphicColorMode") >>= aColorMode1
;
1824 CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK
, aColorMode1
);
1826 sal_Int16 nContrast1
;
1827 xShape1
->getPropertyValue("AdjustContrast") >>= nContrast1
;
1828 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nContrast1
);
1830 sal_Int16 nLuminance1
;
1831 xShape1
->getPropertyValue("AdjustLuminance") >>= nLuminance1
;
1832 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nLuminance1
);
1834 uno::Reference
<beans::XPropertySet
> xShape2(getShapeFromPage(1, 0, xDocShRef
));
1835 CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape2
.is());
1837 // Check we map mso grayscale to our grayscale
1838 drawing::ColorMode aColorMode2
;
1839 xShape2
->getPropertyValue("GraphicColorMode") >>= aColorMode2
;
1840 CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_GREYS
, aColorMode2
);
1842 sal_Int16 nContrast2
;
1843 xShape2
->getPropertyValue("AdjustContrast") >>= nContrast2
;
1844 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nContrast2
);
1846 sal_Int16 nLuminance2
;
1847 xShape2
->getPropertyValue("AdjustLuminance") >>= nLuminance2
;
1848 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nLuminance2
);
1850 uno::Reference
<beans::XPropertySet
> xShape3(getShapeFromPage(2, 0, xDocShRef
));
1851 CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape3
.is());
1853 // Check we map mso black/white to our black/white
1854 drawing::ColorMode aColorMode3
;
1855 xShape3
->getPropertyValue("GraphicColorMode") >>= aColorMode3
;
1856 CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_MONO
, aColorMode3
);
1858 sal_Int16 nContrast3
;
1859 xShape3
->getPropertyValue("AdjustContrast") >>= nContrast3
;
1860 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nContrast3
);
1862 sal_Int16 nLuminance3
;
1863 xShape3
->getPropertyValue("AdjustLuminance") >>= nLuminance3
;
1864 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), nLuminance3
);
1866 xDocShRef
->DoClose();
1869 void SdImportTest::testTdf104015()
1871 // Shape fill, line and effect properties were not inherited from master slide shape
1872 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104015.pptx"), PPTX
);
1874 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1875 CPPUNIT_ASSERT_MESSAGE("No page found", pPage
!= nullptr);
1876 SdrObject
*const pObj
= pPage
->GetObj(0);
1877 CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj
!= nullptr);
1878 // Should have a red fill color
1880 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1881 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1882 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1883 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1884 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1885 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem
.GetColorValue()));
1887 // Should have a blue line
1889 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
1890 pObj
->GetMergedItem(XATTR_LINESTYLE
));
1891 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID
, rStyleItem
.GetValue());
1893 const XLineColorItem
& rColorItem
= dynamic_cast<const XLineColorItem
&>(
1894 pObj
->GetMergedItem(XATTR_LINECOLOR
));
1895 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0000FF), sal_uInt32(rColorItem
.GetColorValue()));
1897 // Should have some shadow
1899 const SdrOnOffItem
& rShadowItem
= dynamic_cast<const SdrOnOffItem
&>(
1900 pObj
->GetMergedItem(SDRATTR_SHADOW
));
1901 CPPUNIT_ASSERT(rShadowItem
.GetValue());
1904 xDocShRef
->DoClose();
1907 void SdImportTest::testTdf104201()
1909 // Group shape properties did not overwrite the child shapes' fill
1910 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104201.pptx"), PPTX
);
1912 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
1913 CPPUNIT_ASSERT_MESSAGE("No page found", pPage
!= nullptr);
1915 // First shape has red fill, but this should be overwritten by green group fill
1917 SdrObject
*const pObj
= pPage
->GetObj(0);
1918 CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj
!= nullptr);
1919 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1920 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1921 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1922 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1923 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1924 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem
.GetColorValue()));
1926 // Second shape has blue fill, but this should be overwritten by green group fill
1928 SdrObject
*const pObj
= pPage
->GetObj(0);
1929 CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj
!= nullptr);
1930 const XFillStyleItem
& rStyleItem
= dynamic_cast<const XFillStyleItem
&>(
1931 pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1932 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rStyleItem
.GetValue());
1933 const XFillColorItem
& rColorItem
= dynamic_cast<const XFillColorItem
&>(
1934 pObj
->GetMergedItem(XATTR_FILLCOLOR
));
1935 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem
.GetColorValue()));
1938 xDocShRef
->DoClose();
1941 void SdImportTest::testTdf103477()
1943 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf103477.pptx"), PPTX
);
1945 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
1947 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(6) );
1948 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr );
1950 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
1951 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
1952 CPPUNIT_ASSERT(pNumFmt
);
1953 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", Color(0x000000), pNumFmt
->GetNumRule()->GetLevel(1).GetBulletColor());
1955 xDocShRef
->DoClose();
1958 void SdImportTest::testTdf105150()
1960 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf105150.pptx"), PPTX
);
1961 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
1962 const SdrObject
* pObj
= pPage
->GetObj(1);
1963 auto& rFillStyleItem
= dynamic_cast<const XFillStyleItem
&>(pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1964 // This was drawing::FillStyle_NONE, <p:sp useBgFill="1"> was ignored when
1965 // the slide didn't have an explicit background fill.
1966 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rFillStyleItem
.GetValue());
1967 xDocShRef
->DoClose();
1970 void SdImportTest::testTdf123684()
1972 sd::DrawDocShellRef xDocShRef
1973 = loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf123684.pptx"), PPTX
);
1974 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
1975 const SdrObject
* pObj
= pPage
->GetObj(0);
1976 auto& rFillStyleItem
1977 = dynamic_cast<const XFillStyleItem
&>(pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1978 // Without the accompanying fix in place, this test would have failed with 'Expected: 0; Actual:
1979 // 1', i.e. the shape's fill was FillStyle_SOLID, making the text of the shape unreadable.
1980 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE
, rFillStyleItem
.GetValue());
1981 xDocShRef
->DoClose();
1984 void SdImportTest::testTdf105150PPT()
1986 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/ppt/tdf105150.ppt"), PPT
);
1987 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
1988 const SdrObject
* pObj
= pPage
->GetObj(1);
1989 // This was drawing::FillStyle_NONE, the shape's mso_fillBackground was
1990 // ignored when the slide didn't have an explicit background fill.
1991 auto& rFillStyleItem
= dynamic_cast<const XFillStyleItem
&>(pObj
->GetMergedItem(XATTR_FILLSTYLE
));
1992 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rFillStyleItem
.GetValue());
1993 xDocShRef
->DoClose();
1996 void SdImportTest::testTdf104445()
1998 // Extra bullets were added to the first shape
1999 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104445.pptx"), PPTX
);
2001 // First shape should not have bullet
2003 uno::Reference
< beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
));
2004 uno::Reference
< text::XText
> xText
= uno::Reference
< text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
2005 CPPUNIT_ASSERT_MESSAGE("Not a text shape", xText
.is());
2006 uno::Reference
< beans::XPropertySet
> xPropSet(xText
, uno::UNO_QUERY_THROW
);
2008 uno::Reference
< container::XIndexAccess
> xNumRule
;
2009 xPropSet
->getPropertyValue("NumberingRules") >>= xNumRule
;
2010 uno::Sequence
<beans::PropertyValue
> aBulletProps
;
2011 xNumRule
->getByIndex(0) >>= aBulletProps
;
2013 for (int i
= 0; i
< aBulletProps
.getLength(); ++i
)
2015 const beans::PropertyValue
& rProp
= aBulletProps
[i
];
2016 if(rProp
.Name
== "NumberingType")
2017 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::NUMBER_NONE
), rProp
.Value
.get
<sal_Int16
>());
2018 if(rProp
.Name
== "LeftMargin")
2019 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp
.Value
.get
<sal_Int32
>());
2022 // Second shape should have bullet set
2024 uno::Reference
< beans::XPropertySet
> xShape(getShapeFromPage(1, 0, xDocShRef
));
2025 uno::Reference
< text::XText
> xText
= uno::Reference
< text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
2026 CPPUNIT_ASSERT_MESSAGE("Not a text shape", xText
.is());
2027 uno::Reference
< beans::XPropertySet
> xPropSet(xText
, uno::UNO_QUERY_THROW
);
2029 uno::Reference
< container::XIndexAccess
> xNumRule
;
2030 xPropSet
->getPropertyValue("NumberingRules") >>= xNumRule
;
2031 uno::Sequence
<beans::PropertyValue
> aBulletProps
;
2032 xNumRule
->getByIndex(0) >>= aBulletProps
;
2034 for(int i
= 0; i
< aBulletProps
.getLength(); ++i
)
2036 const beans::PropertyValue
& rProp
= aBulletProps
[i
];
2037 if(rProp
.Name
== "NumberingType")
2038 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::CHAR_SPECIAL
), rProp
.Value
.get
<sal_Int16
>());
2039 if(rProp
.Name
== "LeftMargin")
2040 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), rProp
.Value
.get
<sal_Int32
>());
2043 xDocShRef
->DoClose();
2049 bool checkPatternValues(std::vector
<sal_uInt8
>& rExpected
, Bitmap
& rBitmap
)
2051 bool bResult
= true;
2053 const Color
aFGColor(0xFF0000);
2054 const Color
aBGColor(0xFFFFFF);
2056 Bitmap::ScopedReadAccess
pAccess(rBitmap
);
2057 for (long y
= 0; y
< pAccess
->Height(); ++y
)
2059 Scanline pScanline
= pAccess
->GetScanline( y
);
2060 for (long x
= 0; x
< pAccess
->Width(); ++x
)
2062 Color aColor
= pAccess
->GetPixelFromData(pScanline
, x
);
2063 sal_uInt8 aValue
= rExpected
[y
*8+x
];
2065 if (aValue
== 1 && aColor
!= aFGColor
)
2067 else if (aValue
== 0 && aColor
!= aBGColor
)
2075 } // end anonymous namespace
2077 bool SdImportTest::checkPattern(sd::DrawDocShellRef
const & rDocRef
, int nShapeNumber
, std::vector
<sal_uInt8
>& rExpected
)
2079 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(nShapeNumber
, 0, rDocRef
));
2080 CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape
.is());
2085 uno::Any aBitmapAny
= xShape
->getPropertyValue("FillBitmap");
2086 uno::Reference
<awt::XBitmap
> xBitmap
;
2087 if (aBitmapAny
>>= xBitmap
)
2089 uno::Sequence
<sal_Int8
> aBitmapSequence(xBitmap
->getDIB());
2090 SvMemoryStream
aBitmapStream(aBitmapSequence
.getArray(),
2091 aBitmapSequence
.getLength(),
2093 ReadDIB(aBitmap
, aBitmapStream
, true);
2096 CPPUNIT_ASSERT_EQUAL(8L, aBitmap
.GetSizePixel().Width());
2097 CPPUNIT_ASSERT_EQUAL(8L, aBitmap
.GetSizePixel().Height());
2098 return checkPatternValues(rExpected
, aBitmap
);
2101 /* Test checks that importing a PPT file with all supported fill patterns is
2102 * correctly imported as a tiled fill bitmap with the expected pattern.
2104 void SdImportTest::testPatternImport()
2106 sd::DrawDocShellRef xDocRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/ppt/FillPatterns.ppt"), PPT
);
2108 std::vector
<sal_uInt8
> aExpectedPattern1
= {
2118 std::vector
<sal_uInt8
> aExpectedPattern2
= {
2128 std::vector
<sal_uInt8
> aExpectedPattern3
= {
2138 std::vector
<sal_uInt8
> aExpectedPattern4
= {
2148 std::vector
<sal_uInt8
> aExpectedPattern5
= {
2158 std::vector
<sal_uInt8
> aExpectedPattern6
= {
2168 std::vector
<sal_uInt8
> aExpectedPattern7
= {
2178 std::vector
<sal_uInt8
> aExpectedPattern8
= {
2188 std::vector
<sal_uInt8
> aExpectedPattern9
= {
2198 std::vector
<sal_uInt8
> aExpectedPattern10
= {
2208 std::vector
<sal_uInt8
> aExpectedPattern11
= {
2218 std::vector
<sal_uInt8
> aExpectedPattern12
= {
2228 std::vector
<sal_uInt8
> aExpectedPatternLine1
= {
2238 std::vector
<sal_uInt8
> aExpectedPatternLine2
= {
2248 std::vector
<sal_uInt8
> aExpectedPatternLine3
= {
2258 std::vector
<sal_uInt8
> aExpectedPatternLine4
= {
2268 std::vector
<sal_uInt8
> aExpectedPatternLine5
= {
2278 std::vector
<sal_uInt8
> aExpectedPatternLine6
= {
2288 std::vector
<sal_uInt8
> aExpectedPatternLine7
= {
2298 std::vector
<sal_uInt8
> aExpectedPatternLine8
= {
2308 std::vector
<sal_uInt8
> aExpectedPatternLine9
= {
2318 std::vector
<sal_uInt8
> aExpectedPatternLine10
= {
2328 std::vector
<sal_uInt8
> aExpectedPatternLine11
= {
2338 std::vector
<sal_uInt8
> aExpectedPatternLine12
= {
2349 CPPUNIT_ASSERT_MESSAGE("Pattern1 - 5%" , checkPattern(xDocRef
, 0, aExpectedPattern1
));
2350 CPPUNIT_ASSERT_MESSAGE("Pattern2 - 10%", checkPattern(xDocRef
, 1, aExpectedPattern2
));
2351 CPPUNIT_ASSERT_MESSAGE("Pattern3 - 20%", checkPattern(xDocRef
, 2, aExpectedPattern3
));
2352 CPPUNIT_ASSERT_MESSAGE("Pattern4 - 25%", checkPattern(xDocRef
, 3, aExpectedPattern4
));
2353 CPPUNIT_ASSERT_MESSAGE("Pattern5 - 30%", checkPattern(xDocRef
, 4, aExpectedPattern5
));
2354 CPPUNIT_ASSERT_MESSAGE("Pattern6 - 40%", checkPattern(xDocRef
, 5, aExpectedPattern6
));
2355 CPPUNIT_ASSERT_MESSAGE("Pattern7 - 50%", checkPattern(xDocRef
, 6, aExpectedPattern7
));
2356 CPPUNIT_ASSERT_MESSAGE("Pattern8 - 60%", checkPattern(xDocRef
, 7, aExpectedPattern8
));
2357 CPPUNIT_ASSERT_MESSAGE("Pattern9 - 70%", checkPattern(xDocRef
, 8, aExpectedPattern9
));
2358 CPPUNIT_ASSERT_MESSAGE("Pattern10 - 75%", checkPattern(xDocRef
, 9, aExpectedPattern10
));
2359 CPPUNIT_ASSERT_MESSAGE("Pattern11 - 80%", checkPattern(xDocRef
, 10, aExpectedPattern11
));
2360 CPPUNIT_ASSERT_MESSAGE("Pattern12 - 90%", checkPattern(xDocRef
, 11, aExpectedPattern12
));
2362 CPPUNIT_ASSERT_MESSAGE("Pattern13 - Light downward diagonal", checkPattern(xDocRef
, 12, aExpectedPatternLine1
));
2363 CPPUNIT_ASSERT_MESSAGE("Pattern14 - Light upward diagonal", checkPattern(xDocRef
, 13, aExpectedPatternLine2
));
2364 CPPUNIT_ASSERT_MESSAGE("Pattern15 - Dark downward diagonal", checkPattern(xDocRef
, 14, aExpectedPatternLine3
));
2365 CPPUNIT_ASSERT_MESSAGE("Pattern16 - Dark upward diagonal", checkPattern(xDocRef
, 15, aExpectedPatternLine4
));
2366 CPPUNIT_ASSERT_MESSAGE("Pattern17 - Wide downward diagonal", checkPattern(xDocRef
, 16, aExpectedPatternLine5
));
2367 CPPUNIT_ASSERT_MESSAGE("Pattern18 - Wide upward diagonal", checkPattern(xDocRef
, 17, aExpectedPatternLine6
));
2369 CPPUNIT_ASSERT_MESSAGE("Pattern19 - Light vertical", checkPattern(xDocRef
, 18, aExpectedPatternLine7
));
2370 CPPUNIT_ASSERT_MESSAGE("Pattern20 - Light horizontal", checkPattern(xDocRef
, 19, aExpectedPatternLine8
));
2371 CPPUNIT_ASSERT_MESSAGE("Pattern21 - Narrow vertical", checkPattern(xDocRef
, 20, aExpectedPatternLine9
));
2372 CPPUNIT_ASSERT_MESSAGE("Pattern22 - Narrow horizontal", checkPattern(xDocRef
, 21, aExpectedPatternLine10
));
2373 CPPUNIT_ASSERT_MESSAGE("Pattern23 - Dark vertical", checkPattern(xDocRef
, 22, aExpectedPatternLine11
));
2374 CPPUNIT_ASSERT_MESSAGE("Pattern24 - Dark horizontal", checkPattern(xDocRef
, 23, aExpectedPatternLine12
));
2376 // TODO: other patterns in the test document
2381 void SdImportTest::testTdf100926()
2383 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf100926.pptx"), PPTX
);
2384 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
2385 CPPUNIT_ASSERT(pPage
!= nullptr);
2387 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
2388 CPPUNIT_ASSERT(pTableObj
!= nullptr);
2389 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
2391 sal_Int32 nRotation
= 0;
2392 uno::Reference
< beans::XPropertySet
> xCell(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
2393 xCell
->getPropertyValue("RotateAngle") >>= nRotation
;
2394 CPPUNIT_ASSERT_EQUAL(sal_Int32(27000), nRotation
);
2396 xCell
.set(xTable
->getCellByPosition(1, 0), uno::UNO_QUERY_THROW
);
2397 xCell
->getPropertyValue("RotateAngle") >>= nRotation
;
2398 CPPUNIT_ASSERT_EQUAL(sal_Int32(9000), nRotation
);
2400 xCell
.set(xTable
->getCellByPosition(2, 0), uno::UNO_QUERY_THROW
);
2401 xCell
->getPropertyValue("RotateAngle") >>= nRotation
;
2402 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nRotation
);
2404 xDocShRef
->DoClose();
2407 void SdImportTest::testTdf89064()
2409 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf89064.pptx"), PPTX
);
2410 uno::Reference
< presentation::XPresentationPage
> xPage (getPage(0, xDocShRef
), uno::UNO_QUERY_THROW
);
2411 uno::Reference
< drawing::XDrawPage
> xNotesPage (xPage
->getNotesPage(), uno::UNO_SET_THROW
);
2412 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1), xNotesPage
->getCount());
2414 xDocShRef
->DoClose();
2417 void SdImportTest::testTdf108925()
2419 // Test document contains bulleting with too small bullet size (1%) which breaks the lower constraint
2420 // So it should be converted to the lowest allowed value (25%).
2421 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf108925.odp"), ODP
);
2422 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
2423 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>(pPage
->GetObj(0));
2424 CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj
!= nullptr);
2425 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
2427 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
2428 CPPUNIT_ASSERT(pNumFmt
);
2429 CPPUNIT_ASSERT_EQUAL(sal_uInt16(25), pNumFmt
->GetNumRule()->GetLevel(0).GetBulletRelSize());
2431 xDocShRef
->DoClose();
2434 void SdImportTest::testTdf109067()
2436 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf109067.pptx"), PPTX
);
2437 uno::Reference
< beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
), uno::UNO_SET_THROW
);
2438 awt::Gradient gradient
;
2439 CPPUNIT_ASSERT(xShape
->getPropertyValue("FillGradient") >>= gradient
);
2440 CPPUNIT_ASSERT_EQUAL(sal_Int16(450), gradient
.Angle
);
2442 xDocShRef
->DoClose();
2445 void SdImportTest::testTdf109187()
2447 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf109187.pptx"), PPTX
);
2448 uno::Reference
< beans::XPropertySet
> xArrow1(getShapeFromPage(0, 0, xDocShRef
), uno::UNO_SET_THROW
);
2449 awt::Gradient aGradient1
;
2450 CPPUNIT_ASSERT(xArrow1
->getPropertyValue("FillGradient") >>= aGradient1
);
2451 CPPUNIT_ASSERT_EQUAL(sal_Int16(2250), aGradient1
.Angle
);
2452 uno::Reference
< beans::XPropertySet
> xArrow2(getShapeFromPage(1, 0, xDocShRef
), uno::UNO_SET_THROW
);
2453 awt::Gradient aGradient2
;
2454 CPPUNIT_ASSERT(xArrow2
->getPropertyValue("FillGradient") >>= aGradient2
);
2455 CPPUNIT_ASSERT_EQUAL(sal_Int16(1350), aGradient2
.Angle
);
2457 xDocShRef
->DoClose();
2460 void SdImportTest::testTdf108926()
2462 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf108926.ppt"), PPT
);
2463 uno::Reference
< presentation::XPresentationPage
> xPage (getPage(0, xDocShRef
), uno::UNO_QUERY_THROW
);
2464 uno::Reference
< drawing::XDrawPage
> xNotesPage (xPage
->getNotesPage(), uno::UNO_SET_THROW
);
2465 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), xNotesPage
->getCount());
2467 // Second object should be imported as an empty presentation shape
2468 uno::Reference
< beans::XPropertySet
> xPresentationShape(xNotesPage
->getByIndex(1), uno::UNO_QUERY
);
2469 CPPUNIT_ASSERT(xPresentationShape
.is());
2470 bool bIsEmptyPresObject
= false;
2471 xPresentationShape
->getPropertyValue( "IsEmptyPresentationObject" ) >>= bIsEmptyPresObject
;
2472 CPPUNIT_ASSERT(bIsEmptyPresObject
);
2474 xDocShRef
->DoClose();
2477 void SdImportTest::testTdf100065()
2479 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf100065.pptx"), PPTX
);
2481 uno::Reference
< container::XIndexAccess
> xGroupShape1(getShapeFromPage(0, 0, xDocShRef
), uno::UNO_QUERY_THROW
);
2482 uno::Reference
< beans::XPropertySet
> xShape1(xGroupShape1
->getByIndex(1), uno::UNO_QUERY_THROW
);
2484 CPPUNIT_ASSERT(xShape1
->getPropertyValue("RotateAngle") >>= nAngle1
);
2485 CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nAngle1
);
2487 uno::Reference
< container::XIndexAccess
> xGroupShape2(getShapeFromPage(1, 0, xDocShRef
), uno::UNO_QUERY_THROW
);
2488 uno::Reference
< beans::XPropertySet
> xShape2(xGroupShape2
->getByIndex(0), uno::UNO_QUERY_THROW
);
2490 CPPUNIT_ASSERT(xShape2
->getPropertyValue("RotateAngle") >>= nAngle2
);
2491 CPPUNIT_ASSERT_EQUAL(sal_Int32(18000), nAngle2
);
2493 xDocShRef
->DoClose();
2496 void SdImportTest::testTdf90626()
2498 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf90626.pptx"), PPTX
);
2499 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
2500 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>(pPage
->GetObj(1));
2501 CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj
!= nullptr);
2502 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
2503 for(int i
= 0; i
< 4; i
++)
2505 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(i
).GetItem(EE_PARA_NUMBULLET
);
2506 CPPUNIT_ASSERT(pNumFmt
);
2507 CPPUNIT_ASSERT_DOUBLES_EQUAL(long(371), pNumFmt
->GetNumRule()->GetLevel(0).GetGraphicSize().getHeight(), long(1));
2510 xDocShRef
->DoClose();
2513 void SdImportTest::testTdf114488()
2515 // This doc has two images - one WMF and the other PNG (fallback image).
2516 // When loading this doc, the WMF image should be preferred over the PNG image.
2517 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odg/tdf114488.fodg"), FODG
);
2518 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
), uno::UNO_SET_THROW
);
2519 uno::Reference
<graphic::XGraphic
> xGraphic
;
2520 xShape
->getPropertyValue("Graphic") >>= xGraphic
;
2521 CPPUNIT_ASSERT(xGraphic
.is());
2522 Graphic
aGraphic(xGraphic
);
2523 OUString
sMimeType(comphelper::GraphicMimeTypeHelper::GetMimeTypeForXGraphic(xGraphic
));
2524 CPPUNIT_ASSERT_EQUAL(OUString("image/x-wmf"), sMimeType
);
2526 xDocShRef
->DoClose();
2529 void SdImportTest::testTdf114913()
2531 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf114913.pptx"), PPTX
);
2532 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>(GetPage(1, xDocShRef
)->GetObj(1));
2533 CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj
!= nullptr);
2534 const SvxNumBulletItem
*pItem
= pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
2535 CPPUNIT_ASSERT(pItem
);
2536 CPPUNIT_ASSERT_EQUAL(long(691), pItem
->GetNumRule()->GetLevel(0).GetGraphicSize().getHeight());
2538 xDocShRef
->DoClose();
2541 void SdImportTest::testTdf114821()
2544 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc( "/sd/qa/unit/data/pptx/tdf114821.pptx" ), PPTX
);
2546 uno::Reference
< beans::XPropertySet
> xPropSet( getShapeFromPage( 0, 0, xDocShRef
) );
2547 aAny
= xPropSet
->getPropertyValue( "Model" );
2548 CPPUNIT_ASSERT_MESSAGE( "The shape doesn't have the property", aAny
.hasValue() );
2550 uno::Reference
< chart::XChartDocument
> xChartDoc
;
2552 CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc
.is() );
2553 uno::Reference
< chart2::XChartDocument
> xChart2Doc( xChartDoc
, uno::UNO_QUERY
);
2554 CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc
.is() );
2556 uno::Reference
< chart2::XCoordinateSystemContainer
> xBCooSysCnt( xChart2Doc
->getFirstDiagram(), uno::UNO_QUERY
);
2557 uno::Sequence
< uno::Reference
< chart2::XCoordinateSystem
> > aCooSysSeq( xBCooSysCnt
->getCoordinateSystems() );
2558 uno::Reference
< chart2::XChartTypeContainer
> xCTCnt( aCooSysSeq
[0], uno::UNO_QUERY
);
2560 uno::Reference
< chart2::XDataSeriesContainer
> xDSCnt( xCTCnt
->getChartTypes()[0], uno::UNO_QUERY
);
2561 CPPUNIT_ASSERT_MESSAGE( "failed to load data series", xDSCnt
.is() );
2562 uno::Sequence
< uno::Reference
< chart2::XDataSeries
> > aSeriesSeq( xDSCnt
->getDataSeries() );
2563 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Invalid Series count", static_cast<sal_Int32
>( 1 ), aSeriesSeq
.getLength() );
2565 // Check the first label
2566 const css::uno::Reference
< css::beans::XPropertySet
>& rPropSet0( aSeriesSeq
[0]->getDataPointByIndex( 0 ) );
2567 CPPUNIT_ASSERT( rPropSet0
.is() );
2568 sal_Int32 aPlacement
;
2569 rPropSet0
->getPropertyValue( "LabelPlacement" ) >>= aPlacement
;
2570 CPPUNIT_ASSERT_EQUAL( css::chart::DataLabelPlacement::TOP
, aPlacement
);
2572 // Check the second label
2573 const css::uno::Reference
< css::beans::XPropertySet
>& rPropSet1( aSeriesSeq
[0]->getDataPointByIndex( 1 ) );
2574 CPPUNIT_ASSERT( rPropSet1
.is() );
2575 rPropSet1
->getPropertyValue( "LabelPlacement" ) >>= aPlacement
;
2576 CPPUNIT_ASSERT_EQUAL( css::chart::DataLabelPlacement::CENTER
, aPlacement
);
2578 // Check the third label
2579 const css::uno::Reference
< css::beans::XPropertySet
>& rPropSet2( aSeriesSeq
[0]->getDataPointByIndex( 2 ) );
2580 CPPUNIT_ASSERT( rPropSet2
.is() );
2581 rPropSet2
->getPropertyValue( "LabelPlacement") >>= aPlacement
;
2582 CPPUNIT_ASSERT_EQUAL( css::chart::DataLabelPlacement::TOP
, aPlacement
);
2584 xDocShRef
->DoClose();
2587 void SdImportTest::testTdf115394()
2589 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394.pptx"), PPTX
);
2590 double fTransitionDuration
;
2592 // Slow in MS formats
2593 SdPage
* pPage1
= xDocShRef
->GetDoc()->GetSdPage(0, PageKind::Standard
);
2594 fTransitionDuration
= pPage1
->getTransitionDuration();
2595 CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration
);
2597 // Medium in MS formats
2598 SdPage
* pPage2
= xDocShRef
->GetDoc()->GetSdPage(1, PageKind::Standard
);
2599 fTransitionDuration
= pPage2
->getTransitionDuration();
2600 CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration
);
2602 // Fast in MS formats
2603 SdPage
* pPage3
= xDocShRef
->GetDoc()->GetSdPage(2, PageKind::Standard
);
2604 fTransitionDuration
= pPage3
->getTransitionDuration();
2605 CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration
);
2608 SdPage
* pPage4
= xDocShRef
->GetDoc()->GetSdPage(3, PageKind::Standard
);
2609 fTransitionDuration
= pPage4
->getTransitionDuration();
2610 CPPUNIT_ASSERT_EQUAL(0.25, fTransitionDuration
);
2612 SdPage
* pPage5
= xDocShRef
->GetDoc()->GetSdPage(4, PageKind::Standard
);
2613 fTransitionDuration
= pPage5
->getTransitionDuration();
2614 CPPUNIT_ASSERT_EQUAL(4.25, fTransitionDuration
);
2616 xDocShRef
->DoClose();
2619 void SdImportTest::testTdf115394PPT()
2621 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/tdf115394.ppt"), PPT
);
2622 double fTransitionDuration
;
2625 SdPage
* pPage1
= xDocShRef
->GetDoc()->GetSdPage(0, PageKind::Standard
);
2626 fTransitionDuration
= pPage1
->getTransitionDuration();
2627 CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration
);
2630 SdPage
* pPage2
= xDocShRef
->GetDoc()->GetSdPage(1, PageKind::Standard
);
2631 fTransitionDuration
= pPage2
->getTransitionDuration();
2632 CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration
);
2635 SdPage
* pPage3
= xDocShRef
->GetDoc()->GetSdPage(2, PageKind::Standard
);
2636 fTransitionDuration
= pPage3
->getTransitionDuration();
2637 CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration
);
2639 xDocShRef
->DoClose();
2642 void SdImportTest::testTdf51340()
2644 // Line spacing was not inherited from upper levels (slide layout, master slide)
2645 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf51340.pptx"), PPTX
);
2646 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 1, 0, xDocShRef
) );
2648 // First paragraph has a 90% line spacing set on master slide
2649 uno::Reference
<text::XTextRange
> xParagraph( getParagraphFromShape( 0, xShape
) );
2650 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
2651 css::style::LineSpacing aSpacing
;
2652 xPropSet
->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing
;
2653 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(css::style::LineSpacingMode::PROP
), aSpacing
.Mode
);
2654 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(90), aSpacing
.Height
);
2656 // Second paragraph has a 125% line spacing set on slide layout
2657 xParagraph
.set( getParagraphFromShape( 1, xShape
) );
2658 xPropSet
.set( xParagraph
, uno::UNO_QUERY_THROW
);
2659 xPropSet
->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing
;
2660 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(css::style::LineSpacingMode::PROP
), aSpacing
.Mode
);
2661 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(125), aSpacing
.Height
);
2663 // Third paragraph has a 70% line spacing set directly on normal slide (master slide property is overridden)
2664 xParagraph
.set( getParagraphFromShape( 2, xShape
) );
2665 xPropSet
.set( xParagraph
, uno::UNO_QUERY_THROW
);
2666 xPropSet
->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing
;
2667 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(css::style::LineSpacingMode::PROP
), aSpacing
.Mode
);
2668 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(70), aSpacing
.Height
);
2670 // Fourth paragraph has a 190% line spacing set directly on normal slide (slide layout property is overridden)
2671 xParagraph
.set( getParagraphFromShape( 3, xShape
) );
2672 xPropSet
.set( xParagraph
, uno::UNO_QUERY_THROW
);
2673 xPropSet
->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing
;
2674 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(css::style::LineSpacingMode::PROP
), aSpacing
.Mode
);
2675 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(190), aSpacing
.Height
);
2677 xDocShRef
->DoClose();
2680 void SdImportTest::testTdf116899()
2682 // This is a PPT created in Impress and roundtripped in PP, the key times become [1, -1] in PP,
2683 // a time of -1 (-1000) in PPT means key times have to be distributed evenly between 0 and 1
2684 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/tdf116899.ppt"), PPT
);
2686 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
2687 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2688 uno::Reference
< drawing::XDrawPage
> xPage(
2689 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
2690 uno::Reference
< animations::XAnimationNodeSupplier
> xAnimNodeSupplier(
2691 xPage
, uno::UNO_QUERY_THROW
);
2692 uno::Reference
< animations::XAnimationNode
> xRootNode(
2693 xAnimNodeSupplier
->getAnimationNode() );
2694 std::vector
< uno::Reference
< animations::XAnimationNode
> > aAnimVector
;
2695 anim::create_deep_vector(xRootNode
, aAnimVector
);
2696 uno::Reference
< animations::XAnimate
> xNode(
2697 aAnimVector
[8], uno::UNO_QUERY_THROW
);
2698 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of key times in the animation node isn't 2.", static_cast<sal_Int32
>(2), xNode
->getKeyTimes().getLength() );
2699 CPPUNIT_ASSERT_EQUAL_MESSAGE( "First key time in the animation node isn't 0, key times aren't normalized.", 0., xNode
->getKeyTimes()[0] );
2700 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Second key time in the animation node isn't 1, key times aren't normalized.", 1., xNode
->getKeyTimes()[1] );
2702 xDocShRef
->DoClose();
2705 void SdImportTest::testTdf77747()
2707 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/ppt/tdf77747.ppt"), PPT
);
2708 CPPUNIT_ASSERT(xDocShRef
.is());
2709 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>(GetPage(1, xDocShRef
)->GetObj(0));
2710 CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj
!= nullptr);
2711 const SvxNumBulletItem
*pNumFmt
= pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
2712 CPPUNIT_ASSERT(pNumFmt
);
2713 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's suffix is wrong!", OUString("-"), pNumFmt
->GetNumRule()->GetLevel(0).GetSuffix() );
2714 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's numbering type is wrong!", SVX_NUM_NUMBER_HEBREW
,
2715 pNumFmt
->GetNumRule()->GetLevel(0).GetNumberingType());
2717 xDocShRef
->DoClose();
2720 void SdImportTest::testTdf116266()
2722 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf116266.odp"), ODP
);
2723 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
2724 sfx2::LinkManager
* rLinkManager
= pDoc
->GetLinkManager();
2725 // The document contains one SVG stored as a link.
2726 CPPUNIT_ASSERT_EQUAL(size_t(1), rLinkManager
->GetLinks().size());
2728 xDocShRef
->DoClose();
2731 void SdImportTest::testTdf119015()
2733 ::sd::DrawDocShellRef xDocShRef
2734 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf119015.pptx"), PPTX
);
2736 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
2738 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
2739 CPPUNIT_ASSERT(pTableObj
);
2740 // The position was previously not properly initialized: (0, 0, 100, 100)
2741 CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 1999)),
2742 pTableObj
->GetLogicRect());
2743 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable());
2745 // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException
2746 uno::Reference
<text::XTextRange
> xTextRange(xTable
->getCellByPosition(1, 0),
2747 uno::UNO_QUERY_THROW
);
2748 CPPUNIT_ASSERT_EQUAL(OUString("A3"), xTextRange
->getString());
2750 xDocShRef
->DoClose();
2753 void SdImportTest::testTdf123090()
2755 ::sd::DrawDocShellRef xDocShRef
2756 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf123090.pptx"), PPTX
);
2758 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
2760 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
2761 CPPUNIT_ASSERT(pTableObj
);
2763 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable());
2765 // Test that we actually have two cells: this threw css.lang.IndexOutOfBoundsException
2766 uno::Reference
<text::XTextRange
> xTextRange(xTable
->getCellByPosition(1, 0),
2767 uno::UNO_QUERY_THROW
);
2768 CPPUNIT_ASSERT_EQUAL(OUString("aaa"), xTextRange
->getString());
2771 const OUString
sWidth("Width");
2772 uno::Reference
< css::table::XTableColumns
> xColumns( xTable
->getColumns(), uno::UNO_SET_THROW
);
2773 uno::Reference
< beans::XPropertySet
> xRefColumn( xColumns
->getByIndex(1), uno::UNO_QUERY_THROW
);
2774 xRefColumn
->getPropertyValue( sWidth
) >>= nWidth
;
2775 CPPUNIT_ASSERT_EQUAL( sal_Int32(9136), nWidth
);
2777 xDocShRef
->DoClose();
2780 void SdImportTest::testTdf120028()
2782 // Check that the table shape has 4 columns.
2783 ::sd::DrawDocShellRef xDocShRef
2784 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf120028.pptx"), PPTX
);
2785 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(),
2787 CPPUNIT_ASSERT(xDoc
.is());
2789 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
2790 CPPUNIT_ASSERT(xPage
.is());
2792 // This failed, shape was not a table, all text was rendered in a single
2794 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
2795 uno::Reference
<table::XColumnRowRange
> xModel(xShape
->getPropertyValue("Model"),
2797 CPPUNIT_ASSERT(xModel
.is());
2799 uno::Reference
<table::XTableColumns
> xColumns
= xModel
->getColumns();
2800 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(4), xColumns
->getCount());
2802 // Check font size in the A1 cell.
2803 uno::Reference
<table::XCellRange
> xCells(xModel
, uno::UNO_QUERY
);
2804 uno::Reference
<beans::XPropertySet
> xCell(xCells
->getCellByPosition(0, 0), uno::UNO_QUERY
);
2805 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xCell
));
2806 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
2807 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY
);
2808 double fCharHeight
= 0;
2809 xPropSet
->getPropertyValue("CharHeight") >>= fCharHeight
;
2810 // This failed, non-scaled height was 13.5.
2811 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.5, fCharHeight
, 1E-12);
2813 xDocShRef
->DoClose();
2816 void SdImportTest::testTdf120028b()
2818 // Check that the table shape has 4 columns.
2819 ::sd::DrawDocShellRef xDocShRef
2820 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf120028b.pptx"), PPTX
);
2821 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(),
2823 CPPUNIT_ASSERT(xDoc
.is());
2825 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
2826 CPPUNIT_ASSERT(xPage
.is());
2828 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
2829 CPPUNIT_ASSERT(xShape
.is());
2831 uno::Reference
<table::XColumnRowRange
> xModel(xShape
->getPropertyValue("Model"),
2833 CPPUNIT_ASSERT(xModel
.is());
2835 uno::Reference
<table::XTableColumns
> xColumns
= xModel
->getColumns();
2836 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(4), xColumns
->getCount());
2838 // Check font color in the A1 cell.
2839 uno::Reference
<table::XCellRange
> xCells(xModel
, uno::UNO_QUERY
);
2840 uno::Reference
<beans::XPropertySet
> xCell(xCells
->getCellByPosition(0, 0), uno::UNO_QUERY
);
2841 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xCell
));
2842 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
2843 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY
);
2844 sal_Int32 nCharColor
= 0;
2845 xPropSet
->getPropertyValue("CharColor") >>= nCharColor
;
2846 // This was 0x1f497d, not white: text list style from placeholder shape
2847 // from slide layout was ignored.
2848 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0xffffff), nCharColor
);
2850 xDocShRef
->DoClose();
2853 void SdImportTest::testTdf126324()
2855 sd::DrawDocShellRef xDocShRef
2856 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126324.pptx"), PPTX
);
2857 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(),
2859 CPPUNIT_ASSERT(xDoc
.is());
2860 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
2861 CPPUNIT_ASSERT(xPage
.is());
2862 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
2863 CPPUNIT_ASSERT(xShape
.is());
2864 uno::Reference
< text::XText
> xText
= uno::Reference
< text::XTextRange
>( xShape
, uno::UNO_QUERY_THROW
)->getText();
2865 CPPUNIT_ASSERT_EQUAL(OUString
{"17"}, xText
->getString());
2868 void SdImportTest::testDescriptionImport()
2870 sd::DrawDocShellRef xDocShRef
2871 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/altdescription.pptx"), PPTX
);
2873 uno::Reference
<beans::XPropertySet
> xPropertySet(
2874 getShapeFromPage(/*nShape=*/2, /*nPage=*/0, xDocShRef
));
2877 xPropertySet
->getPropertyValue("Description") >>= sDesc
;
2879 CPPUNIT_ASSERT_EQUAL(OUString("We Can Do It!"), sDesc
);
2881 xDocShRef
->DoClose();
2884 void SdImportTest::testTdf83247()
2886 auto GetPause
= [this](const OUString
& sSrc
, sal_Int32 nFormat
) {
2887 sd::DrawDocShellRef xDocShRef
2888 = loadURL(m_directories
.getURLFromSrc(sSrc
), nFormat
);
2889 uno::Reference
<presentation::XPresentationSupplier
> xPresentationSupplier(
2890 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY
);
2891 uno::Reference
<beans::XPropertySet
> xPresentationProps(
2892 xPresentationSupplier
->getPresentation(), uno::UNO_QUERY_THROW
);
2894 auto retVal
= xPresentationProps
->getPropertyValue("Pause");
2895 xDocShRef
->DoClose();
2896 return retVal
.get
<sal_Int32
>();
2899 // 1. Check that presentation:pause attribute is imported correctly
2900 CPPUNIT_ASSERT_EQUAL(sal_Int32(10), GetPause("/sd/qa/unit/data/odp/loopPause10.odp", ODP
));
2902 // 2. ODF compliance: if presentation:pause attribute is absent, it must be treated as 0
2903 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), GetPause("/sd/qa/unit/data/odp/loopNoPause.odp", ODP
));
2905 // 3. Import PPT: pause should be 0
2906 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), GetPause("/sd/qa/unit/data/ppt/loopNoPause.ppt", PPT
));
2909 void SdImportTest::testTdf47365()
2911 sd::DrawDocShellRef xDocShRef
2912 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX
);
2913 uno::Reference
<presentation::XPresentationSupplier
> xPresentationSupplier(
2914 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2915 uno::Reference
<beans::XPropertySet
> xPresentationProps(xPresentationSupplier
->getPresentation(),
2916 uno::UNO_QUERY_THROW
);
2918 const bool bEndlessVal
= xPresentationProps
->getPropertyValue("IsEndless").get
<bool>();
2919 const sal_Int32 nPauseVal
= xPresentationProps
->getPropertyValue("Pause").get
<sal_Int32
>();
2921 // Check that we import "loop" attribute of the presentation, and don't introduce any pauses
2922 CPPUNIT_ASSERT(bEndlessVal
);
2923 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nPauseVal
);
2925 xDocShRef
->DoClose();
2928 void SdImportTest::testTdf122899()
2930 // tdf122899 FILEOPEN: ppt: old kind arc from MS Office 97 is broken
2931 // Error was, that the path coordinates of a mso_sptArc shape were read as sal_Int16
2932 // although they are unsigned 16 bit. This leads to wrong positions of start and end
2933 // point and results to a huge shape width in the test document.
2934 OUString aSrc
="sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt";
2935 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc(aSrc
), PPT
);
2936 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(
2937 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2938 CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier
.is());
2939 uno::Reference
<drawing::XDrawPages
> xDrawPages(xDrawPagesSupplier
->getDrawPages());
2940 uno::Reference
<drawing::XDrawPage
> xDrawPage(xDrawPages
->getByIndex(0), uno::UNO_QUERY_THROW
);
2941 CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage
.is());
2942 uno::Reference
<drawing::XShape
> xShape(xDrawPage
->getByIndex(0), uno::UNO_QUERY
);
2943 CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape
.is());
2944 awt::Rectangle aFrameRect
;
2945 uno::Reference
<beans::XPropertySet
> xShapeProps(xShape
, uno::UNO_QUERY
);
2946 CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps
.is());
2947 xShapeProps
->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT
) >>= aFrameRect
;
2948 // original width is 9cm, add some tolerance
2949 CPPUNIT_ASSERT_LESS(static_cast<sal_Int32
>(9020), aFrameRect
.Width
);
2951 xDocShRef
->DoClose();
2954 void SdImportTest::testOOXTheme()
2956 sd::DrawDocShellRef xDocShRef
2957 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/ooxtheme.pptx"), PPTX
);
2959 uno::Reference
<beans::XPropertySet
> xPropSet(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2960 uno::Sequence
<beans::PropertyValue
> aGrabBag
;
2961 xPropSet
->getPropertyValue("InteropGrabBag") >>= aGrabBag
;
2963 bool bTheme
= false;
2964 for (int i
= 0; i
< aGrabBag
.getLength(); i
++)
2966 if (aGrabBag
[i
].Name
== "OOXTheme")
2969 uno::Reference
<xml::dom::XDocument
> aThemeDom
;
2970 CPPUNIT_ASSERT(aGrabBag
[i
].Value
>>= aThemeDom
); // PropertyValue of proper type
2971 CPPUNIT_ASSERT(aThemeDom
.get()); // Reference not empty
2974 CPPUNIT_ASSERT(bTheme
); // Grab Bag has all the expected elements
2976 xDocShRef
->DoClose();
2979 void SdImportTest::testCropToShape()
2981 sd::DrawDocShellRef xDocShRef
2982 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/crop-to-shape.pptx"), PPTX
);
2983 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(
2984 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2985 CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier
.is());
2986 uno::Reference
<drawing::XDrawPages
> xDrawPages(xDrawPagesSupplier
->getDrawPages());
2987 uno::Reference
<drawing::XDrawPage
> xDrawPage(xDrawPages
->getByIndex(0), uno::UNO_QUERY_THROW
);
2988 CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage
.is());
2989 uno::Reference
<drawing::XShape
> xShape(xDrawPage
->getByIndex(0), uno::UNO_QUERY
);
2990 CPPUNIT_ASSERT_EQUAL(OUString
{"com.sun.star.drawing.CustomShape"}, xShape
->getShapeType());
2991 CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape
.is());
2992 uno::Reference
<beans::XPropertySet
> xShapeProps(xShape
, uno::UNO_QUERY
);
2993 css::drawing::FillStyle fillStyle
;
2994 xShapeProps
->getPropertyValue("FillStyle") >>= fillStyle
;
2995 CPPUNIT_ASSERT_EQUAL(css::drawing::FillStyle_BITMAP
, fillStyle
);
2996 css::drawing::BitmapMode bitmapmode
;
2997 xShapeProps
->getPropertyValue("FillBitmapMode") >>= bitmapmode
;
2998 CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH
, bitmapmode
);
3001 void SdImportTest::testTdf127964()
3003 sd::DrawDocShellRef xDocShRef
3004 = loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf127964.pptx"), PPTX
);
3005 const SdrPage
* pPage
= GetPage(1, xDocShRef
);
3006 const SdrObject
* pObj
= pPage
->GetObj(0);
3007 auto& rFillStyleItem
3008 = dynamic_cast<const XFillStyleItem
&>(pObj
->GetMergedItem(XATTR_FILLSTYLE
));
3009 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, rFillStyleItem
.GetValue());
3011 auto& rFillColorItem
3012 = dynamic_cast<const XFillColorItem
&>(pObj
->GetMergedItem(XATTR_FILLCOLOR
));
3013 // Without the accompanying fix in place, this test would have failed with:
3014 // - Expected: 4294967295
3015 // - Actual : 5210557
3016 // i.e. instead of transparent (which then got rendered as white), the shape fill color was
3018 CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT
, rFillColorItem
.GetColorValue());
3019 xDocShRef
->DoClose();
3022 void SdImportTest::testTdf106638()
3024 sd::DrawDocShellRef xDocShRef
3025 = loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf106638.pptx"), PPTX
);
3026 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
));
3027 uno::Reference
<text::XTextRange
> const xPara(getParagraphFromShape(1, xShape
));
3028 uno::Reference
<text::XText
> xText
= xPara
->getText();
3029 uno::Reference
<text::XTextCursor
> xTextCursor
= xText
->createTextCursorByRange(xPara
->getStart());
3030 uno::Reference
<beans::XPropertySet
> xPropSet(xTextCursor
, uno::UNO_QUERY_THROW
);
3031 OUString aCharFontName
;
3032 CPPUNIT_ASSERT(xTextCursor
->goRight(1, true));
3033 // First character U+f0fe that uses Wingding
3034 xPropSet
->getPropertyValue("CharFontName") >>= aCharFontName
;
3035 CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), aCharFontName
);
3037 // The rest characters that do not use Wingding.
3038 CPPUNIT_ASSERT(xTextCursor
->goRight(45, true));
3039 xPropSet
->getPropertyValue("CharFontName") >>= aCharFontName
;
3040 CPPUNIT_ASSERT(aCharFontName
!= "Wingdings");
3043 void SdImportTest::testTdf128684()
3045 sd::DrawDocShellRef xDocShRef
3046 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), PPTX
);
3047 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(),
3049 CPPUNIT_ASSERT(xDoc
.is());
3050 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
3051 CPPUNIT_ASSERT(xPage
.is());
3052 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
3053 CPPUNIT_ASSERT(xShape
.is());
3054 uno::Any aAny
= xShape
->getPropertyValue("CustomShapeGeometry");
3055 CPPUNIT_ASSERT(aAny
.hasValue());
3056 uno::Sequence
<beans::PropertyValue
> aProps
;
3057 CPPUNIT_ASSERT(aAny
>>= aProps
);
3058 sal_Int32 nRotateAngle
= 0;
3059 for( const auto& rProp
: std::as_const(aProps
) )
3061 if( rProp
.Name
== "TextPreRotateAngle")
3063 rProp
.Value
>>= nRotateAngle
;
3066 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(-90), nRotateAngle
);
3069 void SdImportTest::testTdf113198()
3071 sd::DrawDocShellRef xDocShRef
3072 = loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), PPTX
);
3074 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
));
3075 sal_Int16 nParaAdjust
= -1;
3076 xShape
->getPropertyValue("ParaAdjust") >>= nParaAdjust
;
3077 CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER
, static_cast<style::ParagraphAdjust
>(nParaAdjust
));
3080 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest
);
3082 CPPUNIT_PLUGIN_IMPLEMENT();
3084 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */