From 31650d5b4255c484faec11d570cb98a80f0120cc Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Thu, 5 Jun 2014 18:43:04 +0200 Subject: 1th part of bnc#870233: wrong list style in shapes Text list styles were copied, without proper copy constructor and operator. It lad to mix up list styles and so text font. Change-Id: Iee7a6c0c1f74322fd7b80e41a262849f948e463a --- sd/qa/unit/data/pptx/bnc870233_1.pptx | Bin 0 -> 34111 bytes sd/qa/unit/import-tests.cxx | 73 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 sd/qa/unit/data/pptx/bnc870233_1.pptx (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/bnc870233_1.pptx b/sd/qa/unit/data/pptx/bnc870233_1.pptx new file mode 100644 index 000000000000..0659e30b3840 Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc870233_1.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index ae5cdafb2bcd..b9418b4d99ca 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,7 @@ public: void testFdo71961(); void testMediaEmbedding(); void testBnc870237(); + void testBnc870233_1(); CPPUNIT_TEST_SUITE(SdFiltersTest); CPPUNIT_TEST(testDocumentLayout); @@ -99,6 +101,7 @@ public: CPPUNIT_TEST(testFdo71961); CPPUNIT_TEST(testMediaEmbedding); CPPUNIT_TEST(testBnc870237); + CPPUNIT_TEST(testBnc870233_1); CPPUNIT_TEST_SUITE_END(); }; @@ -760,6 +763,76 @@ void SdFiltersTest::testBnc870237() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc870233_1() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx")); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage (1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones) + + // First shape has red, bold font + { + const SdrTextObj *pObj = dynamic_cast( pPage->GetObj( 0 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0xff0000), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_BOLD, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NONE, pPosture->GetPosture()); + } + } + } + + // Second shape has blue, italic font + { + const SdrTextObj *pObj = dynamic_cast( pPage->GetObj( 1 ) ); + CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL); + const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); + std::vector rLst; + aEdit.GetCharAttribs(0, rLst); + for( std::vector::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) + { + const SvxColorItem *pCharColor = dynamic_cast((*it).pAttr); + if( pCharColor ) + { + CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff), pCharColor->GetValue().GetColor()); + } + const SvxWeightItem *pWeight = dynamic_cast((*it).pAttr); + if( pWeight ) + { + CPPUNIT_ASSERT_EQUAL( FontWeight::WEIGHT_NORMAL, pWeight->GetWeight()); + } + const SvxPostureItem *pPosture = dynamic_cast((*it).pAttr); + if( pPosture ) + { + CPPUNIT_ASSERT_EQUAL( FontItalic::ITALIC_NORMAL, pPosture->GetPosture()); + } + } + } + + xDocShRef->DoClose(); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit